问题

The problem is what will be the formula to to convert the lat ang long to get the right coordinates with the map of japan only..
i use php gd with both image the map and the pointer..
i already manage to plot the right coordinate in whole world using with this code --->
function getlocationcoords($lat, $lon, $width, $height)
{
$x = (($lon + 180) * ($width / 360));
$y = ((($lat * -1) + 90) * ($height / 180));
return array("x"=>round($x),"y"=>round($y));
}
Any Help is appreciated..
thanks...
回答1:
It's not so simple. You need to compute the map bounds and the delta of both axis, I.e. a factor. It's not very accurate but you can use the code and a bit of trial and error. For example if you use the same factor for both axis it looks weird and simply doesn't fit the map.
来源:https://stackoverflow.com/questions/20941929/convert-long-and-lat-to-coordinates-on-country-only