![](/img/trans.png)
[英]Q: react-native-maps: how to use marker.showCallout() for an array of coordinates mapped as markers
[英]How to render directions coordinates in react-native-maps using mapquest coordinates data?
我正在嘗試使用 MapQuest REST API 中的坐標在 map 上渲染方向折線,但我得到的折線沒有准確地顯示在道路頂部。 相反,它顯示了一個不同的 output。我想准確地在道路頂部繪制多段線。 我發送以下請求以獲取路線(使用 MapQuest Directions Route API):
然后根據上面的請求 session id,我發送另一個請求來獲取坐標(使用 MapQuest Directions Route Shape API):
我正在使用數組route.shape.shapePoints
,我應該如何在 map 的道路上方正確繪制折線?
我正在使用的代碼:
<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>
下面是我得到的當前 map 的屏幕截圖:
嘗試將 generalize 選項設置為較低的值,例如 0 或 10。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.