[gdal-dev] Countour polygons instead of lines

Hans Gregers Hedegaard Petersen gregers at septima.dk
Fri Oct 20 00:08:46 PDT 2017


> I think I did something similar to the "ends matching" in a python
> script that creates those polygons (in a particular context that also
> requires tiling).
>
> What I'd like to know, is if there is a reason why it's not already
> available in gdal, since there is the need for that and apparently algos
> to reach the goal.

That reason might be the use case - as indicated below and by Jamie.

>> You cannot always make polygons with them unless you are on a perfect
> island
>
> I'm not sure I understand the that. The polygons I have in mind are
> polygons with holes (multipolygons for a given class actually), is it
> related to what you're saying ?

The true isolines do not follow the edge of a tile. If you are on an
island you will have a natural boundary all around you DEM, and "all"
isolines should be closed (with the final isoline at sea level).

If all you are interested in is "this is above 5m" then you could -
and I would - simply use Jamies suggestion with gdal_calc and
gdal_polygonize. Closing the isolines had mostly to do with styling
and delivering as few linestrings as possible. The clientwould like to
be able to close them to polygons for easy access to areas. But if you
have the DEM yourself...


/Gregers


More information about the gdal-dev mailing list