[英]How to hightlight a react-native map like that?
我正在使用react-native-maps库显示地图,但是如何突出显示该屏幕截图这样的区域?
这就是Polygon 。
您需要提供要突出显示的区域的坐标。
将所有坐标放入数组中。
坐标将通过一条直线连接到其先前的坐标。 如果您发布的是图片,则需要使用一些坐标。 我个人不知道任何公共API返回所需区域的坐标数组,但是我敢肯定有一个,只是用谷歌搜索即可。
将坐标放置在数组中后,可在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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.