do not insert relations with unsupported types during diff import

master
Oliver Tonnhofer 2015-10-07 10:22:30 +02:00
parent 1b347cde96
commit 4195e24dee
4 changed files with 34 additions and 1 deletions

View File

@ -290,7 +290,11 @@ func Update(oscFile string, geometryLimiter *limit.Limiter, expireor expire.Expi
}
// insert new relation
progress.AddRelations(1)
relations <- rel
// filter out unsupported relation types, otherwise they might
// get inserted with the tags from an outer way
if relTagFilter.Filter(&rel.Tags) {
relations <- rel
}
}
for wayId, _ := range wayIds {

View File

@ -217,4 +217,12 @@
</relation>
</modify>
<!-- test that relations with unsupported types are not inserted with updates -->
<create>
<relation id="201291" version="1" timestamp="2011-11-11T00:11:11Z">
<member type="way" ref="201251" role="platform"/>
<tag k="type" v="unmapped_relation_type"/>
</relation>
</create>
</osmChange>

View File

@ -1096,4 +1096,18 @@
<tag k="landuse" v="forest"/>
</relation>
<!-- test that relations with unsupported types are not inserted with updates -->
<node id="201201" version="1" timestamp="2011-11-11T00:11:11Z" lat="32" lon="20"/>
<node id="201202" version="1" timestamp="2011-11-11T00:11:11Z" lat="32" lon="21"/>
<node id="201203" version="1" timestamp="2011-11-11T00:11:11Z" lat="34" lon="21"/>
<node id="201204" version="1" timestamp="2011-11-11T00:11:11Z" lat="34" lon="20"/>
<way id="201251" version="1" timestamp="2011-11-11T00:11:11Z">
<nd ref="201201"/>
<nd ref="201202"/>
<nd ref="201203"/>
<nd ref="201204"/>
<nd ref="201201"/>
<tag k="landuse" v="park"/>
</way>
</osm>

View File

@ -484,6 +484,13 @@ def test_no_duplicate_insert():
assert t.query_row(t.db_conf, 'osm_landusages', -201192)['type'] == 'forest'
assert t.query_row(t.db_conf, 'osm_roads', 201151)['type'] == 'residential'
def test_unsupported_relation():
"""
Unsupported relation type is not inserted with update
"""
assert not t.query_row(t.db_conf, 'osm_landusages', -201291)
assert t.query_row(t.db_conf, 'osm_landusages', 201251)['type'] == 'park'
#######################################################################
def test_deploy_and_revert_deploy():
"""Revert deploy succeeds"""