How do I convert these coordinates to coordinates readable by Google Maps?

空扰寡人 提交于 2019-12-04 09:25:22

问题


Take a look at the map coordinates on this page. This is linked in from Wikipedia and the coordinates are passed the query string. I'm not sure of the actual terms for this but How do I convert the coordinates? They look like this:

37° 14′ 6″ N, 115° 48′ 40″ W

I would like them to look like this:

37.235, -115.811111

, which is a format readable by Google maps, as seen in this example.

How do I do this in PHP, and what are the two different types of coordinates called?


回答1:


The original format is in hours, minutes, seconds format. To convert to decimal, do:

D = H + M/60 + s/3600

So in your example, 37,14,6 becomes

37 + 14/60 + 6/3600 = 37.235, as stated.

If the latitude is N the result is positive, if S, negative. If the longitude is E the result is positive. If west the result is negative.




回答2:


Here is the Javascript function that does what you are talking about.

This utility permits the user to convert latitude and longitude between decimal degrees and degrees, minutes, and seconds. For convenience, a link is included to the National Geodetic Survey's NADCON program, which allows conversions between the NAD83 / WGS84 coordinate system and the older NAD27 coordinate system. NAD27 coordinates are presently used for broadcast authorizations and applications.

This utility requires that Javascript be enabled to perform the calculations.




回答3:


Umm the page you mention already gives you the coordinates in WGS84 and in Latitude Longitude format



来源:https://stackoverflow.com/questions/995738/how-do-i-convert-these-coordinates-to-coordinates-readable-by-google-maps

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