[gdal-dev] How to find image footprints instead of envelopes?

Even Rouault even.rouault at spatialys.com
Tue Oct 13 08:48:05 PDT 2015


Le mardi 13 octobre 2015 13:19:50, Jukka Rahkonen a écrit :
> Hi,
> 
> This question appears every now and then in the gis.stackexchange and I
> have been wondering about it by myself as well: How to generate a
> footprint polygon of the real image data area so that the possible nodata
> areas would not be included?
> 
> I have been thinking that I could convert the original image into a new
> image with alpha channel or a one-bit image with nodata=0 and yesdata=1 and
> then polygonize the alpha band or the 1-bit image with gdal_polygonize.py.

You can get the image to polygonize with :
gdal_translate in.tif mask.tif -b mask

That should work with images with nodata or alpha channel.

> I guess that it would work but it feels a bit complicated. Is there any
> more direct way for doing this task with GDAL?

None that I can think of.

gdal_polygonize.py would possibly do a bit more work than really needed in 
case there are holes of nodata inside the raster and you're not interested in 
such holes.

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list