def test_imported_landusage(): """Multipolygon relation is inserted""" t.assert_cached_node(1001, (13, 47.5)) landusage_1001 = t.query_row(t.db_conf, 'osm_landusages', -1001) # point in polygon assert landusage_1001['geometry'].intersects(t.merc_point(13.4, 47.5)) # hole in multipolygon relation assert not landusage_1001['geometry'].intersects(t.merc_point(14.75, 47.75))
def test_duplicate_ids_1(): """Points/lines/polygons with same ID are inserted.""" node = t.query_row(t.db_conf, 'osm_all', 31101) assert node['geometry'].type == 'Point', node['geometry'].type assert node['tags'] == {'amenity': 'cafe'} assert node['geometry'].distance(t.merc_point(80, 47)) < 1 ways = t.query_row(t.db_conf, 'osm_all', -31101) ways.sort(key=lambda x: x['geometry'].type) assert ways[0]['geometry'].type == 'LineString', ways[0]['geometry'].type assert ways[0]['tags'] == {'landuse': 'park', 'highway': 'secondary'} assert ways[1]['geometry'].type == 'Polygon', ways[1]['geometry'].type assert ways[1]['tags'] == {'landuse': 'park', 'highway': 'secondary'} rel = t.query_row(t.db_conf, 'osm_all', RELOFFSET-31101L) assert rel['geometry'].type == 'Polygon', rel['geometry'].type assert rel['tags'] == {'building': 'yes'}
def test_duplicate_ids_1(): """Points/lines/polygons with same ID are inserted.""" node = t.query_row(t.db_conf, 'osm_all', 31101) assert node['geometry'].type == 'Point', node['geometry'].type assert node['tags'] == {'amenity': 'cafe'} assert node['geometry'].distance(t.merc_point(80, 47)) < 1 ways = t.query_row(t.db_conf, 'osm_all', -31101) ways.sort(key=lambda x: x['geometry'].type) assert ways[0]['geometry'].type == 'LineString', ways[0]['geometry'].type assert ways[0]['tags'] == {'landuse': 'park', 'highway': 'secondary'} assert ways[1]['geometry'].type == 'Polygon', ways[1]['geometry'].type assert ways[1]['tags'] == {'landuse': 'park', 'highway': 'secondary'} rel = t.query_row(t.db_conf, 'osm_all', RELOFFSET - 31101L) assert rel['geometry'].type == 'Polygon', rel['geometry'].type assert rel['tags'] == {'building': 'yes'}
def test_updated_landusage(): """Multipolygon relation was modified""" t.assert_cached_node(1001, (13.5, 47.5)) landusage_1001 = t.query_row(t.db_conf, 'osm_landusages', -1001) # point not in polygon after update assert not landusage_1001['geometry'].intersects(t.merc_point(13.4, 47.5))