根据屏幕比例,当您缩小 Android 版 Mapbox 时,您可以看到地球的多个副本。
单个地图的经度范围是 -180 到 180。当我如下图所示缩小时,我应该收到大约 -240 到 -240 的可见边界,但是对于包裹和展开的边界,我得到 -121到 116。
val options =
CameraOptions.Builder().zoom(mapboxMap.cameraState.zoom)
.center(mapboxMap.cameraState.center)
.bearing(mapboxMap.cameraState.bearing)
.pitch(mapboxMap.cameraState.pitch)
.build()
val unwrappedBounds = mapboxMap.coordinateBoundsForCameraUnwrapped(options)
val wrappedBounds = mapboxMap.coordinateBoundsForCamera(options)
println("Wrapped: $wrappedBounds")
println("Unwrapped: $unwrappedBounds")
我预计会得到超过 -180 到 180 的界限,但展开的结果似乎正在包装。
记录结果:
Wrapped: [southwest: Point{type=Point, bbox=null,
coordinates=[-121.1356988416266,-82.59314961488414]}, northeast: Point{type=Point, bbox=null,
coordinates=[116.56624773466814, 82.94613012791345]}, infiniteBounds: false]
Unwrapped: [southwest: Point{type=Point, bbox=null,
coordinates=[-121.1356988416266, -82.59314961488414]}, northeast: Point{type=Point, bbox=null,
coordinates=[116.56624773466814, 82.94613012791345]}, infiniteBounds: false]
事实证明这是 Mapbox 11.0.0 的一个错误。我更新到11.6.0,问题解决了。