Fix direction of road segments (fixes #142)

BREAKING CHANGE: This changes the tile generation function, please
update your database with `prepare_sql_tiles.py`.
This commit is contained in:
Paul Bienkowski 2021-12-19 21:21:45 +01:00
parent ab6e2b8a74
commit 810bd39152
2 changed files with 2 additions and 2 deletions

View file

@ -108,7 +108,7 @@ async def mapdetails_road(req):
def partition(arr, cond): def partition(arr, cond):
return arr[:, cond], arr[:, ~cond] return arr[:, cond], arr[:, ~cond]
forwards, backwards = partition(data, mask) forwards, backwards = partition(data, ~mask)
print("for", forwards.dtype, "back", backwards.dtype) print("for", forwards.dtype, "back", backwards.dtype)
def array_stats(arr, rounder): def array_stats(arr, rounder):

View file

@ -24,7 +24,7 @@ RETURNS TABLE(
r.dir as direction, r.dir as direction,
case when road.directionality = 0 then r.dir else 0 end as offset_direction case when road.directionality = 0 then r.dir else 0 end as offset_direction
FROM road FROM road
LEFT JOIN (VALUES (1, TRUE), (-1, FALSE), (0, FALSE)) AS r(dir, rev) ON (abs(r.dir) != road.directionality) LEFT JOIN (VALUES (-1, TRUE), (1, FALSE), (0, FALSE)) AS r(dir, rev) ON (abs(r.dir) != road.directionality)
FULL OUTER JOIN overtaking_event ON (road.way_id = overtaking_event.way_id and (road.directionality != 0 or overtaking_event.direction_reversed = r.rev)) FULL OUTER JOIN overtaking_event ON (road.way_id = overtaking_event.way_id and (road.directionality != 0 or overtaking_event.direction_reversed = r.rev))
-- WHERE road.name = 'Merzhauser Straße' -- WHERE road.name = 'Merzhauser Straße'
WHERE road.geometry && bbox WHERE road.geometry && bbox