Re: [gdal-dev] How to cut a Raster map with a KML file

2012-09-12 Thread Luis Lisboa
Hello Jorge (portuguese?)
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?
Thanks
Luis

On Tue, Sep 11, 2012 at 8:25 PM, Jorge Santos jorgepsantos2...@gmail.comwrote:

 Hey, you can convert the KML to shapefile with *ogr2ogr* and use this
 shape to cut the raster data.

 STEP01: Convert a single KML to Shapefile:

 *ogr2ogr -f ESRI Shapefile output_shapefile.shp input_kml_file.kml*

 STEP02: Crop the raster with polygon shapefile with gdalwarp. This command
 will crop the raster by extent of shapefile:

 *gdalwarp -crop_to_cutline -cutline output_shapefile.shp input_raster.tif
 clipped_raster.tif*

 PS: -crop_to_cutline   =  GDAL = 
 1.8.0http://www.gisinternals.com/sdk/required

 cheers

 Jorge Santos


 2012/9/11 Luis Lisboa luislisboa1...@gmail.com

 Hi Eli
 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?
 Thanks
 Luis



 On Thu, Sep 6, 2012 at 4:50 AM, Eli Adam ea...@co.lincoln.or.us wrote:

 Luis,

 On Wed, Sep 5, 2012 at 3:00 AM, Luis Lisboa luislisboa1...@gmail.com
 wrote:
  Thank you Chitanya.
  But it created an output file with two layers (one with the values from
  original file and another with a 255 for the pixels thar are inside KMZ
  file: How can I have produce one layer?

 I may be thinking of something else based on your description.  If you
 got an output that has the original values in the area of the kmz and
 an alpha mask band over the other areas I think that would be
 expected.  You can also use -crop_to_cutline to remove that 'extra'
 data.

 If that isn't what you are talking about, you may want to use ogr2ogr
 to convert your kmz to a shapefile in the same projection as your
 input raster and see if it gives you a better result.

 Bests, Eli


  Thanks
  Luis
  On Mon, Sep 3, 2012 at 5:10 PM, Chaitanya kumar CH 
 chaitanya...@gmail.com
  wrote:
 
  Luis,
 
  gdalwarp has some options for this exact purpose.
  The cutline can be from any of the OGR readable datasource.
 
  http://www.gdal.org/gdalwarp.html
 
  On Mon, Sep 3, 2012 at 9:34 PM, Luis Lisboa luislisboa1...@gmail.com
 
  wrote:
 
  Greetings
  I have a raster file (Geotiff) and I have a KML file with a polygon
 and I
  want to cut raster map to only have valid values inside the polygon.
 How can
  I do this using just GDAL?
 
  Usually I used to cut geotiff file with gdalwarp and but in those
 cases I
  was cutting a square (xmin xmax ymin ymax) and in this case is a more
  complex polygon
 
  Thanks
  Regards,
  Luis
 
  ___
  gdal-dev mailing list
  gdal-dev@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/gdal-dev
 
 
 
 
  --
  Best regards,
  Chaitanya kumar CH.
 
  +91-9494447584
  17.2416N 80.1426E
 
 
 
  ___
  gdal-dev mailing list
  gdal-dev@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/gdal-dev



 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev



___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] How to cut a Raster map with a KML file

2012-09-11 Thread Eli Adam
Luis,
On Tue, Sep 11, 2012 at 11:14 AM, Luis Lisboa luislisboa1...@gmail.com wrote:
 Hi Eli
 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?

Sometime images can clean up just be running them through
gdal_translate.  -ot or -b or -mask or some combination may
additionally be needed.  http://gdal.org/gdal_translate.html  Does
gdal_translate on your file collapse the mask band into a single band
with no data values?

rgb2pct.py can be used to convert RGB/RGBA to single band with a color
table.  I'm not sure if it would work with a two band image, one being
the mask but you can try it and see what it does.

