[OSM-dev] PostGIS query "Crossing ways"

Tomas Straupis tomasstraupis at gmail.com
Mon Sep 12 07:49:27 UTC 2016


2016-09-11 18:20 GMT+03:00 Mike N <niceman at att.net>:
> Given a PostGIS database populated from OSM data by osm2pgsql, and 2 sets of
> lines  (such as the selection of all footways and the selection of all
> roads)   what function or series of functions will result in a list of
> locations where footways cross roads without any OSM connecting node?  (the
> equivalent of JOSM's "Crossing Ways" warning)

  The closest I could get to this was by splitting way
(planet_osm_lines) geometry into their segments. I was creating a new
table say „segments“ with identical attributes as planet_osm_lines in
which the same osm_id would be repeated as many times as many segments
that way has. (You could also do it without actually creating a new
table and letting postgresql process everything on the fly).

  If you have a way with three nodes, you would get two new lines (two
line geometries, two records in the new table).

  Then you can use PostGIS functions to find intersecting ways. But
you will not find intersection problems where two ways cross each
other on the same x/y, but they have two different points in OSM (two
different points with the same position one for way1, another for
way2).

-- 
Tomas



More information about the dev mailing list