how to convert gps north and gps west to lat/long in objective c

北战南征 提交于 2020-01-22 02:56:29

问题


I got these values from server:

<gps_n>34.22.123</gps_n>
<gps_w>81.59.345</gps_w>

I would like to convert these values to latitude/longitude in Objective C. Would you please give me a guide to do this?

Thanks


回答1:


The formula for both lat/long (n/w) is:

Degrees+(minutes/60)+(seconds/3600)

From this page:

http://webmaster10.com/ldr/lat-long-conversion.html




回答2:


The example you have given, already are latitude/longitude coordinates. There are many such lat,lon formats, what you want are lat/long coordinates in decimal degrees, probably with a sign to denote N/S or E/W.

Use the formula above: (Degrees+(minutes/60)+(seconds/3600)) and multiply latitude with -1 when S is given. Multiply longitude by -1 when "W" is given.



来源:https://stackoverflow.com/questions/15962939/how-to-convert-gps-north-and-gps-west-to-lat-long-in-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!