[gdal-dev] Most optimal algorithm for contour correctness?

2013-02-13 Thread nav
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. 



--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/Most-optimal-algorithm-for-contour-correctness-tp5034148.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Most optimal algorithm for contour correctness?

2013-02-13 Thread nav
May I know why I'm shown a message that "this post has not been accepted by
the mailing list yet" even though I received an email saying that I'm
already subscribed to the mailing list?



--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/Most-optimal-algorithm-for-contour-correctness-tp5034148p5034149.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Most optimal algorithm for contour correctness?

2013-02-15 Thread Martin Feuchtwanger

Nav,

I don't know about the gdal routines specifically, but:

1. Re. dem/dtm generally, the most significant factor in interpolation
   results is the quantity (density, really) and quality of the source
   data, not the interpolation algorithm.
2. Re. contours generally, they are cartographic artifacts, not
   geographic features and will never be more accurate than the source
   data (unless you know the data are very "noisy" and ought to be
   smoothed.
3. Re. segments vs splines, it depends whether the segment end-points
   are fixed and only their interiors are shifted, or the corners are
   shifted to make them rounded and the interiors fixed. The former is
   much better since the end-points are "primary" interpolations (based
   on data) and the interiors "secondary" (based on primary). Smoothing
   out the contours (either way) will make them cartographically
   pleasing, but the degree of "curviness" should depend on the assumed
   ruggedness of the original terrain (more rugged => less smoothing).

Hoping that helps and that others will comment on the specific gdal 
routines,


Martin Feuchtwanger  feu...@shaw.ca  604-254-0361
http://members.shaw.ca/geomatics.developer

On 13/02/2013 7:15 PM, nav wrote:

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.



--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/Most-optimal-algorithm-for-contour-correctness-tp5034148.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev



___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Most optimal algorithm for contour correctness?

2013-02-16 Thread Jan Heckman
Hi,
I've tackled a similar problem.
Correctness of contour is a simple matter, except for one thing. That is
the issue of saddles.
That issue cannot be solved "correctly" since typically the data can be
interpreted in several ways.
This is also described in a wikipedia article (google for it, if you like).
Imagine a (descending) mountainridge, which may have towers and gaps in it
(sometimes referred to as sentinels when climbing).
When the (dem) grid is too coarse, these won't show.
I found that I had to write my own routine to handle this.
Roughly as follows:
When gridsquare with values equal or larger than the contourvalue are
isolated, except they touch diagonally, you have a potential saddle
situation.
My "correctness" is that I continue straight on when the average of the
four surrounding gridpoints is equal to or larger than the contour value.
If not, the contour is divided in two subcontours.
Hope this helps and tell me whether you need such code.
I have been considering offering it for the gdal and saga communities, but
have not had enough time to make the code nice enough.
Jan

On Thu, Feb 14, 2013 at 4:15 AM, nav  wrote:

> 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.
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/Most-optimal-algorithm-for-contour-correctness-tp5034148.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> ___
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev