[gdal-dev] gdal_contour produces extremely tiny/skinny isoline/isopolygon geometry
Brad Hards
bradh at frogmouth.net
Wed Jan 4 13:27:54 PST 2023
On Thursday, 5 January 2023 5:34:18 AM AEDT Rick Harding wrote:
> Hi,
>
> I am using gdal_contour to generate iso-polygons from a hillshade raster
> created via the gdal_dem tool. In certain situations, I am seeing a lot of
> tiny/narrow polygons and large polygons with long, skinny *whiskers*
> protruding out (and sometimes in) . In these cases, the vertices in the
> *skinny* areas are less than 1e-07 away from their nearest edge/vertex.
This seems like the expected behaviour (or at least, reasonable behaviour).
gdal_contour is expecting a DEM input (not a generic raster or image), and is
trying to make meaningful contour lines (as you'd see on a map to represent
elevation). There is an introduction to how it works in
https://github.com/OSGeo/gdal/blob/master/alg/contour.cpp#L380-L549
gdal_contour should take the same input you used for the hillshsade. Input of
hillshade is probably always going to give you weird results.
It might help to say what you're actually trying to achieve with this (as
opposed to how), but if you are looking for generic iso-lines of the
hillshade, try https://gdal.org/programs/gdal_polygonize.html
Brad
More information about the gdal-dev
mailing list