我想在 google 地图中使用纬度和经度在本机反应中绘制多边形

I want to draw polygon inside google maps using latitude and longitude in react native

如何使用 react native 在 google 地图中绘制多边形。我有一个纬度和经度数组列表我想使用纬度和经度在 google 地图中绘制多边形。

请查看该包的文档,Polygon 组件接受一个坐标数组来绘制它。

应该围绕这些线,您的状态是一个坐标数组。

<Polygon coordinates={this.state.coordinates}/>

https://github.com/react-community/react-native-maps/blob/master/docs/polygon.md

这就是答案

<MapView>
    <Polygon
        coordinates={[
            { latitude: 37.8025259, longitude: -122.4351431 },
            { latitude: 37.7896386, longitude: -122.421646 },
            { latitude: 37.7665248, longitude: -122.4161628 },
            { latitude: 37.7734153, longitude: -122.4577787 },
            { latitude: 37.7948605, longitude: -122.4596065 },
            { latitude: 37.8025259, longitude: -122.4351431 }
        ]}
        strokeColor="#000" // fallback for when `strokeColors` is not supported by the map-provider
        strokeColors={[
            '#7F0000',
            '#00000000', // no color, creates a "long" gradient between the previous and next coordinate
            '#B24112',
            '#E5845C',
            '#238C23',
            '#7F0000'
        ]}
        strokeWidth={6}
    />
</MapView>