Exemple #1
0
def test_partial_delete():
    """Deleted relation but nodes are still cached"""
    t.assert_cached_node(2001)
    t.assert_cached_way(2001)
    t.assert_cached_way(2002)
    assert not t.query_row(t.db_conf, 'osm_landusages', -2001)
    assert not t.query_row(t.db_conf, 'osm_landusages', 2001)
Exemple #2
0
def test_partial_delete():
    """Deleted relation but nodes are still cached"""
    t.assert_cached_node(2001)
    t.assert_cached_way(2001)
    t.assert_cached_way(2002)
    assert not t.query_row(t.db_conf, 'osm_landusages', -2001)
    assert not t.query_row(t.db_conf, 'osm_landusages', 2001)
Exemple #3
0
def test_changed_hole_tags_1():
    """Multipolygon relation with untagged hole"""
    t.assert_cached_way(14001)
    t.assert_cached_way(14011)

    assert not t.query_row(t.db_conf, 'osm_waterareas', 14011)
    assert not t.query_row(t.db_conf, 'osm_waterareas', -14011)
    assert t.query_row(t.db_conf, 'osm_landusages', -14001)['type'] == 'park'
Exemple #4
0
def test_changed_hole_tags_1():
    """Multipolygon relation with untagged hole"""
    t.assert_cached_way(14001)
    t.assert_cached_way(14011)

    assert not t.query_row(t.db_conf, 'osm_waterareas', 14011)
    assert not t.query_row(t.db_conf, 'osm_waterareas', -14011)
    assert t.query_row(t.db_conf, 'osm_landusages', -14001)['type'] == 'park'
Exemple #5
0
def test_changed_hole_tags_2():
    """Newly tagged hole is inserted"""
    t.assert_cached_way(14001)
    t.assert_cached_way(14011)

    assert t.query_row(t.db_conf, 'osm_waterareas', 14011)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_landusages', -14001)['type'] == 'park'
    t.assert_almost_equal(t.query_row(t.db_conf, 'osm_waterareas', 14011)['geometry'].area, 26672000000, -6)
    t.assert_almost_equal(t.query_row(t.db_conf, 'osm_landusages', -14001)['geometry'].area, 10373600000, -6)
Exemple #6
0
def test_changed_hole_tags_2():
    """Newly tagged hole is inserted"""
    t.assert_cached_way(14001)
    t.assert_cached_way(14011)

    assert t.query_row(t.db_conf, 'osm_waterareas', 14011)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_landusages', -14001)['type'] == 'park'
    t.assert_almost_equal(t.query_row(t.db_conf, 'osm_waterareas', 14011)['geometry'].area, 26672000000, -6)
    t.assert_almost_equal(t.query_row(t.db_conf, 'osm_landusages', -14001)['geometry'].area, 10373600000, -6)
Exemple #7
0
def test_mapped_closed_way_area_no():
    """Closed way with area=no is not stored as polygon."""
    t.assert_cached_way(20502)
    elem = t.query_row(t.db_conf, 'osm_all', -20502)
    assert elem['geometry'].type == 'LineString', elem['geometry'].type
    assert elem['tags'] == {
        'random': 'tag',
        'landuse': 'grass',
        'highway': 'pedestrian',
        'area': 'no'
    }
Exemple #8
0
def test_mapped_closed_way_area_yes():
    """Closed way with area=yes is not stored as linestring."""
    t.assert_cached_way(20501)
    elem = t.query_row(t.db_conf, 'osm_all', -20501)
    assert elem['geometry'].type == 'Polygon', elem['geometry'].type
    assert elem['tags'] == {
        'random': 'tag',
        'landuse': 'grass',
        'highway': 'pedestrian',
        'area': 'yes'
    }
def test_mapped_closed_way_without_area():
    """Closed way without area is stored as mapped (linestring and polygon)."""
    t.assert_cached_way(20601)
    elems = t.query_row(t.db_conf, 'osm_all', 20601)
    assert len(elems) == 2
    elems.sort(key=lambda x: x['geometry'].type)

    assert elems[0]['geometry'].type == 'LineString', elem['geometry'].type
    assert elems[0]['tags'] == {'random': 'tag', 'landuse': 'grass', 'highway': 'pedestrian'}
    assert elems[1]['geometry'].type == 'Polygon', elem['geometry'].type
    assert elems[1]['tags'] == {'random': 'tag', 'landuse': 'grass', 'highway': 'pedestrian'}
