Objective c 从横向/纵向增量获取/计算缩放级别

Objective c 从横向/纵向增量获取/计算缩放级别,objective-c,google-maps-sdk-ios,Objective C,Google Maps Sdk Ios,是否有任何方法可以从Google Maps SDK for iOS中获取从lat/long delta值计算的Google Maps缩放级别 或者通过目标C计算 谢谢也许这就是你要找的 从GMSCoordinateBounds.h: /** * Inits the northEast and southWest bounds corresponding * to the rectangular region defined by the two corners. * * It is a

是否有任何方法可以从Google Maps SDK for iOS中获取从lat/long delta值计算的Google Maps缩放级别

或者通过目标C计算


谢谢

也许这就是你要找的

从GMSCoordinateBounds.h:

 /**
 * Inits the northEast and southWest bounds corresponding
 * to the rectangular region defined by the two corners.
 *
 * It is ambiguous whether the longitude of the box
 * extends from |coord1| to |coord2| or vice-versa;
 * the box is constructed as the smaller of the two variants, eliminating the
 * ambiguity.
 */
 - (id)initWithCoordinate:(CLLocationCoordinate2D)coord1
          coordinate:(CLLocationCoordinate2D)coord2;
它可用于设置相机,使其适合具有适当缩放级别的边界

CLLocationCoordinate2D coord1 = CLLocationCoordinate2DMake(-45.43563456, -23.32543646);
CLLocationCoordinate2D coord2 = CLLocationCoordinate2DMake(-21.32145323, -12.32455435);
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:coord1 coordinate:coord2];

[mapView moveCamera: [GMSCameraUpdate fitBounds:bounds]];

也许这就是你要找的

从GMSCoordinateBounds.h:

 /**
 * Inits the northEast and southWest bounds corresponding
 * to the rectangular region defined by the two corners.
 *
 * It is ambiguous whether the longitude of the box
 * extends from |coord1| to |coord2| or vice-versa;
 * the box is constructed as the smaller of the two variants, eliminating the
 * ambiguity.
 */
 - (id)initWithCoordinate:(CLLocationCoordinate2D)coord1
          coordinate:(CLLocationCoordinate2D)coord2;
它可用于设置相机,使其适合具有适当缩放级别的边界

CLLocationCoordinate2D coord1 = CLLocationCoordinate2DMake(-45.43563456, -23.32543646);
CLLocationCoordinate2D coord2 = CLLocationCoordinate2DMake(-21.32145323, -12.32455435);
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:coord1 coordinate:coord2];

[mapView moveCamera: [GMSCameraUpdate fitBounds:bounds]];

如果有人在搜索swift,我也需要它来自动完成,您可以设置边界(例如,德国西南部靠近弗莱堡和斯图加特):


如果有人在搜索swift,我也需要它来自动完成,您可以设置边界(例如,德国西南部靠近弗莱堡和斯图加特):


我想你是想改变缩放比例,让两个点都适合地图?在这种情况下,可以使用+(GMSCameraUpdate*)fitBounds:(GMSCoordinateBounds*)边界;或+(gmsCamerauUpdate*)fitBounds:(GMSCoordinateBounds*)带填充的边界:(CGFloat)填充;是的,我正在尝试获得一个计算的缩放,以获取lat/long delta值,然后转换为缩放级别。我真的不明白你的建议,你能详细说明一下吗?我想你是想改变缩放,这样两个点都适合地图?在这种情况下,可以使用+(GMSCameraUpdate*)fitBounds:(GMSCoordinateBounds*)边界;或+(gmsCamerauUpdate*)fitBounds:(GMSCoordinateBounds*)带填充的边界:(CGFloat)填充;是的,我正在尝试获得一个计算的缩放,以获取lat/long delta值,然后转换为缩放级别。我真的不明白你的建议,你能详细说明一下吗?如果我有3-4个坐标,我怎么能找到东北和西南。我试过包括坐标和路径。但是如果我有3-4个坐标,结果就不同了,我怎么才能找到东北和西南。我试过包括坐标和路径。但结果不同