omniscale / imposm3

Imposm imports OpenStreetMap data into PostGIS
http://imposm.org/docs/imposm3/latest/
Apache License 2.0
723 stars 158 forks source link

Improve support for relation table mapping to prevent redundancy #180

Open zdila opened 5 years ago

zdila commented 5 years ago

I'd like to generate 3 tables for rendering hiking (bicycle, ...) routes:

  1. segments

    • way_id
    • geometry
  2. routes

    • relation_id
    • name (from relation)
    • osmc:symbol (from relation)
    • network (from relation)
    • ref (from relation)
  3. membership

    • way_id
    • relation_id

I found no way to map it with imposm3. There I can only create 2 tables:

Reason why I need schema I described is that for every segment I want to do select like:

SELECT geometry, string_agg("osmc:symbol", '~') FROM segments NATURAL JOIN membership NATURAL JOIN routes GROUP BY way_id

I can work around this problem by only using these with two tables (of types relation_member and relation) but I don't like the geometry colum is redundantly multiplied in table of the relation_member.