-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gdal_contour] Do not include min/max when polygonize #11673
[gdal_contour] Do not include min/max when polygonize #11673
Conversation
15b7e42
to
0d8138f
Compare
Fixes OSGeo#11564 by not including raster min/max when polygonize and fixed levels are specified. MIN and MAX literals can be used to specify raster min/max values, e.g.: -fl MIN 10 20 30 MAX
0d8138f
to
26d9230
Compare
|
||
This would create 10-meter polygonal contours from the DEM data in :file:`test.asc` and produce a GeoJSON output | ||
with the contour min and max elevations in the ``min`` and ``max`` attributes, the values of these fields will | ||
be: (4.0, 10.0), (10, 15.0), (15, 20.0) and (20, 36.0). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shoud it be (10, 15.0), (15, 20.0) and (20, 30.0)?
I think I understand what happens, but not how to describe it so that a newcomer understands. Perhaps something like
"Creates contours at regular 10 meter intervals and adds extra contour for a fixed 15 m level. Finally turns areas between the contours into polygons."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For those values, shouldn't user define -i 10 -fl MIN 15 MAX -p
? Otherwise it would not match with the title. Or do regular intervals start/stop at min/max automatically? It does make sense, most users want to get the polygon between the sea and 10 m level automatically, but it is not clear from the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a bit different approach would have been easier to explain. First improve documentation of -p
"Generate contour polygons rather than contour lines. The min and max values of the raster will be used as the lower and upper limit for the data range of the first and last polygon, respectively.
Then introduce exlude_min
and exclude_max
for preventing the default behavior so that it would have similar effect on all -i
and -fl
combinations, when used together with -p
, and no effect without -p
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For those values, shouldn't user define
-i 10 -fl MIN 15 MAX -p
? Otherwise it would not match with the title. Or do regular intervals start/stop at min/max automatically? It does make sense, most users want to get the polygon between the sea and 10 m level automatically, but it is not clear from the documentation.
yes, regular intervals get min/max automatically. I didn't change that.
e8da296
to
d5a1040
Compare
The minimum and maximum values from the raster are not automatically added to | ||
the fixed levels list but the special values `MIN`` and `MAX`` (case insensitive) | ||
can be used to include them. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... but when option -i
is used together with -p
, the minimum and maximum values from the raster ARE automatically added, and there is no way to get rid of them.
I know this is not a common use case, but there can be lot of writing to the -fl
if the DEM has a large height range.
This would create 10-meter polygonal contours from the DEM data in :file:`test.asc` | ||
and produce a GeoJSON output with the contour min and max elevations in the ``min`` | ||
and ``max`` attributes, not including the minimum and maximum values from the raster. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand. If there is only -i
, doesn't it mean, that min/max are used just like before the change?
Or maybe I just need another cup of coffee.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You a re right: I removed the not
.
Fixes #11564 by not including raster min/max when polygonize and fixed levels are specified.
MIN and MAX literals can be used to specify raster min/max values, e.g.:
-fl MIN 10 20 30 MAX