[gdal-dev] Can't combine crop_to_cutline & -t_srs ?

Even Rouault even.rouault at mines-paris.org
Thu Aug 15 06:33:47 PDT 2013


Le jeudi 15 août 2013 15:25:47, Reaves, Timothy a écrit :
> I'm converting some GeoPDF files to TIFF.  I want to crop, and I need to
> re-project.  I can do one or the other, but, when I combine them, all I get
> is a black output.
> 
> The base command is:
> gdalwarp -multi -co "TILED=YES" infile.pdf outfile.tiff --config
> GDAL_PDF_LAYERS_OFF "Map_Collar","Map_Frame.Projection_and_Grids"
> 
> Then, I use either:
> -crop_to_cutline -cutline cutline.csv -overwrite
> or
> -t_srs EPSG:3785
> 
> Either of these works.  Just not both.  Are the two options mutually
> exclusive?

Thimothy,

According to the gdalwarp manual : "If the OGR layer containing the       
cutline features has no explicit SRS, the cutline features must be in the 
georeferenced units of the destination file.".

CSV have no explicit SRS, so to use -t_srs EPSG:3785, the CSV must be itself 
in EPSG:3785

So you could do a preprocessing step :

ogr2ogr -s_srs EPSG:XXXX -t_srs EPSG:3785 cutline_3785.csv cutline.csv

where XXXX is the EPSG code of the GeoPDF

And then use cutline_3785.csv as the value of the -cutline parameter of 
gdalwarp.

> 
> As an aside, when cropping, how do I make the area outside of the image
> transparent instead of black?

Try adding -dstalpha to your gdalwarp command line.

Even

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


More information about the gdal-dev mailing list