如何使用当前位置和半径获得最小和最大纬度和经度? [英] How can i get minimum and maximum latitude and longitude using current location and radius?

查看:154
本文介绍了如何使用当前位置和半径获得最小和最大纬度和经度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用当前位置的最小和最大纬度和经度。假设我已经给出了20km的区域所以使用该纬度和经度我希望最大纬度和经度以及最小纬度和经度也希望所有纬度和经度介于此之间我怎么能得到它。我怎么能在其中使用半径。请帮助我。谢谢你...

I want Minimum and Maximum Latitude and Longitude Using Current Location.Suppose i have give the area of 20km so using that latitude and Longitude i want Maximum latitude and Longitude and Minimum latitude and Longitude also want all latitude and Longitude in between this so how can i get it.How can i use of radius in it.Please help me.Thanks in Advance...

推荐答案

您可以手动计算它...我不知道是否存在任何其他方式
1°纬度= 69.047法定里程= 60海里
= 111.12公里

you can manually calculate it... I don't know if any other way exist 1° latitude = 69.047 statute miles = 60 nautical miles = 111.12 kilometers

因此对于20公里,它将是大约0.18纬度
对于经度,转换与纬度相同,除了该值乘以纬度的余弦。

so for 20 kilometers it would be around 0.18 latitude For longitude the conversion is the same as latitude except the value is multiplied by the cosine of the latitude.

在地图上设置相同的范围以供显示

To set the same range on map for display

newRegion.center=newLocation.coordinate;
    //  newRegion.span.latitudeDelta = (20*2)/111.12;   // For kilometers

    newRegion.span.latitudeDelta = (20*2)/60.0; // For Miles
    newRegion.span.longitudeDelta = ((20*2)/60.0) *(cos(newRegion.span.latitudeDelta)); // For Miles
    mapView.region = newRegion;

它将在显示的地图上设置20公里的范围......

It will set 20 kilometer's range on map that is displayed...

所以你可以找到它

你可以找到它

minLattitude = currentLattitude - (RadiusInKm/111.12);
maxLattitude = currentLattitude + (RadiusInKm/111.12);

对于经度相同但乘以纬度余弦的结果......

For longitude same but multiply the result with cosine of latitude...

这篇关于如何使用当前位置和半径获得最小和最大纬度和经度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