Convert long and lat to Coordinates on country only [closed]

假装没事ソ 提交于 2019-12-13 09:34:21

问题


the map of japan with pointer on it...

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

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