Calculate map point in coordinates

203 Views Asked by At

I am creating a map application and I need help in calculation.

map

I am having an image of map which is say 125px in height and 250px in width, I know coordinates of all the corners, now I want to find an offset for a point 80.25,12.5. How can I do that ? Can anyone suggest a formula for that ?

Please help.

1

There are 1 best solutions below

6
On BEST ANSWER

You need simple proportions. Your full height in pixels is $125px$; the height in your coordinate system is $80$, hence $12.5/80=X/125px$. More generally, if $x$ and $y$ are the coordinates in the original coordinate system and $X$ and $Y$ are the coordinates in the pixel space then $X=250px\times x/100$ and $Y=125px\times y/80$.