[gdal-dev] gdal_contour: min value unexpected

Paul Meems bontepaarden at gmail.com
Fri Apr 5 01:27:09 PDT 2024


Hello List,

I have a Surfer grid which I want to convert into polygons using
gdal_contour.
The min value of the lowest polygon is 0 which I didn't expect.
In the next step, I calculate the average of the min and max values, and in
this case that average is wrong.

These are the values of the grid:
Grid Size (X*Y):       113 x 121
NoData Value:          1.70141E+38
Minimum:               105000
Maximum:               133000

This is my command:
gdal_contour -p -f "ESRI Shapefile" -fl -97000 -37000 23000 83000 89000
95000 101000 107000 113650 121000 129000 137000 143000 149000 155000 215000
275000 335000 -amin Min -amax Max "Surfer.grd" "tmp3p4f4i.shp"

As you can see, the lowest value of the grid (105000) is between the values
101000 and 107000.
So I would expect to have the min value of the shapefile be 101000 and the
max value 107000.

But the result is:
[image: image.png]
Min is 0 and max is 107000.

I also tried setting the lowest value of the grid to 107000 (one of the
level values) but that also resulted in a min value of 0.

The polygons themselves are OK, just the min value of the lowest value is
incorrect.

I'm using GDAL 3.6.3, released 2023/03/07 on Windows.

Why is this happening?
Do I need to set an additional argument?

Please advise.

With regards,

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240405/6b8bc245/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 5407 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240405/6b8bc245/attachment.png>


More information about the gdal-dev mailing list