Opened 9 years ago

Closed 5 years ago

#5848 closed enhancement (wontfix)

[PATCH] Added contours smoothing to gdal_contour

Reported by: hassassin Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: Utilities Version: unspecified
Severity: normal Keywords: gdal_contour
Cc:

Description

This patch provides support for contour smoothing generated from DEM via sliding averaging algorithm. The result looks pretty nice as you can see in attached samples.

In addition, I added filter for contours with too few points (these contours will be remove).

Both additions are optional and turned off by default.

I'd like to ask if there is an interest in this functionality and if it would be possible to add it to the official gdal_contour utility.

Attachments (4)

0001-Contours-smoothing-by-sliding-averaging-algorithm.patch (12.4 KB ) - added by hassassin 9 years ago.
original.png (599.2 KB ) - added by hassassin 9 years ago.
filtered.png (581.2 KB ) - added by hassassin 9 years ago.
All contours with less than 20 points were removed, no smoothing.
smoothed.png (553.0 KB ) - added by hassassin 9 years ago.
Both filtering and smoothing applied.

Download all attachments as: .zip

Change History (7)

by hassassin, 9 years ago

Attachment: original.png added

by hassassin, 9 years ago

Attachment: filtered.png added

All contours with less than 20 points were removed, no smoothing.

by hassassin, 9 years ago

Attachment: smoothed.png added

Both filtering and smoothing applied.

comment:1 by Even Rouault, 9 years ago

Summary: Added contours smoothing to gdal_contour[PATCH] Added contours smoothing to gdal_contour

Potentially interesting. A few remarks/questions :

  • how did this relate with shape smoothing that has been implemented in MapServer for similar purposes ? See http://mapserver.org/development/rfc/ms-rfc-94.html
  • for more generality, could be interesting as a standalone method that operates on a OGRLineString* and would be used be GDALContourGenerate()
  • validation of the parameters should be done in GDALContourGenerate() itself too (odd value for nLookAhead, dfSlide between 0 and 1, ...)
  • it would be good to keep the current API of GDALContourGenerate() and make a new function GDALContourGenerateEx() with the extra parameters, as well as a char papszOptions for future enhancements
  • not sure to understand the meaning/effect of the slide parameter
  • the gdal.ContourGenerate() entry point in SWIG bindings should be updated
  • we would need an update of the documentation and autotest

comment:2 by Jukka Rahkonen, 8 years ago

hassassin, do you have anything to say about the comments by Even?

comment:3 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.