[Qgis-user] raster clipping

Fabrizio murè fabriziomure at gmail.com
Mon Sep 16 08:45:06 PDT 2013


Hi all, I need some clarifications on how raster clipper algorithm  works
with not georeferenced images.

My tiff data present negative y coordinates, so when I select my area of
interest in the viewer, the x-y upper left / lower right points are, for
instance:

ulx: 2818.33065257   uly: -5304.31204044
lrx:  3223.66153493   lry:-5825.45174632

Original image is 10000 x 6191 pixel

the Clipper plugin does not understand that data are not georeferenced, so
running command:

gdal_translate -projwin 2818.33065257 -5304.31204044 3223.66153493
-5825.45174632
C:\Dati_Utente\f.mure\work\UTILITY\DATA\Pleiades_Primary_Product_Bundle\Pleiades_Primary_Product_Bundle.tiff

you got an error (Computed -srcwin falls outside raster size of 10000x6191.
).

if you run gdal_traslate with -srcwin option you have to change input
parameters to express xoffset, yoffsset, xsize, ysize, instead of ulx uly
lrx lry.

In my example,

xoff = 2818
yoff = 6191 - 5304
xsize = 500
ysize = 500

And finally, gdal_translate -srcjwin 2818 794 500 500
C:\Dati_Utente\f.mure\work\UTILITY\DATA\Pleiades_Primary_Product_Bundle\Pleiades_Primary_Product_Bundle.tiff

works fine.

Now my doubts/questions are:
- is there a way to switch automatically between  [-projwin ulx uly lrx
lry] to  [-srcwin xoff yoff xsize ysize]  gdal_translate options, depending
on data projections (georefenced or not).

- is it possible to get extracted sub-image overlapped with the selected
area on the original image?

Could anyone give me some help?

Thanks in advance,
Fabrizio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130916/1b8d3e32/attachment.html>


More information about the Qgis-user mailing list