I am trying to adjust a vector polygon dataset using ogr2ogr spline transformation with cmd commands like:
C:\\OSGeo4W64\\bin\\ogr2ogr.exe -f "ESRI Shapefile" C:\\path\\output.shp -order 3 -tps -gcp -13163.1627 271026.6107 -13274.2879 271201.236 -gcp 64464.2679538 -210398.439419 64390.5172491 -210240.678326 -gcp 98432.5310433 -181184.99898 98313.298804 -180985.232826 C:\\path\\input.shp
Also I try to do this inside Python:
import os control_points = ( "-gcp -13163.1627 271026.6107 -13274.2879 271201.236 " "-gcp -12706.1672 271461.5611 -12843.4862 271599.4093 " "-gcp 98432.5310433 -181184.99898 98313.298804 -180985.232826 " "-gcp 64464.2679538 -210398.439419 64390.5172491 -210240.678326 " ) command = 'C:\\OSGeo4W64\\bin\\ogr2ogr.exe -f "ESRI Shapefile" C:\\path\\output.shp -order 3 -tps ' + control_points + 'C:\\path\\input.shp' print command os.system(command)
With a few points like this it works fine. But actually I have much more control points, more than 1000. I need to use them all because the dataset covers the entire country. And when I write into the command all my GCPs, the Python script doesn't produce any output at all (no errors), and when I paste this command into the Command prompt it just cuts my command and then gives an error from ogr2ogr.
I found out that the maximum number of characters in the command prompt is 8191 but my command has 79792 characters.
So, how can I use ogr2ogr with hundreds of control points? Is there a way to store them in some batch file or variable? The GDAL page only says that -gcp option may be provided multiple times to provide a set of GCPs, directly in the command.