使地图视图适合圆形边界

Jor*_*dan 0 react-native react-native-maps

我正在使用该react-native-maps库生成一个地图视图,其中包含一些标记和周围的圆圈,我希望能够调整地图视图以包含圆圈而不仅仅是地图上的标记。有人有这样的工作吗?

这是显示我当前设置的小吃react-native

https://snack.expo.io/@jordanr/fittoelements-issue

小智 6

fitToElements 也不适合我。我必须使用 fitToCooperatives https://github.com/react-native-community/react-native-maps/blob/master/docs/mapview.md

this.mapRef.fitToCoordinates(coordinates)
Run Code Online (Sandbox Code Playgroud)

其中coordinates是 {latitude: number, longitude: number} 对象的数组

get4PointsAroundCircumference通过调用传递圆心位置和半径(Km)的函数,将圆转换为坐标数组

this.mapRef.fitToCoordinates(coordinates)
Run Code Online (Sandbox Code Playgroud)