[OSM-dev] PostGIS query "Crossing ways"
Paul Norman
penorman at mac.com
Sun Sep 11 19:52:05 UTC 2016
On 9/11/2016 8:20 AM, Mike N wrote:
> 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)
>
> According to the PostGIS documentation, ST_Intersect() includes
> "Touches", which I assume would be sharing an OSM node.
>
> ST_Crosses() might be what I want, but does it exclude the crossings
> that share a node? If not, do I just remove all the ST_Intersect()
> results that are spatially close to ST_Crosses()?
PostGIS databases do not have topology so there is no notion of
connected linestrings. You can tell if two ways cross each other with
ST_Intersects, and you can tell if two share points by turning the
linestrings into points, but this doesn't tell you if the two share
nodes. If you want that you need either the osm2pgsql slim tables,
pgsnapshot, or some other schema with node information or topology.
More information about the dev
mailing list