[gdal-dev] Make gdal_polygonize to support the mask band

jratike80 jukka.rahkonen at maanmittauslaitos.fi
Mon Nov 7 06:00:25 PST 2016


Even Rouault-2 wrote
> Le vendredi 04 novembre 2016 18:00:10, Rahkonen Jukka (MML) a écrit :
>> Hi,
>> 
>> Once again someone wants to get the footprints of valid data in images
>> http://gis.stackexchange.com/questions/216624/creating-a-shapefile-for-foo
>> tprint-of-tasters-valid-data-areas-with-gdal.
>> 
>> A year ago, in here
>> https://lists.osgeo.org/pipermail/gdal-dev/2015-October/042859.html Even
>> suggested to create a mask-only image with
>> gdal_translate in.tif mask.tif -b mask
>> and then polygonize that into vectors with gdal_polygonize.
>> 
>> I wonder how hard it would be to make gdal_polygonize to find the mask
>> band
>> directly and recognize it with "-b mask" just like gdal_translate does.
> 
> Not that hard. I just added support for that.
> 
> Even

Thanks, and here is a little post-process command with SQLite SQL dialect
that can be used for removing the no-data polygons and holes which are
created by gdal_polygonize and leave just the yes-data area 

ogr2ogr -f GML -dialect SQLite -sql "select
ST_BuildArea(ST_ExteriorRing(geometry)) from mask where DN=255"
raster_data_polygon.gml mask.gml

-Jukka Rahkonen-



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-Make-gdal-polygonize-to-support-the-mask-band-tp5294371p5294630.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list