HTH, Eli


 Thanks
 Luis



 On Thu, Sep 6, 2012 at 4:50 AM, Eli Adam ea...@co.lincoln.or.us wrote:

 Luis,

 On Wed, Sep 5, 2012 at 3:00 AM, Luis Lisboa luislisboa1...@gmail.com
 wrote:
  Thank you Chitanya.
  But it created an output file with two layers (one with the values from
  original file and another with a 255 for the pixels thar are inside KMZ
  file: How can I have produce one layer?

 I may be thinking of something else based on your description.  If you
 got an output that has the original values in the area of the kmz and
 an alpha mask band over the other areas I think that would be
 expected.  You can also use -crop_to_cutline to remove that 'extra'
 data.

 If that isn't what you are talking about, you may want to use ogr2ogr
 to convert your kmz to a shapefile in the same projection as your
 input raster and see if it gives you a better result.

 Bests, Eli


  Thanks
  Luis
  On Mon, Sep 3, 2012 at 5:10 PM, Chaitanya kumar CH
  chaitanya...@gmail.com
  wrote:
 
  Luis,
 
  gdalwarp has some options for this exact purpose.
  The cutline can be from any of the OGR readable datasource.
 
  http://www.gdal.org/gdalwarp.html
 
  On Mon, Sep 3, 2012 at 9:34 PM, Luis Lisboa luislisboa1...@gmail.com
  wrote:
 
  Greetings
  I have a raster file (Geotiff) and I have a KML file with a polygon
  and I
  want to cut raster map to only have valid values inside the polygon.
  How can
  I do this using just GDAL?
 
  Usually I used to cut geotiff file with gdalwarp and but in those
  cases I
  was cutting a square (xmin xmax ymin ymax) and in this case is a more
  complex polygon
 
  Thanks
  Regards,
  Luis
 
  ___
  gdal-dev mailing list
  gdal-dev@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/gdal-dev
 
 
 
 
  --
  Best regards,
  Chaitanya kumar CH.
 
  +91-9494447584
  17.2416N 80.1426E
 
 
 
  ___
  gdal-dev mailing list
  gdal-dev@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/gdal-dev


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] How to cut a Raster map with a KML file

2012-09-05 Thread Luis Lisboa
Thank you Chitanya.
But it created an output file with two layers (one with the values from
original file and another with a 255 for the pixels thar are inside KMZ
file: How can I have produce one layer?
Thanks
Luis
On Mon, Sep 3, 2012 at 5:10 PM, Chaitanya kumar CH
chaitanya...@gmail.comwrote:

 Luis,

 gdalwarp has some options for this exact purpose.
 The cutline can be from any of the OGR readable datasource.

 http://www.gdal.org/gdalwarp.html

 On Mon, Sep 3, 2012 at 9:34 PM, Luis Lisboa luislisboa1...@gmail.comwrote:

 Greetings
 I have a raster file (Geotiff) and I have a KML file with a polygon and I
 want to cut raster map to only have valid values inside the polygon. How
 can I do this using just GDAL?

 Usually I used to cut geotiff file with gdalwarp and but in those cases I
 was cutting a square (xmin xmax ymin ymax) and in this case is a more
 complex polygon

 Thanks
 Regards,
 Luis

 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev




 --
 Best regards,
 Chaitanya kumar CH.

 +91-9494447584
 17.2416N 80.1426E

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] How to cut a Raster map with a KML file

2012-09-05 Thread Eli Adam
Luis,

