【发布时间】:2020-08-19 13:36:52
【问题描述】:
我正在尝试使用 MapQuest REST API 中的坐标在地图上渲染方向折线,但我得到折线没有完全显示在道路顶部。相反,它显示了不同的输出。 我想准确地在道路顶部绘制折线。我正在发送以下请求以获取路线(使用 MapQuest Directions Route API):
然后根据上述请求会话 id,我正在发送另一个请求以获取坐标(使用 MapQuest Directions Route Shape API):
我正在使用数组route.shape.shapePoints,我应该如何在地图上的道路上方正确绘制折线?
我正在使用的代码:
<MapView
style={{ flex: 1 }}
showsUserLocation
initialRegion={{
latitude,
longitude,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421
}}
>
<MapView.Polyline strokeWidth={2} strokeColor="red" coordinates={this.state.coords}></MapView.Polyline>
</MapView>
下面是我得到的当前地图的截图:
【问题讨论】:
标签: android react-native openstreetmap react-native-maps mapquest