I'm writing an application that allows the user to sample points and perform georeferencing

In order to test it I have a large scanned map (16k x 13k) pixels covering the area 31 north to 34 north and 34 east to 36 east with a geographic grid

I sampled the 4 corners of the map + 2 points on the diagonal and applied an affine transformation :

[x']   [A B C]   [x]
[y'] = [D E F] * [y]
[1]    [0 0 1]   [1]

using the 6 points, and least squares I managed to find [A B C D E F], but applying it gave me an inaccurate transformation...

The Longitude is very accurate all along the picture (> 1 arc second), but the latitude deviates sometimes up to 15 arc seconds (~ 400-500 meters)

I assume that no matter how many points I will sample the affine transformation won't cut it...

What is the appropriate transformation here?

Trying to project the geographic coordinates

I projected the sampled points to UTM first, and then calculated the affine transform (again 6 points)

The results are pretty much the same - Accurate near the control points but, drops significantly when I get farther

Using 2nd Polynomial Transformation

I was able to get better results by using a 2nd order polynomial transform instead of an affine one, but I still get deviation of 4-5 arc seconds

The transformation I used -

[x']  =  [A B C D E F] * [x*x]
[y']     [G H I K L M]   [y*y]
                         [ x ]
                         [ y ]
                         [ 1 ]

Where A-M are the transformation parameters {x',y'} are the geographic coordinates and {x,y} are the screen pixel coordinates.

since there are 12 parameters it requires 6 points to be sampled...

I suppose I could try to do a 3rd order transform (20 parameters - 10 control points needed) or even higher but I wonder if there isn't a better way?

  • 2
    I think you need to be in a projected coordinate system for an affine transformation to make sense. Are you using any APIs relating to GIS or projections? These should have the ability to perform the reprojection for you.
    – blah238
    Mar 31, 2014 at 16:27
  • I'm not using any external API's, could you recommend some? By projected coordinates do you mean something like UTM grid? I have good UTM to Geographic and vice versa functions. I could transform the geographic coordinates to UTM and then calculate the affine transform...
    – DanyR
    Mar 31, 2014 at 17:26
  • 3
    I'm not sure the right question is being asked here. If you have a map with a known graticule (lat-long network), then your map is already georeferenced, by definition. I think your first question should be: What map projection do i have? And an affine transformation is not even relevant. Can you add an image of your map? And clarify what your intended inputs and outputs are?
    – Martin F
    Apr 3, 2014 at 1:21
  • 3
    I think your real question is "How do i convert between geographic coordinates and Mercator projected map (screen) coordinates?" Transformations are approximations, while map projections are pretty well exact.
    – Martin F
    Apr 3, 2014 at 21:37
  • 2
    In Mercator, longitudes and latitudes are orthogonal, but latitudes are not equally spaced. It is really much easier to convert the degrees to projected meters using standard tools like GDAL with the correct target projection, and then make an affine transformation to fit the extent of your map.
    – AndreJ
    Apr 5, 2014 at 6:46

1 Answer 1


The affine transformation makes no sense if you have lat/lon coordinates and a map in some kind of projection.

This is how a map of your region looks in UTM 36N projection:

enter image description here

and this is IsraeliTM:

enter image description here

You can easily see that the meridians are not parallel, and the latitudes are large circles. Affine projection only works when the grid is orthogonal.

Try to georeference your picture using QGIS, with as many points as you can gather. Take thin plate spline for interpolation.

  • I was able to achieve better results with 2nd order polynomial transform (see my latest edit), could you please refer me to a good source on how to perform thin plate spline transform?
    – DanyR
    Apr 3, 2014 at 18:35
  • 4
    I do georeferencing with QGIS, so I don't have to care about the mathematics behind it.
    – AndreJ
    Apr 3, 2014 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.