# Latitude and longitude to screen coordinates using "mapping points"?

I wrote a simple application which has a static image.

I have 2 types coordinates for a point (or points if it is necessary):

• latitude and longitude;
• x and y for a screen.

So I can get some constant points with already converted coordinates.

Note that visible screen coords are always positive and (0, 0) is in the top left corner.

How many constant points I need? And how to convert using these points?

• Underspecified: What does the viewport cover? If you are staring at a planet from Alpha Centauri, then the latitudes/longitudes won't matter much. Commented Aug 18, 2014 at 10:11
• you look at a plain map rect. If you have 2 points then you even know the distance between them and their representation on a screen. But how to use these values? Commented Aug 18, 2014 at 11:11

If the image is small enough to qualify as mostly undistorted, then one may assume for simplicity that the transform is (affine) linear, i.e. $$(\lambda,\phi)\mapsto(x_0+a\lambda+b\phi,x_0+c\lambda+d\phi)$$ (or similarly the other way round). In that case three sample points suffice to solve for the unknowns $x_0,y_0,a,b,c,d$. This does of course not work if the transform is non-linear (i.e. if the curvature of the planet surface is noticeable).