编辑:这是一个针对此SDK的已确认错误。
我正在使用Google Maps for iOS SDK 1.1.1.2311版本,并且我想要查找可见地图在屏幕上的边界纬度和经度坐标。
我使用下面的代码来告诉我当前的投影:
NSLog(@"\n%@,%@\n%@,%@\n%@,%@\n%@,%@\n",
[NSNumber numberWithDouble:mapView.projection.visibleRegion.farLeft.latitude],
[NSNumber numberWithDouble:mapView.projection.visibleRegion.farLeft.longitude],
[NSNumber numberWithDouble:mapView.projection.visibleRegion.farRight.latitude],
[NSNumber numberWithDouble:mapView.projection.visibleRegion.farRight.longitude],
[NSNumber numberWithDouble:mapView.projection.visibleRegion.nearLeft.latitude],
[NSNumber numberWithDouble:mapView.projection.visibleRegion.nearLeft.longitude],
[NSNumber numberWithDouble:mapView.projection.visibleRegion.nearRight.latitude],
[NSNumber numberWithDouble:mapView.projection.visibleRegion.nearRight.longitude]);
从阅读标题中可以看出,当相机移动时,它似乎可能不会更新。这很公正...
/**
* The GMSProjection currently used by this GMSMapView. This is a snapshot of
* the current projection, and will not automatically update when the camera
* moves. The projection may be nil while the render is not running (if the map
* is not yet part of your UI, or is part of a hidden UIViewController, or you
* have called stopRendering).
*/
但是,每次调用委托方法时似乎都会更新它,因此我尝试绘制坐标以测试它们...
对于我的手机上的以下内容:
上述 NSLog 的输出给了我以下结果:
37.34209003645947,-122.0382353290915
37.34209003645947,-122.010769508779
37.30332095984257,-122.0382353290915
37.30332095984257,-122.010769508779
当我使用这个工具绘制这些坐标时,我得到了一个似乎不正确的投影: