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

Sean Gillies sean at mapbox.com
Wed Oct 14 08:07:46 PDT 2015


Jukka,

Yes, I've written the Python script to do this. If you're willing to
install Rasterio (which is GDAL and underneath, but new bindings and not
osgeo.gdal) you can use its rio-shapes command (based on GDAL's
polygonizer):

https://github.com/mapbox/rasterio/blob/master/docs/cli.rst#shapes

The script's entry point is at
https://github.com/mapbox/rasterio/blob/master/rasterio/rio/features.py#L197.
You're welcome to port it to GDAL's Python bindings; swapping out rasterio
and swapping in osgeo.gdal wouldn't be terribly hard.


On Tue, Oct 13, 2015 at 5:19 AM, Jukka Rahkonen <
jukka.rahkonen at maanmittauslaitos.fi> wrote:

> 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.
> I
> guess that it would work but it feels a bit complicated. Is there any more
> direct way for doing this task with GDAL? I bet that at least someone has
> written a python script for it because the need is so obvious.
>
> -Jukka Rahkonen-
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev




-- 
Sean Gillies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20151014/1e34e612/attachment.html>


More information about the gdal-dev mailing list