예제 #1
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)
예제 #2
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)
예제 #3
0
def test_split_outer_multipolygon_way_2():
    """Splitted outer way of multipolygon was inserted"""
    data = t.cache_query(ways=[15001, 15002], deps=True)
    assert data['ways']['15001']['relations'].keys() == ['15001']
    assert data['ways']['15002']['relations'].keys() == ['15001']

    assert t.query_row(t.db_conf, 'osm_landusages', 15001) == None
    park_15001 = t.query_row(t.db_conf, 'osm_landusages', -15001)
    assert park_15001['type'] == 'park'
    t.assert_almost_equal(park_15001['geometry'].area, 9816216452, -1)
    assert t.query_row(t.db_conf, 'osm_roads', 15002)['type'] == 'residential'
예제 #4
0
def test_split_outer_multipolygon_way_2():
    """Splitted outer way of multipolygon was inserted"""
    data = t.cache_query(ways=[15001, 15002], deps=True)
    assert data['ways']['15001']['relations'].keys() == ['15001']
    assert data['ways']['15002']['relations'].keys() == ['15001']

    assert t.query_row(t.db_conf, 'osm_landusages', 15001) == None
    park_15001 = t.query_row(t.db_conf, 'osm_landusages', -15001)
    assert park_15001['type'] == 'park'
    t.assert_almost_equal(park_15001['geometry'].area, 9816216452, -1)
    assert t.query_row(t.db_conf, 'osm_roads', 15002)['type'] == 'residential'
예제 #5
0
def test_merge_outer_multipolygon_way_2():
    """Merged outer way of multipolygon was inserted"""
    data = t.cache_query(ways=[16001, 16002], deps=True)
    assert data['ways']['16001']['relations'].keys() == ['16001']
    assert data['ways']['16002'] == None

    data = t.cache_query(relations=[16001], full=True)
    assert sorted(data['relations']['16001']['ways'].keys()) == ['16001', '16011']

    assert t.query_row(t.db_conf, 'osm_landusages', 16001) == None
    park_16001 = t.query_row(t.db_conf, 'osm_landusages', -16001)
    assert park_16001['type'] == 'park'
    t.assert_almost_equal(park_16001['geometry'].area, 12779350582, -1)
    assert t.query_row(t.db_conf, 'osm_roads', 16002) == None
예제 #6
0
def test_merge_outer_multipolygon_way_2():
    """Merged outer way of multipolygon was inserted"""
    data = t.cache_query(ways=[16001, 16002], deps=True)
    assert data['ways']['16001']['relations'].keys() == ['16001']
    assert data['ways']['16002'] == None

    data = t.cache_query(relations=[16001], full=True)
    assert sorted(data['relations']['16001']['ways'].keys()) == ['16001', '16011']

    assert t.query_row(t.db_conf, 'osm_landusages', 16001) == None
    park_16001 = t.query_row(t.db_conf, 'osm_landusages', -16001)
    assert park_16001['type'] == 'park'
    t.assert_almost_equal(park_16001['geometry'].area, 12779350582, -1)
    assert t.query_row(t.db_conf, 'osm_roads', 16002) == None
예제 #7
0
def test_merge_outer_multipolygon_way_1():
    """Splitted outer way of multipolygon was inserted."""
    park_16001 = t.query_row(t.db_conf, 'osm_landusages', -16001)
    assert park_16001['type'] == 'park'
    t.assert_almost_equal(park_16001['geometry'].area, 12779350582, -1)
    assert t.query_row(t.db_conf, 'osm_roads', 16002)['type'] == 'residential'
예제 #8
0
def test_split_outer_multipolygon_way_1():
    """Single outer way of multipolygon was inserted."""
    park_15001 = t.query_row(t.db_conf, 'osm_landusages', -15001)
    assert park_15001['type'] == 'park'
    t.assert_almost_equal(park_15001['geometry'].area, 9816216452, -1)
    assert t.query_row(t.db_conf, 'osm_roads', 15002) == None
예제 #9
0
def test_updated_way2():
    """All nodes of straightened way are updated."""
    road =  t.query_row(t.db_conf, 'osm_roads', 60000)
    # new length 0.1 degree
    t.assert_almost_equal(road['geometry'].length, 20037508.342789244/180.0/10.0)
예제 #10
0
def test_updated_nodes1():
    """Zig-Zag line is inserted."""
    road =  t.query_row(t.db_conf, 'osm_roads', 60000)
    t.assert_almost_equal(road['geometry'].length, 14035.61150207768)
예제 #11
0
def test_merge_outer_multipolygon_way_1():
    """Splitted outer way of multipolygon was inserted."""
    park_16001 = t.query_row(t.db_conf, 'osm_landusages', -16001)
    assert park_16001['type'] == 'park'
    t.assert_almost_equal(park_16001['geometry'].area, 12779350582, -1)
    assert t.query_row(t.db_conf, 'osm_roads', 16002)['type'] == 'residential'
예제 #12
0
def test_split_outer_multipolygon_way_1():
    """Single outer way of multipolygon was inserted."""
    park_15001 = t.query_row(t.db_conf, 'osm_landusages', -15001)
    assert park_15001['type'] == 'park'
    t.assert_almost_equal(park_15001['geometry'].area, 9816216452, -1)
    assert t.query_row(t.db_conf, 'osm_roads', 15002) == None
예제 #13
0
def test_updated_way2():
    """All nodes of straightened way are updated."""
    road =  t.query_row(t.db_conf, 'osm_roads', 60000)
    # new length 0.1 degree
    t.assert_almost_equal(road['geometry'].length, 20037508.342789244/180.0/10.0)
예제 #14
0
def test_updated_nodes1():
    """Zig-Zag line is inserted."""
    road =  t.query_row(t.db_conf, 'osm_roads', 60000)
    t.assert_almost_equal(road['geometry'].length, 14035.61150207768)