在我的情况下,像我需要从500米的面积获得X和Y CLLocation(经度和纬度)
看我的形象(对不起,这可能是糟糕的图纸)
我也必须尝试谷歌搜索,我得到这样的链接
How can i get minimum and maximum latitude and longitude using current location and radius?
但我不知道它是如何实现的.
请帮助我解决这个问题.
解决方法 如果您不需要非常精确的值,则使用 1 degree is 111 km的近似值.基于此,您需要向当前坐标添加和移除0.0025度以获得您正在寻找的区域的角.NOTE : I do not want to use
CLLocationdistance distance = [currentLocation distanceFromLocation:newLocation];
because it is not helpful in my case so..
rectanglesIDelengthmeters = 500degreedeltalat = 0.001 * (rectanglesIDelengthmeters / 2.0) * cos(current.lon)degreedeltalon = 0.001 * (rectanglesIDelengthmeters / 2.0) * cos(current.lat)minlat = current.lat - degreedeltalatmaxlat = current.lat + degreedeltalatminlon = current.lon - degreedeltalonmaxlon = current.lon + degreedeltalon
您可能需要稍微校正结果以保持纬度的-90 … 90范围和经度值的-180 … 180范围,但我认为CLClocation也将为您处理.
总结以上是内存溢出为你收集整理的iphone – 查找最小/最大纬度和经度全部内容,希望文章能够帮你解决iphone – 查找最小/最大纬度和经度所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)