<div>Hello Jorge (portuguese?)</div><div>The problem is not the KML. GDALwarp supports the usage of KML to cut Raster file. The thing is that it generates a Geotiff file with two bands: 1 with the masked values and another with just value of 1 in the valid pixels (a bitmask). Is it possible to generate a geotiff with onluy the first band?</div>
<div>Thanks</div><div>Luis<br><br></div><div class="gmail_quote">On Tue, Sep 11, 2012 at 8:25 PM, Jorge Santos <span dir="ltr"><<a href="mailto:jorgepsantos2002@gmail.com" target="_blank">jorgepsantos2002@gmail.com</a>></span> wrote:<br>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">Hey, you can convert the KML to shapefile with <b>ogr2ogr</b> and use this shape to cut the raster data.<br>
<br>STEP01: Convert a single KML to Shapefile:<br><br><b>ogr2ogr -f "ESRI Shapefile" output_shapefile.shp input_kml_file.kml</b><br>
<br>STEP02: Crop the raster with polygon shapefile with gdalwarp. This command will crop the raster by extent of shapefile:<br><br><b>gdalwarp -crop_to_cutline -cutline output_shapefile.shp input_raster.tif clipped_raster.tif</b><br>

<br>PS: -crop_to_cutline   =>  <a href="http://www.gisinternals.com/sdk/" target="_blank"><span style="font:12px/normal "Lucida Grande",Verdana,Geneva,Arial,sans-serif;text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;float:none;display:inline!important;white-space:normal;font-size-adjust:none;font-stretch:normal">GDAL >= 1.8.0</span></a> required<br>

<br>cheers<span class="HOEnZb"><font color="#888888"><br><br>Jorge Santos</font></span><div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">2012/9/11 Luis Lisboa <span dir="ltr"><<a href="mailto:luislisboa1975@gmail.com" target="_blank">luislisboa1975@gmail.com</a>></span><br>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
<div>Hi Eli</div><div>Probably I was not clear: When I use this it outputs a geotiff with two bands: 1 with the real data and another one with the mask of the pixels that fall inside each polygon. I just want to have an output file with one band (band 1) and without the mask. Is it possible?</div>


<div>Thanks</div><div>Luis</div><div><br><br> </div><div class="gmail_quote">On Thu, Sep 6, 2012 at 4:50 AM, Eli Adam <span dir="ltr"><<a href="mailto:eadam@co.lincoln.or.us" target="_blank">eadam@co.lincoln.or.us</a>></span> wrote:<br>


<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">Luis,<br>
<div><br>
On Wed, Sep 5, 2012 at 3:00 AM, Luis Lisboa <<a href="mailto:luislisboa1975@gmail.com" target="_blank">luislisboa1975@gmail.com</a>> wrote:<br>
> Thank you Chitanya.<br>
> But it created an output file with two layers (one with the values from<br>
> original file and another with a 255 for the pixels thar are inside KMZ<br>
> file: How can I have produce one layer?<br>
<br>
</div>I may be thinking of something else based on your description.  If you<br>
got an output that has the original values in the area of the kmz and<br>
an alpha mask band over the other areas I think that would be<br>
expected.  You can also use -crop_to_cutline to remove that 'extra'<br>
data.<br>
<br>
If that isn't what you are talking about, you may want to use ogr2ogr<br>
to convert your kmz to a shapefile in the same projection as your<br>
input raster and see if it gives you a better result.<br>
<br>
Bests, Eli<br>
<div><div><br>
<br>
> Thanks<br>
> Luis<br>
> On Mon, Sep 3, 2012 at 5:10 PM, Chaitanya kumar CH <<a href="mailto:chaitanya.ch@gmail.com" target="_blank">chaitanya.ch@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Luis,<br>
>><br>
>> gdalwarp has some options for this exact purpose.<br>
>> The cutline can be from any of the OGR readable datasource.<br>
>><br>
>> <a href="http://www.gdal.org/gdalwarp.html" target="_blank">http://www.gdal.org/gdalwarp.html</a><br>
>><br>
>> On Mon, Sep 3, 2012 at 9:34 PM, Luis Lisboa <<a href="mailto:luislisboa1975@gmail.com" target="_blank">luislisboa1975@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> Greetings<br>
>>> I have a raster file (Geotiff) and I have a KML file with a polygon and I<br>
>>> want to cut raster map to only have valid values inside the polygon. How can<br>
>>> I do this using just GDAL?<br>
>>><br>
>>> Usually I used to cut geotiff file with gdalwarp and but in those cases I<br>
>>> was cutting a square (xmin xmax ymin ymax) and in this case is a more<br>
>>> complex polygon<br>
>>><br>
>>> Thanks<br>
>>> Regards,<br>
>>> Luis<br>
>>><br>
>>> _______________________________________________<br>
>>> gdal-dev mailing list<br>
>>> <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
>>> <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Best regards,<br>
>> Chaitanya kumar CH.<br>
>><br>
>> <a href="tel:%2B91-9494447584" target="_blank" value="+919494447584">+91-9494447584</a><br>
>> 17.2416N 80.1426E<br>
><br>
><br>
><br>
> _______________________________________________<br>
> gdal-dev mailing list<br>
> <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></div></blockquote></div><br>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br>
</div></div></blockquote></div><br>