omniscale / imposm3

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

Polygon missing when using load_all #143

Closed Joxit closed 7 years ago

Joxit commented 7 years ago

Context

I have a polygon P inside a relation R. P has the tag shop and R the tag public_transport. The mapping file create a table of polygon T which will import tags shop=* and public_transport=*.

When I use tags.load_all in my mapping file, imposm will import R in T as a multipolygon (because of public_transport=*). And without this option, it will import P in T as a Polygon (because of shop=*).

In any case, it should import P or in the worst case, import R and P in T.

Steps to Reproduce

Here is the .osm file illustrating the bug :

<?xml version='1.0' encoding='UTF-8'?>
<osm version="0.6" generator="osmfilter 1.4.0">
    <node id="1" lat="48.8275487" lon="2.2005598"/>
    <node id="2" lat="48.8275933" lon="2.2006673"/>
    <node id="3" lat="48.8276018" lon="2.2005746"/>
    <way id="4">
        <nd ref="2"/>
        <nd ref="3"/>
        <nd ref="1"/>
        <nd ref="2"/>
        <tag k="name" v="This is a way"/>
        <tag k="shop" v="shop_way"/>
    </way>
    <relation id="5">
        <member type="way" ref="4" role=""/>
        <tag k="name" v="This is a relation"/>
        <tag k="public_transport" v="public_transport_relation"/>
    </relation>
</osm>

Now, here is the mapping file :

tags:
  load_all: true
  exclude:
  - created_by
  - source
tables:
  building_levels:
    fields:
    - name: osm_id
      type: id
    - name: geometry
      type: geometry
    - key: name
      name: name
      type: string
    - name: type
      type: mapping_value
    mapping:
      shop:
      - __any__
      public_transport:
      - __any__
    type: polygon
  1. Convert the osm in osm.pbf file
  2. Import the osm.pbf with the mapping file (no specific options)

Expected Behavior

I should have in my table this line :

id osm_id name type
1 4 This is a way shop_way

This is also the result when I remove tags.load_all.

Actual Behavior

I have this :

id osm_id name type
1 -5 This is a relation public_transport_relation

Environment

olt commented 7 years ago

This should be fixed when #146 is merged.