0

Is there any way with osm2pgsql to filter out members of a relation during the import phase, based upon the tags of the member?

My use case is that I want to gather a set of road cycling relations, but I want to exclude any sections of those relations (i.e. the member ways) that are marked with route=mtb.

I've been trying out the examples of the Flex output mode in osm2pgsql, and it looks like you can include/exclude relations and their tags, but you cannot exclude members from the relations.

1 Answer 1

0

The new flex version of the main 'openstreetmap-carto' style that is currently in development:

https://github.com/gravitystorm/openstreetmap-carto/pull/4431

contains a definition of a new 'planet_osm_route' table.

Note that this table is non-spatial, see image! It doesn't contain geometries. The idea behind it is that, instead of duplicating the geometries that are already stored in the 'planet_osm_line' table, you can instead dynamically display routes by joining this table with the 'planet_osm_line' table via the route 'member_id' field in the 'planet_osm_route' table, that references the OSM ID of the corresponding geometries in 'planet_osm_line'.

With this new table and capability of flex, it should then be relatively easy to filter out all member ways of a route additionally tagged with 'route=mtb'. It will require some thought and SQL wizardry, but I think it can be done.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.