[Tile-serving] [osm2pgsql-dev/osm2pgsql] Missing OSM Restrictions in Bounding Box Query After Importing with osm2pgsql (Discussion #2215)
Andreas
notifications at github.com
Sun Jul 28 09:33:36 UTC 2024
> Turn restrictions are mapped as special relations. They can not just be mapped to simple lines, processing will be much more involved. The old pgsql output of osm2pgsql was never intended to handle them and will simply not work for you. The newer flex output of osm2pgsql can, in theory, handle turn restriction relations, but some configuration and post-processing will be necessary to make the data useful. Please familiarize yourself with how turn restriction relations work and with the flex output. You might be able to get something to work, but it will need some effort. I have not yet seen a configuration for osm2pgsql that handles turn restrictions.
I modified a lua script I found here :
https://raw.githubusercontent.com/osm2pgsql-dev/osm2pgsql/master/flex-config/compatible.lua
to include restrictions:
https://raw.githubusercontent.com/Andreas4242/Andreas_file_tools/main/compatible.lua
Im not sure its totally correct but it gives me results if I run this query:
```
SELECT DISTINCT tr.restriction, tr.tags->>'restriction:conditional'
FROM planet_osm_line l
JOIN planet_osmturn_restrictions tr
ON l.osm_id = tr.from_way OR l.osm_id = tr.to_way
WHERE l.highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified',
'residential', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link')
AND ST_Intersects(l.way, ST_Transform(ST_MakeEnvelope(10.91492, 47.41136, 13.41705, 49.07207, 4326), 3857));
```
```
restriction | ?column?
------------------+---------------------------------------
no_left_turn | none @ destination
no_left_turn | no @ psv
no_left_turn |
no_right_turn |
no_straight_on |
no_turn | no_left_turn @ (Mo-Fr 16:00-19:00)
no_turn | only_right_turn @ (Mo-Fr 07:00-14:00)
no_turn |
no_u_turn |
only_left_turn |
only_right_turn |
only_straight_on |
only_u_turn |
(13 rows)
```
This whole lua business is waaaayy to complicated for me.. loved the old config more.. im only half sure what im doing and thank god for chatgpt :D
--
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/discussions/2215#discussioncomment-10170897
You are receiving this because you are subscribed to this thread.
Message ID: <osm2pgsql-dev/osm2pgsql/repo-discussions/2215/comments/10170897 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20240728/74cd8cbf/attachment-0001.htm>
More information about the Tile-serving
mailing list