Exemple #10
0
def test_mapped_closed_way_without_area():
    """Closed way without area is stored as mapped (linestring and polygon)."""
    t.assert_cached_way(20601)
    elems = t.query_row(t.db_conf, 'osm_all', -20601)
    assert len(elems) == 2
    elems.sort(key=lambda x: x['geometry'].type)

    assert elems[0]['geometry'].type == 'LineString', elems[0]['geometry'].type
    assert elems[0]['tags'] == {
        'random': 'tag',
        'landuse': 'grass',
        'highway': 'pedestrian'
    }
    assert elems[1]['geometry'].type == 'Polygon', elems[1]['geometry'].type
    assert elems[1]['tags'] == {
        'random': 'tag',
        'landuse': 'grass',
        'highway': 'pedestrian'
    }
Exemple #11
0
def test_landusage_to_waterarea_1():
    """Parks inserted into landusages"""
    t.assert_cached_way(11001)
    t.assert_cached_way(12001)
    t.assert_cached_way(13001)

    assert not t.query_row(t.db_conf, 'osm_waterareas', 11001)
    assert not t.query_row(t.db_conf, 'osm_waterareas', -12001)
    assert not t.query_row(t.db_conf, 'osm_waterareas', -13001)

    assert not t.query_row(t.db_conf, 'osm_waterareas_gen0', 11001)
    assert not t.query_row(t.db_conf, 'osm_waterareas_gen0', -12001)
    assert not t.query_row(t.db_conf, 'osm_waterareas_gen0', -13001)

    assert not t.query_row(t.db_conf, 'osm_waterareas_gen1', 11001)
    assert not t.query_row(t.db_conf, 'osm_waterareas_gen1', -12001)
    assert not t.query_row(t.db_conf, 'osm_waterareas_gen1', -13001)

    assert t.query_row(t.db_conf, 'osm_landusages', 11001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages', -12001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages', -13001)['type'] == 'park'

    assert t.query_row(t.db_conf, 'osm_landusages_gen0', 11001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages_gen0', -12001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages_gen0', -13001)['type'] == 'park'

    assert t.query_row(t.db_conf, 'osm_landusages_gen1', 11001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages_gen1', -12001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages_gen1', -13001)['type'] == 'park'
