我正在使用react-native-maps库来显示地图,但是如何突出显示这个截图的区域?
答案 0 :(得分:0)
它被称为Polygon。
您需要提供要突出显示的区域的坐标。
将所有坐标放在数组中。
坐标将以直线连接到其先前的坐标。如果您发布的图像,您需要一个looooot坐标。我个人不知道任何公共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>