-1

enter image description here 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...

webdev002
  • 13
  • 6
  • I don't understand what the problem is. Please describe it more clearly. – deceze Jan 06 '14 at 08:18
  • You'd start by getting the coordinates of all four corners of that map, i.e. where exactly the map you have fits in in the global coordinate system. Then you simply calculate the position as an offset to those corners. This may be somewhat complicated if the projection system used is different. So, first of all, figure out what boundary coordinates your map has and what projection it's in. – deceze Jan 06 '14 at 10:04
  • the map is Equirectangular projection you have idea with the math formula with it sir?? – webdev002 Jan 06 '14 at 23:48

1 Answers1

0

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.

Micromega
  • 12,486
  • 7
  • 35
  • 72