如何将GPS坐标转换为Google地图坐标 [英] How to convert GPS coordinates into Google map Coordinates
本文介绍了如何将GPS坐标转换为Google地图坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将GPS坐标转换为Google地图坐标,以便在我的网站的Google地图中使用它们。
lat:4113.53948N(ddmm.mmmm)
long:00131.89855E(dddmm.mmmm)
如果有任何公式存在,请需要它,所以我可以在PHP中使用。
解决方案
只是为了显示一个经常遗忘的PHP函数的灵活性,它实际上是非常强大的用于解析字符串:
$ value ='4113.52318N';
sscanf($ value,'%2d%f%s',$ degrees,$ minutes,$ hemisphere);
var_dump($ degrees,$ minutes,$ hemisphere);
和
$ value ='00131.89855E';
sscanf($ value,'%3d%f%s',$ degrees,$ minutes,$ hemisphere);
var_dump($ degrees,$ minutes,$ hemisphere);
I want to convert GPS coordinates into Google map coordinates so I can use them in Google map in my website.
GPS coordinates are lat : 4113.53948N (ddmm.mmmm) long : 00131.89855E (dddmm.mmmm)
If there is any formula exist then please I need it so I can use in php.
解决方案
Just to show the flexibility of an oft-forgotten PHP function that's actually extremely powerful for parsing strings:
$value = '4113.52318N';
sscanf($value, '%2d%f%s', $degrees, $minutes, $hemisphere);
var_dump($degrees, $minutes, $hemisphere);
and
$value = '00131.89855E';
sscanf($value, '%3d%f%s', $degrees, $minutes, $hemisphere);
var_dump($degrees, $minutes, $hemisphere);
PHP Docs for the sscanf() function
这篇关于如何将GPS坐标转换为Google地图坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文