I am trying to adjust a shapefile using ogr2ogr spline transformation with cmd commands like:

C:\OSGeo4W64\bin\ogr2ogr.exe -f "ESRI Shapefile" C:\path\output.shp -tps --optfile C:\path\gcp.txt C:\path\input.shp

I have more than 1000 control points (so they are in a separate file). And I have strange problems with precision of this method. I already saw in this question that ogr2org spline method is not really exact. But with my number of GCP and the extent of my dataset I see that the precision dramatically decreases from north to south. Like this: spline error

In the north the method is almost exact (0.001 m error), then it smoothly loses the precision and in the south it creates an error about 60 m.

I calculated RMSE for every GCP and plotted it versus coordinates and the ID number of control point (I was creating the GCP starting mostly from north). And I have:

y error x error id error

I tried to find and read the source code of gdal (I found gdal_tps, thinplatespline and ogr2ogr_lib modules) but I don't know that language (C++?) and don't understand how the method works. Polynomials 1, 2 and 3 order of ogr2ogr are working fine (they are not exact methods but the error is not progressing).

So, why spline precision logarithmically decreases depending on the Y coordinate? (For X coordinate I see jumps in precision every 16000 m). How is this possible? How this adjustment method works? How can I solve this problem? (I have Windows 7, 64 bit)

  • 2
    GDAL developer has done a preliminary analysis in lists.osgeo.org/pipermail/gdal-dev/2017-June/046816.html. Perhaps you should join that discussion.
    – user30184
    Commented Jun 27, 2017 at 14:13
  • Are you able to share the GCPs? Will review results, check coefficients, etc. Thinking this can be explained, and the instability minimized. Thanks!
    – david
    Commented Jun 29, 2017 at 19:11

1 Answer 1


The answer of the GDAL developer Even Rouault really helped me giving the correct direction.

Knowing that this is numerical instability case, and knowing (from my CFD experience) that instability can be caused by very small values in data, I analyzed my control points. I constructed TIN, calculated distances between GCP and found that 2 points by mistake were placed extremely close to each other (almost coinciding, 3 m distance between them). When I removed one of them, spline worked perfectly.

This pair of points was on the very north so the instability started from north to south.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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