CityofToronto / bdit_data-sources

Data sources used by the Big Data Innovation Team
https://github.com/orgs/CityofToronto/teams/bigdatainnovationteam
GNU General Public License v3.0
38 stars 8 forks source link

Routing on centreline returns wonky results on one way streets #1091

Open radumas opened 2 hours ago

radumas commented 2 hours ago

Thanks to @Nate-Wessel for pointing out this example in Queen's Park Crescent.

SELECT *
FROM gis_core.get_centreline_btwn_intersections(
     13466931, 13463747 -- northbound from adelaide to bloor routes the wrong way around queens park
    --13463747, 13466931 -- southbound from bloor to adelaide goes way off-course
)

Giving the wrong direction around the park

image

radumas commented 2 hours ago

The problem lies in how gis_core.routing_centreline_directional is handling the one-way encoding

image

https://github.com/CityofToronto/bdit_data-sources/blob/51be37001abf4a829f53a27c4367263568707233/gis/centreline/sql/create_view_routing_centreline_directional.sql#L12-L31

One way streets can have their flow either with or against the direction of digitization (the from-to intersection nodes match the drawing order, so they must be reversed only if drawn against digitization).