When using android google maps app share button for a location, it just return a url as intent to other applications like this one:
https: // goo. gl / maps/tkNXzF2krmR2
this is a google short url which is translatable to long url (using goole short url api) to something like this:
http://maps.google.com/?q=Tehran+Province,+Tehran,+Banafsheh+3&ftid=0x3f8dfd04d309f925:0x2867166b05b0bfe6&hl=en&gl=us&shorturl=1
As is clear this url have no pure latitude and longitude values. but it seems that values is behind of ftid parameter in url. which is separated with ":" character.
please help me to extract latitude and longitude values from this hex like format
I'm using PHP language but what others can be help too. i need a function like this one: (this is not work):
function hextolatlon($hex){
// Assume hex is a value like 0x1446041F or 0x447D1100
// Convert to a signed integer
$h=$hex&0xFF;
$h=($h>8)&0xFF);
$h=($h>16)&0xFF);
$h=($h>24)&0xFF);
$negative=($h>>31)!=0; // Get the sign
if($negative){
$h=~$h;
$h=$h&0x7FFFFFFF;
$h++;
}
// Convert to degrees and minutes
$degrees=floor($h/10000000);
$minutes=$h%10000000;
// Convert to full degrees
$degrees+=($minutes/100000.0) / 60.0;
if($negative)$degrees=-$degrees;
return $degrees;
}
to convert 0x3f8dfd04d309f925 to something like 35.74388. many thanks