Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Am creating an app which correctly calculates contours from a DEM file or any height-map given to it. The correctness of the contour holding the most importance, since a person viewing the contours shouldn't end up taking wrong planning decisions and maybe losing their life by the route they choose after looking at the map.

I have already tried using GDAL 1.7 source code, compiled it and added some features of my own to it for some other objective. Now I want to add-to/modify the source to be able to use the contour generation function of GDAL in C++.

But before proceeding, I wanted to know:
1. If GDAL offers the best free contour generation algorithm available or is there any other library which I can link to my code and feed my DEM map to it and receive contour vector lines (or go thru research papers and implement the contour generation algorithm myself in C++)? If GDAL, then why is it the best?
2. A generated contour will basically be points connected with straight lines. Is it more correct for a contour to be depicted with connected straight lines or will it give a more correct result to use a spline to smoothen out the lines?

I won't be interpolating any contours or the DEM because I've read on this website that interpolation leads to incorrect results.

share|improve this question
    
I can not say to much about algorithms for contour generation but in your case I would search for best quality elevation data out there, rather tahn algoritm itself. Algorithm may be only as good as the data you feed in to it. –  Tomek Feb 13 '13 at 9:46
    
I agree. Good advice. But assuming the data constant, which would be the best algorithm/library, is what I'm asking? –  Nav Feb 13 '13 at 10:39
1  
The accuracy of contours depends on the nature of the underlying data: there is no universal contouring algorithm that is optimally accurate. You misunderstand the cautions about interpolation: all methods to predict unsampled data must be inaccurate. The question to consider is how inaccurate they might be and the ways in which they can be expected to err. Incidentally, when you draw contours from a DEM you are interpolating, whether or not you choose to call it that. –  whuber Feb 13 '13 at 15:45
    
Thanks. I've been trying to find out which algorithm GDAL uses for creating contours, but couldn't find any hint on that. Anyone here know? Basically my main requirement is that I should be able to use GDAL (or any other contour generation algo) to create reliable contours which are the best in terms of accuracy (when compared with any application that displays contours). I don't want to start using GDAL and then much later realize that it doesn't suit my needs of multicore support, accuracy, smoothening or specifying the height interval between major and minor contours. –  Nav Feb 14 '13 at 12:01

1 Answer 1

up vote 0 down vote accepted

I asked this question on the osgeo forum too, and some very helpful people replied. Would just like to list out the gist of the answers so that it'd be helpful to anyone who'd search for a contour algorithm later.

DEM or DTM files contain geographic features. Contours aren't geographic features; they're cartographic artifacts. The quality of the geographic features are important.The contour accuracy can never be more accurate than the source data. GDAL isn't the worst or the best. It gives an algorithmic result. Worst or best lies in your data, the processing chain of the data (interpolation/smoothing of DEM etc.) and your intended use.

The only case where route finding where wrong elevation can be life critical would be beach travel beneath sea cliffs and aircraft terrain avoidance.

As for interpolation, there's also the method of using TINS (intersecting the triangular 'faces'). Interpolation doesn't necessarily lead to incorrect results. DEM data is mostly already interpolated.

http://osgeo-org.1560.n6.nabble.com/Most-optimal-algorithm-for-contour-correctness-td5034148.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.