从 MKCooperativeRegion MKMapView 获取 TopLeft 和 BottomRight
我检查了 MKCooperativeRegion
、MKCooperativeSpan
和 MKMapView
的文档中的属性,看看有没有一种方法可以获取 TopLeft和 BottomRight Lat Long 从地图视图来看,我没有找到任何东西。我知道跨度给了我纬度长增量,但有没有办法从地图视图中获取实际的 TopLeft 和 BottomRight 纬度经度,而不必进行奇怪的计算?
我发现 这个。
不确定这是否足够准确。有投票吗?
I checked the properties in documentation for MKCoordinateRegion
, MKCoordinateSpan
and MKMapView
to see there is a way to get the TopLeft and BottomRight Lat Long from the map view and I didn't find any. I know that the span gives me the Lat long delta but is there a way to get the actual TopLeft and BottomRight lat longs from map view without having to do weird calculations?
I found this.
Not sure if that is accurate enough. Any votes for that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不认为这些计算有什么奇怪的:
I don't think these calculations qualify as weird:
在 Swift 3.0 中实现的简单计算作为扩展:
用法:
Straightforward calculations implemented in Swift 3.0 as extension:
Usage:
你确定你的+-正确吗?我没有得到有用的结果。当我切换+-时,我做到了。不过,我的代码可能在其他地方存在缺陷;)
经度是以角度测量形式给出的,范围从本初子午线的 0° 到向东 +180° 和向西 -180°。希腊字母 λ (lambda),[3][4] 用于表示地球上本初子午线以东或以西的某个地点的位置。
从技术上讲,纬度是以度为单位的角度测量值(用 ° 标记),范围从赤道 0°(低纬度)到极地 90°(北极为 90° N 或 +90°,南纬 90° 或 −90 ° 为南极)。
(维基百科)
Are you sure you got the +- right? I did not get useful results with that. When I switched the +-, I did. Might be my code is flawed somewhere else, though ;)
Longitude is given as an angular measurement ranging from 0° at the Prime Meridian to +180° eastward and −180° westward. The Greek letter λ (lambda),[3][4] is used to denote the location of a place on Earth east or west of the Prime Meridian.
Technically, latitude is an angular measurement in degrees (marked with °) ranging from 0° at the equator (low latitude) to 90° at the poles (90° N or +90° for the North Pole and 90° S or −90° for the South Pole).
(Wikipedia)