[gdal-dev] gdalwarp - Clip raster using mask

Peter Halls p.halls at york.ac.uk
Thu Nov 22 06:15:30 PST 2012


Alisson,

    the advice I give my students in such a circumstance is to buffer the
boundary by either one half of the pixel size or by the pixel size.  This
has the effect of increasing the mask to include all cells along the
boundary and gain a closer equivalent of a vector clip.

    For another discussion of the issues, see Burrough, P.A., and
McDonnell, Rachael A., 1998, Principles of Geographic Information Systems,
Oxford: OUP.

Best wishes,

Peter

On 22 November 2012 14:02, Joaquim Luis <jluis at ualg.pt> wrote:

>  Alisson,
>
> It's not so easy to follow what is "desired" and "not-desired". For an
> excellent discussion of the details involved in such operations see
>
> http://blogs.mathworks.com/steve/2006/12/22/poly2mask-and-roipoly-part-3/
>
> As a solution for your 'wish-behavior'  case maybe what you can do is to
> previously expand your polygon with a buffer of half cell width.
>
> Joaquim
>
>  Hi friends,
>
> By using gdalwarp to clip a raster with a mask (shape), I get a new raster
> of smaller size, which is the boundary of the polygon shape (mask).
> However, the pixels do not pass the polygon. I would like to pass the
> pixels just a little of the polygon mask.
>
> For clarity, I send two pictures of what I desire and not desire:
> http://postimage.org/image/hlrc3911z/
> http://postimage.org/image/4vn3q5t3r/
>
>  The used command is: gdalwarp -dstnodata 0 -q -cutline
> C:/Users/Hugo/Final.shp -crop_to_cutline -of GTiff
> C:/Users/Hugo/Elevation-DEM-CLIPPED.img
> C:/Users/Hugo/Elevation-DEM-CLIPPED.img
>
> Can you help me?
>
> Best Regards,
>  --
> Alisson Barbosa
> Systems Analyst - FUNCEME
> M.Sc. in Computer Science - MACC
> Graduate in Computer Science  - UECE
>
>
>
>
> _______________________________________________
> gdal-dev mailing listgdal-dev at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
----------------------------------------------------------------------------------------------------------------
Peter J Halls, GIS Advisor & Team Leader Applications Support and Training,
               Information Directorate, University of York
Telephone: 01904 323806     Fax: 01904 323740
Snail mail: Harry Fairhurst Building, University of York,
                Heslington, York YO10 5DD
This message has the status of a private and personal communication
----------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121122/1058c0c4/attachment.html>


More information about the gdal-dev mailing list