[gdal-dev] Countour polygons instead of lines

Even Rouault even.rouault at spatialys.com
Thu Oct 19 05:46:54 PDT 2017


On jeudi 19 octobre 2017 14:11:45 CEST Vincent Mora wrote:
> Hi all,
> 
> I know this is old stuff (references below), but making polygons instead
> of lines would be a great option for gdal_contour IMO.
> 
> It could be also another program included in gdal/app (if it is already,
> I can't find it).
> 
> What do you think, shall I add that ? If yes, first or second option ?

Hi Vincent,

Would be definitely useful. If you base it on the existing countouring alg, 
then it makes sense to add this as a, let's say, "-polygon" option of the 
gdal_contour utility. 
We wiould need to cross-reference gdal_contour and gdal_polygonize 
documentation to explain the differences, as people could get confused.

There's also https://trac.osgeo.org/gdal/ticket/6526 related to isoband.

Greger's point about how to handle linestrings touching the raster edge is a 
good one. I guess we could have a mode where we force close polygons (probably 
the default mode), and another one (not necessarily needed now) where we leave 
them open so that then can be merged together.

Currently GDALContour() writes the geometries in a streaming way (and 
potentially with a driver that doesn't support fully random read/write 
operations). Probably that for creating polygons, you would need some 
temporary vector datasets ? But perhaps not, as it seems the current algorithm 
already stores quite a bunch of line segments in memory before being able to 
emit linestrings to the output driver.


Even

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


More information about the gdal-dev mailing list