[gdal-dev] Countour polygons instead of lines

Ari Jolma ari.jolma at tkk.fi
Wed Sep 3 03:40:13 EDT 2008


Matthew Perry kirjoitti:
> On Tue, Sep 2, 2008 at 2:26 PM, Ari Jolma <ari.jolma at tkk.fi> wrote:
>   
>> Did you ever want gdal_contour to produce polygons instead of lines?
>>     
> ...
>   
>> I wonder what's the current situation. Does GRASS do this?
>>
>>     
>
> Indirectly, yes. You can use r.reclass to create areas of similar
> elevation from the raster DEM and r.to.vect to covert to polygons.
>   

Thanks for the comment,

Yes, I can do that too: http://map.hut.fi/files/misc/reclassed.png but 
it's uglier than that from the contour, and at least in my 
implementation there's the problem of overlapping polygons not ordered 
correctly (can be seen in that example). That is because of the way the 
vectorization is done. Does GRASS create polygons with holes?

For comparison: http://map.hut.fi/files/misc/from_contours.png which 
shows that there are still bugs in my program :(

I use GEOS methods in the program and it turns out that the contour 
lines gdal_contour creates are not always well-behaving enough. 
Sometimes those lines that start from the image boundary have an extra 
vertice either in the beginning of the line or at the end.

Ari

-- 
Prof. Ari Jolma
Environmental Management Information Technology
Teknillinen korkeakoulu / Helsinki University of Technology
tel: +358 9 451 3812 address: POBox 5300, 02015 TKK, Finland
Email: ari.jolma at tkk.fi 
http://geoinformatics.tkk.fi/twiki/bin/view/Main/AriJolmaHomePage




More information about the gdal-dev mailing list