Search code examples
google-maps-api-2

How can I got a point's GPS position when select it on the static map


Firstly,I use google static map API to get the image to display on html/wml. And then, I want to get the point's GPS position where user pressed on the image.

Is there some way to get the GPS position if I got the co-ordinates on the image?


Solution

  • The short answer is probably not. You can't be sure exactly what the static map's dimensions are (the server might change the location slightly to fit things better, etc.). If you're just asking for a map by center and zoom then you stand a slightly better chance, but it will still be tricky.

    If you're trying to add dynamic behaviour to a static map, have you considered instead the Maps JavaScript API? Finding the coordinates of where a user clicks is trivial there. (Also, you can disable the zooming, panning, controls, etc. if you want so that it still feels like it's static).