[gdal-dev] RE clip intersected

Frank Warmerdam warmerdam at pobox.com
Fri Jul 17 13:24:44 EDT 2009


Steve.Toutant at inspq.qc.ca wrote:
> 
> I might try this..is it the good way to do what I need?
> 
> 1- Use gdal_polygonize.py to create a boundary (excluding pixels with no 
> value) of each image and save the boundary as a .shp
> 2- Somehow find the intersected region of the 2 polygons (boundaries) 
> created above and save the result to .shp
> 3- Use gdal_rasterize on one of the original image  to burn a nodata 
> value based on the polygon representing the intersection area
> 
> I didn't try yet because I don't have gdal_polygonize.py
> My installation is from MS4W and this script is not there. I just 
> install GDAL with OSGEO4w and it seems that this script doesn't exist.
> 
> If the method above is valid,
> - how can I create a boundary excluding pixels with nodata?
> - And, of course, where can I get  gdal_polygonize.py

Steve,

I would be tempted to do this process in raster space.  Perhaps by warping
both images into different bands of a mosaic file to get everything overlaying
and then using some sort of raster modelling (perhaps via numpy in a python
script) to zero out the one image where the other is set.

I think the vector mask approach would be difficult, in part because the mask
produced would be very fine grained.  Depending on your need for precision you
could just hand digitize a vector mask suitable to wipe out the overlapping
area.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list