kennykb / osm-shields

Custom highway shields for OpenStreetMap
Other
4 stars 2 forks source link

Develop support for the 'flex' backend of 'osm2pgsql' #14

Closed kennykb closed 3 years ago

kennykb commented 3 years ago

With the advent of the 'flex' backend in osm2pgsql, it now appears once more that osm2pgsql is fit for purpose to maintain the tables needed to track membership in route relations for placement of pictorial highway shields. This feature request is being created to track that development.

The idea is that the osm2pgsql style sheet can maintain these tables with additional calls to a new module, shieldtables.lua. This module will allow the following calls:

local shieldtables = require 'shieldtables'
local shieldt = shieldtables.new(prefix)

These will be called in the initialization of the style sheet, to create the object that manages the two new tables. prefix is the table name prefix; default is planet_osm.

shieldt:process_way(object);

Must be called from osm2pgsql.process_way. In phase 2, creates any needed rows in the shieldway table for ways that bear highway numbers.

shieldt:process_relation(object)

Must be called from osm2pgsql.process_relation. Creates any needed rows in the shieldroute table to describe route relations.

return shieldt:select_relation_members(object)

Must be called from osm2pgsql.select_relation_members. Returns a table with a single key, ways, which in turn is a table of OSM ID's of ways that require phase 2 processing because they participate in route relations.

This appears to be much more in keeping with the usual workflow than would a switch to a different tool such as imposm3. It also allows keeping a rough equivalent to the current conversion style, by adding the calls above to compatible.lua.

Much more work needs to be done, but forward progress is starting again.

kennykb commented 3 years ago

Closed by #15.