[Tile-serving] [osm2pgsql-dev/osm2pgsql] Linking between nodes and ways (Discussion #2455)

Jochen Topf notifications at github.com
Thu Apr 9 17:35:32 UTC 2026


Have a look at the [turning-circles.lua example in that branch](https://github.com/joto/osm2pgsql/blob/id-cache/flex-config/turning-circles.lua). It shows how this looks like. The "highways with TCs table" is called `highway_ends` (not a great name). It contains the node and way ids, so you can always use that to join other tables to get to the attributes you need. You can either do that on import or at render time, whatever works best for your use case.

> I'm also not clear on how the "highway with TCs table" is kept current during updates.

This will just work "magically" as other updates with osm2pgsql. If the way changes, the entries are deleted and new ones written just like with any other way-based table. And if the node changes, that change will automatically trigger a way change for all ways that contain that node (like all node changes do) which leads to the same result.

There is one extra thing I am currently looking at: Often you need the *direction* of the way to render the node in some special way, say a barrier that should be rendered perpendicular to the road. You can do that in SQL, but it will be easier to do that with a little help from osm2pgsql. I am still experimenting what the best way to do that would be, but in essence I want to add a Lua function to get the azimuth, the angle between North and the line direction, in that node, so you can, for instance, store it into an extra column. For the first and last node the angle would be calculated based on the first and last segments of the line, respectively. For inner nodes I think the angle should be the "average" angle between the segment before and after the node. If you have different needs there, I'd like to hear them.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/discussions/2455#discussioncomment-16506782
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/repo-discussions/2455/comments/16506782 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20260409/87736e76/attachment-0001.htm>


More information about the Tile-serving mailing list