Skip to content

Commit

Permalink
add failing test-case for #18
Browse files Browse the repository at this point in the history
multipolygons that are not closed (topological) can be handled by
using GEOS LineMerge function. It's expected to be slower than the
node ID based merger. Maybe it's feasible to use LineMerge as a
fallback.
  • Loading branch information
olt committed Feb 5, 2014
1 parent 48486e7 commit ff6207d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/imposm_system_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@ def test_generalized_linestring_is_valid():
assert road['geometry'].is_valid, road['geometry'].wkt
assert road['geometry'].length > 1000000

@unittest.skip("not implemented")
def test_relation_with_gap():
"""Multipolygon with gap (overlapping but different endpoints) gets closed"""
park = query_row(db_conf, 'osm_landusages', -7301)
assert park['geometry'].is_valid, park

#######################################################################
def test_update():
Expand Down
24 changes: 24 additions & 0 deletions test/test.osm
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,30 @@
<tag k="name" v="self-intersecting"/>
</way>

<!-- relation with "gap" (ways overlap, but are only sharing one endpoint) -->
<node id="7301" version="1" timestamp="2011-11-11T00:11:11Z" lat="60" lon="60"/>
<node id="7302" version="1" timestamp="2011-11-11T00:11:11Z" lat="60" lon="62"/>
<node id="7303" version="1" timestamp="2011-11-11T00:11:11Z" lat="62" lon="62"/>
<node id="7313" version="1" timestamp="2011-11-11T00:11:11Z" lat="62" lon="62"/>
<node id="7314" version="1" timestamp="2011-11-11T00:11:11Z" lat="62" lon="60"/>
<way id="7301" version="1" timestamp="2011-11-11T00:11:11Z">
<nd ref="7301"/>
<nd ref="7302"/>
<nd ref="7303"/>
</way>
<way id="7302" version="1" timestamp="2011-11-11T00:11:11Z">
<nd ref="7313"/> <!-- same coord as 7303 -->
<nd ref="7314"/>
<nd ref="7301"/>
</way>
<relation id="7301" version="1" timestamp="2011-11-11T00:11:11Z">
<member type="way" ref="7301" role="outer"/>
<member type="way" ref="7302" role="outer"/>
<tag k="name" v="rel 7301"/>
<tag k="landuse" v="park"/>
<tag k="type" v="multipolygon"/>
</relation>

<!-- test that single node ways or incomplete polygons are _not_ inserted -->
<node id="30001" version="1" timestamp="2011-11-11T00:11:11Z" lat="47" lon="80"/>
<node id="30002" version="1" timestamp="2011-11-11T00:11:11Z" lat="47" lon="80"/>
Expand Down

0 comments on commit ff6207d

Please sign in to comment.