Exemple #12
0
def test_landusage_to_waterarea_1():
    """Parks inserted into landusages"""
    t.assert_cached_way(11001)
    t.assert_cached_way(12001)
    t.assert_cached_way(13001)

    assert not t.query_row(t.db_conf, 'osm_waterareas', 11001)
    assert not t.query_row(t.db_conf, 'osm_waterareas', -12001)
    assert not t.query_row(t.db_conf, 'osm_waterareas', -13001)

    assert not t.query_row(t.db_conf, 'osm_waterareas_gen0', 11001)
    assert not t.query_row(t.db_conf, 'osm_waterareas_gen0', -12001)
    assert not t.query_row(t.db_conf, 'osm_waterareas_gen0', -13001)

    assert not t.query_row(t.db_conf, 'osm_waterareas_gen1', 11001)
    assert not t.query_row(t.db_conf, 'osm_waterareas_gen1', -12001)
    assert not t.query_row(t.db_conf, 'osm_waterareas_gen1', -13001)

    assert t.query_row(t.db_conf, 'osm_landusages', 11001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages', -12001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages', -13001)['type'] == 'park'

    assert t.query_row(t.db_conf, 'osm_landusages_gen0', 11001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages_gen0', -12001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages_gen0', -13001)['type'] == 'park'

    assert t.query_row(t.db_conf, 'osm_landusages_gen1', 11001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages_gen1', -12001)['type'] == 'park'
    assert t.query_row(t.db_conf, 'osm_landusages_gen1', -13001)['type'] == 'park'
Exemple #13
0
def test_landusage_to_waterarea_2():
    """Parks converted to water moved from landusages to waterareas"""
    t.assert_cached_way(11001)
    t.assert_cached_way(12001)
    t.assert_cached_way(13001)

    assert not t.query_row(t.db_conf, 'osm_landusages', 11001)
    assert not t.query_row(t.db_conf, 'osm_landusages', -12001)
    assert not t.query_row(t.db_conf, 'osm_landusages', -13001)

    assert not t.query_row(t.db_conf, 'osm_landusages_gen0', 11001)
    assert not t.query_row(t.db_conf, 'osm_landusages_gen0', -12001)
    assert not t.query_row(t.db_conf, 'osm_landusages_gen0', -13001)

    assert not t.query_row(t.db_conf, 'osm_landusages_gen1', 11001)
    assert not t.query_row(t.db_conf, 'osm_landusages_gen1', -12001)
    assert not t.query_row(t.db_conf, 'osm_landusages_gen1', -13001)

    assert t.query_row(t.db_conf, 'osm_waterareas', 11001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas', -12001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas', -13001)['type'] == 'water'

    assert t.query_row(t.db_conf, 'osm_waterareas_gen0', 11001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas_gen0', -12001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas_gen0', -13001)['type'] == 'water'

    assert t.query_row(t.db_conf, 'osm_waterareas_gen1', 11001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas_gen1', -12001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas_gen1', -13001)['type'] == 'water'
Exemple #14
0
def test_landusage_to_waterarea_2():
    """Parks converted to water moved from landusages to waterareas"""
    t.assert_cached_way(11001)
    t.assert_cached_way(12001)
    t.assert_cached_way(13001)

    assert not t.query_row(t.db_conf, 'osm_landusages', 11001)
    assert not t.query_row(t.db_conf, 'osm_landusages', -12001)
    assert not t.query_row(t.db_conf, 'osm_landusages', -13001)

    assert not t.query_row(t.db_conf, 'osm_landusages_gen0', 11001)
    assert not t.query_row(t.db_conf, 'osm_landusages_gen0', -12001)
    assert not t.query_row(t.db_conf, 'osm_landusages_gen0', -13001)

    assert not t.query_row(t.db_conf, 'osm_landusages_gen1', 11001)
    assert not t.query_row(t.db_conf, 'osm_landusages_gen1', -12001)
    assert not t.query_row(t.db_conf, 'osm_landusages_gen1', -13001)

    assert t.query_row(t.db_conf, 'osm_waterareas', 11001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas', -12001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas', -13001)['type'] == 'water'

    assert t.query_row(t.db_conf, 'osm_waterareas_gen0', 11001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas_gen0', -12001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas_gen0', -13001)['type'] == 'water'

    assert t.query_row(t.db_conf, 'osm_waterareas_gen1', 11001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas_gen1', -12001)['type'] == 'water'
    assert t.query_row(t.db_conf, 'osm_waterareas_gen1', -13001)['type'] == 'water'
def test_non_mapped_way_is_missing():
    """Way without mapped tags is missing."""
    t.assert_cached_way(20101)
    assert not t.query_row(t.db_conf, 'osm_all', 20101)
    t.assert_cached_way(20102)
    assert not t.query_row(t.db_conf, 'osm_all', 20102)
    t.assert_cached_way(20103)
    assert not t.query_row(t.db_conf, 'osm_all', 20103)
Exemple #16
0
def test_non_mapped_way_is_missing():
    """Way without mapped tags is missing."""
    t.assert_cached_way(20101)
    assert not t.query_row(t.db_conf, 'osm_all', 20101)
    t.assert_cached_way(20102)
    assert not t.query_row(t.db_conf, 'osm_all', 20102)
    t.assert_cached_way(20103)
    assert not t.query_row(t.db_conf, 'osm_all', 20103)
def test_mapped_closed_way_area_no():
    """Closed way with area=no is not stored as polygon."""
    t.assert_cached_way(20502)
    elem = t.query_row(t.db_conf, 'osm_all', 20502)
    assert elem['geometry'].type == 'LineString', elem['geometry'].type
    assert elem['tags'] == {'random': 'tag', 'landuse': 'grass', 'highway': 'pedestrian', 'area': 'no'}
Exemple #18
0
def test_mapped_way():
    """Way is stored with all tags."""
    t.assert_cached_way(20201)
    highway = t.query_row(t.db_conf, 'osm_all', -20201)
    assert highway['tags'] == {'random': 'tag', 'highway': 'yes'}
Exemple #19
0
def test_non_mapped_closed_way_is_missing():
    """Closed way without mapped tags is missing."""
    t.assert_cached_way(20301)
    assert not t.query_row(t.db_conf, 'osm_all', -20301)
Exemple #20
0
def test_mapped_closed_way():
    """Closed way is stored with all tags."""
    t.assert_cached_way(20401)
    building = t.query_row(t.db_conf, 'osm_all', -20401)
    assert building['tags'] == {'random': 'tag', 'building': 'yes'}
def test_mapped_way():
    """Way is stored with all tags."""
    t.assert_cached_way(20201)
    highway = t.query_row(t.db_conf, 'osm_all', 20201)
    assert highway['tags'] == {'random': 'tag', 'highway': 'yes'}
def test_non_mapped_closed_way_is_missing():
    """Closed way without mapped tags is missing."""
    t.assert_cached_way(20301)
    assert not t.query_row(t.db_conf, 'osm_all', 20301)
def test_mapped_closed_way_area_yes():
    """Closed way with area=yes is not stored as linestring."""
    t.assert_cached_way(20501)
    elem = t.query_row(t.db_conf, 'osm_all', 20501)
    assert elem['geometry'].type == 'Polygon', elem['geometry'].type
    assert elem['tags'] == {'random': 'tag', 'landuse': 'grass', 'highway': 'pedestrian', 'area': 'yes'}
def test_mapped_closed_way():
    """Closed way is stored with all tags."""
    t.assert_cached_way(20401)
    building = t.query_row(t.db_conf, 'osm_all', 20401)
    assert building['tags'] == {'random': 'tag', 'building': 'yes'}