[OSM-dev] Using NULL values in mapnik / postgres DB

Jon Burgess jburgess777 at googlemail.com
Tue Feb 20 23:56:07 GMT 2007


On Tue, 2007-02-20 at 23:20 +0000, Artem Pavlenko wrote:
> > I'll have to take a look. Would linemerge fix up the ways looping back
> > on themselves that you reported before?
> That's the plan
> > What node function are you 
> > thinking of and what would it do?
> >
> 
> Here are some examples of invalid ways (geometrically) :
> 
> 1.  http://artem.dev.openstreetmap.org/files/notsimple_way.png  
>    osm2pgsql actually outputs three LINESTRINGS from this way but one is 
> self-tangent (see example 3)
> 
> 2.  http://artem.dev.openstreetmap.org/files/notsimple_way-2.png  - 
> self-intersecting way.
> 
> 3. http://artem.dev.openstreetmap.org/files/notsimple_way-3.png - 
> self-tangent. Only start and end points can match!!!
> 
> 
> 'Noding' is an operation that given collection of LineStrings will produce a 
> new one where none of LineStrings are crossing each other  ( in example [2] 
> it will insert extra node at intesection).
> 
> 'LineMerge' will join segments into simple geometries (the current segment 
> join algorithm produces cases like [2])
> 
> I can code all this in C++  and see if it works and then we can try to merge 
> it into osm2pgsql?  Let me know!

Handling 1 & 3 should be fairly easy to add to the WKT function. It
already locates segments which attach to a given node, it should be
possible to make it split the way if it finds more that 1 matching
segment.

Handling intersecting lines (example 2) is more tricky. I could work out
the math for detecting this if I thought about it for a bit but my old
vector math is a little rusty at the moment. If someone has a link to
some neat algorithm then it would be handy :-)

If you wanted to port osm2pgsql to C++ it should be fairly straight
forward. Some of the code could be simplified by making use of the more
advanced libraries and data constructs.

	Jon






More information about the dev mailing list