[Gdal-dev] Clip raster by percentage?

rasmus borgstrøm rb at gras.ku.dk
Tue Jan 20 05:05:54 EST 2009


Hi Pål

Im very interested to know if you succeded with the mentioned method and
with the creation of a python script.

regards
Rasmus Borgstrøm

Hi!

Thanks for helping! I will use the method you described them. Maybe I'll try
to  make a small python script that calculates the values for each raster
and runs the command in batch.

Regards,
Pål Kristensen


paalkr wrote:
> 
> Hi!
> 
> Thanks for helping! I will use the method you described them. Maybe I'll
> try to  make a small python script that calculates the values for each
> raster and runs the command in batch.
> 
> Regards,
> Pål Kristensen
> 
> 
> Frank Warmerdam-2 wrote:
>> 
>> Pål Kristensen wrote:
>>> Hi!
>>> 
>>> I it possible to clip a GeoTiff by a given percentage from each side (ie
>>> 5%
>>> from top, 2% from bottom, and so on) with GDAL, and if so, how is it
>>> done?
>> 
>> Pål,
>> 
>> This is not directly provided for - no.   You would basically need to
>> figure
>> out what pixel-line window it amounts to and use that with gdal_translate
>> and
>> the -srcwin switch.
>> 
>> For example for a 1000x1000 image you might use:
>> 
>>    gdal_translate -srcwin 50 50 930 930 in.tif out.tif
>> 
>> would be 5% off the top and left, and 2% off the right and bottom.
>> 
>> Best regards,
>> -- 
>> ---------------------------------------+--------------------------------------
>> I set the clouds in motion - turn up   | Frank Warmerdam,
>> warmerdam at pobox.com
>> light and sound - activate the windows | http://pobox.com/~warmerdam
>> and watch the world go round - Rush    | President OSGeo,
>> http://osgeo.org
>> 
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/Clip-raster-by-percentage--tp2033850p2185782.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.



More information about the gdal-dev mailing list