[OSM-dev] OT: OGR, Douglas-Peucker
Lars Aronsson
lars at aronsson.se
Sat Feb 25 14:43:32 GMT 2006
Erik Johansson wrote:
> Implementing Douglas-Peucker isn't that hard and there are some
> pieces of example code around, but I failed hard in using it.
> Not because it doesn't work, it does and it's really great for
> lines. But I can't reallt figure out how to use it with graphs,
> when two lines are connected I don't know what to remove.
I think I don't really understand the issue you describe.
My perspective as a newcomer to this field is this: If I want to
dig deeper into how I can use the free vector map data we get out
of OSM, should I start with OGR and implement my own
Douglas-Peucker or should I go for some other (which?) open source
toolbox where such algorithms are already implemented?
Anyhow, I assume one application could be this: If you are drawing
the OSM map in a smaller scale (something like zoom=7), and if the
rendering takes too much time, you could let Douglas-Peucker
reduce the amount of data by removing several nodes that connect
only two line segments, but keep all nodes that connect only one
line segment (end points) or three or more (junctions). This would
simplify the curves/lines for long country roads. For cities with
dense patterns of 3- and 4-connecting nodes, some other kind of
data reduction could be used. I'm just guessing.
Cartographers use the word "generalization" for this kind of data
reduction. Doesn't Mapserver have any automatic support for this?
The OSM dataset might be optimal for rendering in scale 1:30,000
(zoom=13) and the necessary generalization for scale 1:300,000
(zoom=10) or 1:3,000,000 (zoom=7) could perhaps be run as a
nightly batch conversion. The on-the-fly tile generation could
then use these reduced datasets for the reduced scales, keeping
the complexity (number of nodes) per tile at a constant level.
Again, these are just my loose fantasies, based on no experience
at all. My immediate question is a search for a useful toolbox.
--
Lars Aronsson (lars at aronsson.se)
Aronsson Datateknik - http://aronsson.se
More information about the dev
mailing list