[gdal-dev] gdaltranslate and gdalwarp rotating and resizing image without being asked to, why?

Even Rouault even.rouault at mines-paris.org
Tue Jul 1 13:37:43 PDT 2014


Le mardi 01 juillet 2014 15:50:18, Jesse McGraw a écrit :
> On Mon, Jun 30, 2014 at 3:07 PM, Even Rouault
> <even.rouault at mines-paris.org>
> 
> wrote:
> > That might the problem. If you create the GCPs on the PDF and not on the
> > PNG,
> > and that the PDF has rotation, pdftoppm I think will apply the rotation,
> > hence
> > the axis swapping.
> 
> Remember, I'm using the PNG I've created for all gdal operations, gdal
> never interacts with the source PDF
> 
> I'm probably fundamentally misunderstanding some aspect of the command
> lines I'm using in gdal*.  My end goal is to get the necessary affine
> transformation information to display the PNG I create in step 3a properly
> in a separate Android moving-map application (eg. your current position
> displayed on the diagram as you move around the airport)

Jesse,

hum ok, with the images I think I now understand the situation (I've only 
looked at the landscape diagram) and what you want.

You probably don't want to use gdalwarp, which by default will result in a 
north-up image. You likely want to compute the geotransform affine matrix for 
your GCPs and set it, since indeed your GCPs define a 1st-order transformation.

The GDAL C API has GDALGCPsToGeoTransform() which does exactly this. I see it 
is also available in the Python API :  gdal.GCPsToGeoTransform().
See http://svn.osgeo.org/gdal/trunk/autotest/gcore/gcps2geotransform.py for 
how to use it.

You could then just do a CreateCopy() of the PNG to a VRT, and set the 
returned geotransform by the previous step with SetGeoTransform().

Even


-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list