# How to calculate position in a picture based on latitude/longitude

I have got a picture on which a user manually marks some points. Let's say for simplicity's sake these points always create a 4 point convex polygon. For each one of these points I know latitude and longitude.

Now the user enters latitude/ longitude for the 5th point and I have to show it on the same picture. What is the best way to calculate its screen position? I have tried the following algorithm:

``````1) to calculate a geometrical center of the polygon on screen

2) to find an average longitude for the leftmost and  the rightmost
points and an average latitude for the topmost and the lowest points

3) to place a point at the same relation to the geometrical center
as its' geocoordinates are to this average point.
``````

I have a test image, where I know exact geocoordinates for each point on the 10px grid, and I can say that this algorithm doesn't work.

What would be the better way?

• Do you know the lat/lon of the camera position? – James Milner Jan 22 '14 at 20:17
• @Loxodrome No. I probably can ask for it, how can it help? – Flot2011 Jan 22 '14 at 20:20
• Almost exactly the same question is asked at gis.stackexchange.com/questions/53217/…. The only difference is that the other question notes the importance of having elevation data at your four points, so the answer describes how to use that additional information effectively. Incidentally, I believe you meant to write "convex" instead of "concave"--although convexity makes little difference here. – whuber Jan 22 '14 at 21:19
• Just to clarify, your lat-long grid in your picture is a plane heading off to the horizon? In which case I think its impossible without knowing the field of view of the lens, and possibly other lens/view parameters too. – Spacedman Jan 22 '14 at 23:50
• Simply impossible without also knowing altitude at each point. – Martin F Nov 23 '14 at 20:41