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?

  • $\begingroup$ Underspecified: What does the viewport cover? If you are staring at a planet from Alpha Centauri, then the latitudes/longitudes won't matter much. $\endgroup$ Commented Aug 18, 2014 at 10:11
  • $\begingroup$ 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? $\endgroup$ Commented Aug 18, 2014 at 11:11

1 Answer 1


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).

In fact, assuming the view is from straight above (i.e. angles are preserved), two points will suffice, but that is less trivial.

  • $\begingroup$ ok but I need more concrete solution $\endgroup$ Commented Aug 18, 2014 at 11:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .