Ism*_*iel 1 javascript reactjs react-native react-native-maps
我正在使用react-native-maps库来显示地图,但是如何突出显示像这个屏幕截图这样的区域?

它被称为多边形。
您需要提供要突出显示的区域的坐标。
将所有坐标放入数组中。
一个坐标将用一条直线连接到它的前一个坐标。对于您发布的图像,您需要大量坐标。我个人不知道有任何公共 API 可以返回所需区域的坐标数组,但我确信有一个,只需 google 一下即可。
一旦你有了数组中的坐标,就可以在你的MapView:
<MapView>
<MapView.Polygon
coordinates={[
{ latitude: 123, longitude: 123 },
{ latitude: 124, longitude: 124 },
...
]}
strokeWidth={1} // The width of the outline of the shape
strokeColor='#4099FF' // Color of the outline
fillColor='rgba(...)' // Shape color
/>
</MapView>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1805 次 |
| 最近记录: |