Convert long/lat to pixel x/y on a given picure.
Posted
by Kalinin
on Stack Overflow
See other posts from Stack Overflow
or by Kalinin
Published on 2010-04-16T06:39:31Z
Indexed on
2010/04/21
23:23 UTC
Read the original article
Hit count: 248
I have a city "map" (for example - Moscow). She in accuracy repeats the contours the given city in google maps (that is it is copied from google maps and it is a little processed, but the sense remained the same).
Also I have object co-ordinates in a city (in co-ordinates of google).
Problem: how to convert google co-ordinates to the co-ordinates of my picture (that is in pixels on OX and OY on a picture). That is I receive google-co-ordinates and it is necessary for me to draw this point on my picture.
The most desired variant of the answer - is based on javascript, but it is possible and on php.
I know that on small scales (for example on city scales) it to make simply enough (it is necessary to learn what google-co-ordinates has one of picture corners, then to learn "price" of one pixel in google-co-ordinates on a picture on axes OX and OY separately).
But on the big scales (country scale) "price" of one pixel will be not a constant, and will vary strongly enough and the method described above cannot be applied.
How to solve a problem on country scales?
© Stack Overflow or respective owner