问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/36948904/how-to-convert-gps-coordinates-into-google-map-coordinates