On Wed, Sep 5, 2012 at 3:00 AM, Luis Lisboa luislisboa1...@gmail.com wrote:
 Thank you Chitanya.
 But it created an output file with two layers (one with the values from
 original file and another with a 255 for the pixels thar are inside KMZ
 file: How can I have produce one layer?

I may be thinking of something else based on your description.  If you
got an output that has the original values in the area of the kmz and
an alpha mask band over the other areas I think that would be
expected.  You can also use -crop_to_cutline to remove that 'extra'
data.

If that isn't what you are talking about, you may want to use ogr2ogr
to convert your kmz to a shapefile in the same projection as your
input raster and see if it gives you a better result.

Bests, Eli


 Thanks
 Luis
 On Mon, Sep 3, 2012 at 5:10 PM, Chaitanya kumar CH chaitanya...@gmail.com
 wrote:

 Luis,

 gdalwarp has some options for this exact purpose.
 The cutline can be from any of the OGR readable datasource.

 http://www.gdal.org/gdalwarp.html

 On Mon, Sep 3, 2012 at 9:34 PM, Luis Lisboa luislisboa1...@gmail.com
 wrote:

 Greetings
 I have a raster file (Geotiff) and I have a KML file with a polygon and I
 want to cut raster map to only have valid values inside the polygon. How can
 I do this using just GDAL?

 Usually I used to cut geotiff file with gdalwarp and but in those cases I
 was cutting a square (xmin xmax ymin ymax) and in this case is a more
 complex polygon

 Thanks
 Regards,
 Luis

 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev




 --
 Best regards,
 Chaitanya kumar CH.

 +91-9494447584
 17.2416N 80.1426E



 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] How to cut a Raster map with a KML file

2012-09-04 Thread Luis Lisboa
Thank you Chitanya. But it created an output file with two layers (one with
the values from original file and another with a 255 for the pixels thar
are inside KMZ file: How can I have just one layer?
Other thing: as far as I saw it procewssed the data without needing to have
the KML and the Geotiff in the same CRS. Can anyone confimr that this is
true?
Thanks
Luis

On Mon, Sep 3, 2012 at 5:10 PM, Chaitanya kumar CH
chaitanya...@gmail.comwrote:

 Luis,

 gdalwarp has some options for this exact purpose.
 The cutline can be from any of the OGR readable datasource.

 http://www.gdal.org/gdalwarp.html

 On Mon, Sep 3, 2012 at 9:34 PM, Luis Lisboa luislisboa1...@gmail.comwrote:

 Greetings
 I have a raster file (Geotiff) and I have a KML file with a polygon and I
 want to cut raster map to only have valid values inside the polygon. How
 can I do this using just GDAL?

 Usually I used to cut geotiff file with gdalwarp and but in those cases I
 was cutting a square (xmin xmax ymin ymax) and in this case is a more
 complex polygon

 Thanks
 Regards,
 Luis

 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev




 --
 Best regards,
 Chaitanya kumar CH.

 +91-9494447584
 17.2416N 80.1426E

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] How to cut a Raster map with a KML file

2012-09-03 Thread Luis Lisboa
Greetings
I have a raster file (Geotiff) and I have a KML file with a polygon and I
want to cut raster map to only have valid values inside the polygon. How
can I do this using just GDAL?

Usually I used to cut geotiff file with gdalwarp and but in those cases I
was cutting a square (xmin xmax ymin ymax) and in this case is a more
complex polygon

Thanks
Regards,
Luis
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] How to cut a Raster map with a KML file

2012-09-03 Thread Chaitanya kumar CH
Luis,

gdalwarp has some options for this exact purpose.
The cutline can be from any of the OGR readable datasource.

http://www.gdal.org/gdalwarp.html

On Mon, Sep 3, 2012 at 9:34 PM, Luis Lisboa luislisboa1...@gmail.comwrote:

 Greetings
 I have a raster file (Geotiff) and I have a KML file with a polygon and I
 want to cut raster map to only have valid values inside the polygon. How
 can I do this using just GDAL?

 Usually I used to cut geotiff file with gdalwarp and but in those cases I
 was cutting a square (xmin xmax ymin ymax) and in this case is a more
 complex polygon

 Thanks
 Regards,
 Luis

 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev




-- 
Best regards,
Chaitanya kumar CH.

+91-9494447584
17.2416N 80.1426E
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev