[gdal-dev] Cropping a raster by a polygon - only nodata outside polygon wanted

mathieu mathieu.rajerison at gmail.com
Wed Jan 14 02:58:02 PST 2015


The problem is that I don't know want an alpha channel because some of my
users work on MapInfo and MapInfo doesn't deal with alpha channels..

2015-01-14 11:39 GMT+01:00 Even Rouault-2 [via OSGeo.org] <
ml-node+s1560n5181432h49 at n6.nabble.com>:

> Mathieu,
>
> If 0 is a valid value at some locations of your raster, then you cannot
> use it
> as the nodata value. Use an alpha band instead for example by using
> -dstalpha
> instead of -dstnodata 0
>
> Even
>
> > Hello,
> >
> > I crop a 3 band raster by a polygon with the following formula :
> > /gdalwarp -of GTiff -cutline polygon.shp -cl polygon input.tif
> output.tif
> > /
> > But pixels outside my polygon are assigned the 0 value. I'd like them to
> > have nodata
> >
> > If I put the -dstnodata 0 option :
> > /gdalwarp -of GTiff -cutline polygon.shp -cl polygon input.tif
> output.tif
> > -dstnodata 0/, all the pixels in each of the 3 bands that contain the 0
> > value will be turned to nodata, even if they are contained in my
> polygon.
> >
> > Hence, 127 0 222 will become 127 nodata 222
> > or 0 127 222 will become nodata 127 222
> >
> > How to put the nodata value only outside my polygon ?
> >
> > Thanks a lot in advance !
> >
> > Mathieu
> >
> >
> >
> > --
> > View this message in context:
> >
>
> http://osgeo-org.1560.x6.nabble.com/Cropping-a-raster-by-a-polygon-only-nodata-outside-polygon-wanted-tp5181426.html
> > Sent from the GDAL - Dev mailing list archive at Nabble.com.
> > _______________________________________________
> > gdal-dev mailing list
> > [hidden email] <http:///user/SendEmail.jtp?type=node&node=5181432&i=0>
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >
>
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
> _______________________________________________
> gdal-dev mailing list
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=5181432&i=1>
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://osgeo-org.1560.x6.nabble.com/Cropping-a-raster-by-a-polygon-only-nodata-outside-polygon-wanted-tp5181426p5181432.html
>  To unsubscribe from Cropping a raster by a polygon - only nodata outside
> polygon wanted, click here
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5181426&code=bWF0aGlldS5yYWplcmlzb25AZ21haWwuY29tfDUxODE0MjZ8NTczODc4NDU1>
> .
> NAML
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Cropping-a-raster-by-a-polygon-only-nodata-outside-polygon-wanted-tp5181426p5181437.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150114/c3d9abf3/attachment.html>


More information about the gdal-dev mailing list