查找最小/最大纬度和经度

编程入门 行业动态 更新时间:2024-10-15 20:23:05
本文介绍了查找最小/最大纬度和经度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的问题是如何从当前位置找到特定区域 (500米) 的最小和最大纬度和经度.

My Question is how can i find minimum and maximum latitude and longitude of specific area (500 meter) from current location.

就我而言,例如,我需要获取 X 和 Y CLLocation (纬度和经度)从 500 面积米看到我的图片(很抱歉,这张照片可能不好用)

In my case, Such like i need to get X and Y CLLocation (latitude and longitude) from 500meter of area See my image (sorry for this may be bad drawing )

我还必须尝试使用​​Google谷歌搜索功能,并且获得类似

I also have to tried to googling and i got link such like

我如何才能使用当前位置和半径获取最小和最大纬度和经度?

但是我不知道它如何实现.

But i don't know how it implement in my case.

请帮助我解决这个问题.

Pleas help me in this issue.

注意:我不想使用 CLLocationDistance distance = [currentLocation distanceFromLocation:newLocation]; ,因为它对我的情况没有帮助.

NOTE : I do not want to use CLLocationDistance distance = [currentLocation distanceFromLocation:newLocation]; because it is not helpful in my case so..

推荐答案

如果您不需要真正精确的值,请使用 1度为111公里.基于此,您需要在当前坐标上添加和删除0.0025度,以获取所需区域的角.

If you don't need a really precise value, then use the approximation that 1 degree is 111 km. Based on this, you need to add and remove 0.0025 degrees to the current coordinates to get corners of the area you are looking for.

rectanglesidelengthmeters = 500 degreedeltalat = 0.001 * (rectanglesidelengthmeters / 2.0) * cos(current.lon) degreedeltalon = 0.001 * (rectanglesidelengthmeters / 2.0) * cos(current.lat) minlat = current.lat - degreedeltalat maxlat = current.lat + degreedeltalat minlon = current.lon - degreedeltalon maxlon = current.lon + degreedeltalon

您可能需要稍微校正一下结果,以使纬度值保持在-90 .. 90范围内,经度值保持在-180 .. 180范围内,但我认为CLClocation也会为您处理.

You may need to correct the result a little for staying in the -90 .. 90 range for latitude and -180 .. 180 range for longitude values but I think CLClocation will handle that for you too.

更多推荐

查找最小/最大纬度和经度

本文发布于:2023-11-29 11:55:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1646330.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:经度   纬度   最小

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!