<div dir="ltr">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..</div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-14 11:39 GMT+01:00 Even Rouault-2 [via OSGeo.org] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=5181437&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>></span>:<br><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">

        Mathieu,
<br><br>If 0 is a valid value at some locations of your raster, then you cannot use it
<br>as the nodata value. Use an alpha band instead for example by using -dstalpha
<br>instead of -dstnodata 0
<br><br>Even
<br></span><div><div class="h5"><div><div class='shrinkable-quote'><br>> Hello,
<br>>
<br>> I crop a 3 band raster by a polygon with the following formula :
<br>> /gdalwarp -of GTiff -cutline polygon.shp -cl polygon input.tif output.tif
<br>> /
<br>> But pixels outside my polygon are assigned the 0 value. I'd like them to
<br>> have nodata
<br>>
<br>> If I put the -dstnodata 0 option :
<br>> /gdalwarp -of GTiff -cutline polygon.shp -cl polygon input.tif output.tif
<br>> -dstnodata 0/, all the pixels in each of the 3 bands that contain the 0
<br>> value will be turned to nodata, even if they are contained in my polygon.
<br>>
<br>> Hence, 127 0 222 will become 127 nodata 222
<br>> or 0 127 222 will become nodata 127 222
<br>>
<br>> How to put the nodata value only outside my polygon ?
<br>>
<br>> Thanks a lot in advance !
<br>>
<br>> Mathieu
<br>>
<br>>
<br>>
<br>> --
<br>> View this message in context:
<br>>
</div><a href="http://osgeo-org.1560.x6.nabble.com/Cropping-a-raster-by-a-polygon-only-nodata-outside-polygon-wanted-tp5181426.html" rel="nofollow" link="external" target="_blank">http://osgeo-org.1560.x6.nabble.com/Cropping-a-raster-by-a-polygon-only-nodata-outside-polygon-wanted-tp5181426.html</a><br>> Sent from the GDAL - Dev mailing list archive at Nabble.com.
<br>> _______________________________________________
<br>> gdal-dev mailing list
</div></div></div>> <a href="http:///user/SendEmail.jtp?type=node&node=5181432&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><span class="">> <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="nofollow" link="external" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>>
<br><br><br>-- 
<br>Spatialys - Geospatial professional services
<br><a href="http://www.spatialys.com" rel="nofollow" link="external" target="_blank">http://www.spatialys.com</a><br></span>_______________________________________________
<br>gdal-dev mailing list
<br><a href="http:///user/SendEmail.jtp?type=node&node=5181432&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="nofollow" link="external" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>

        
        
        
        <br>
        <br>
        <hr noshade size="1" color="#cccccc">
        <div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://osgeo-org.1560.x6.nabble.com/Cropping-a-raster-by-a-polygon-only-nodata-outside-polygon-wanted-tp5181426p5181432.html" target="_blank" rel="nofollow" link="external">http://osgeo-org.1560.x6.nabble.com/Cropping-a-raster-by-a-polygon-only-nodata-outside-polygon-wanted-tp5181426p5181432.html</a>
        </div>
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from Cropping a raster by a polygon - only nodata outside polygon wanted, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>
                <a href="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" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
        </div></blockquote></div><br></div>


        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/Cropping-a-raster-by-a-polygon-only-nodata-outside-polygon-wanted-tp5181426p5181437.html">Re: Cropping a raster by a polygon - only nodata outside polygon wanted</a><br/>
Sent from the <a href="http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html">GDAL - Dev mailing list archive</a> at Nabble.com.<br/>