예제 #1
0
def test_colorado_montana_overlap_area():
    ## Test get_overlap_area() with two non-adjecent state polygon objects

    with open('./data/colorado.json', 'r') as f_colorado:
        d_colorado = json.load(f_colorado)
        json_colorado = json.dumps(d_colorado)

        with open('./data/montana.json', 'r') as f_montana:
            d_montana = json.load(f_montana)
            json_montana = json.dumps(d_montana)

        result = check_polygon_intersection(json_colorado, json_montana)
        assert (result == INTERSECTION_FALSE) == True
예제 #2
0
def test_colorado_wyoming_overlap_area():
    ## Test get_overlap_area() with two adjecent state polygon objects

    with open('./data/colorado.json', 'r') as f_colorado:
        d_colorado = json.load(f_colorado)
        json_colorado = json.dumps(d_colorado)

        with open('./data/wyoming.json', 'r') as f_wyoming:
            d_wyoming = json.load(f_wyoming)
            json_wyoming = json.dumps(d_wyoming)

        result = check_polygon_intersection(json_colorado, json_wyoming)
        assert (result == INTERSECTION_TRUE) == True
예제 #3
0
def test_exception_on_invalid_geojson():
    ## Test check_polygon_intersection() for raise(InvalidGeoJson) on invalid GeoJSON format
    with pytest.raises(InvalidGeoJson):
        result = check_polygon_intersection(NON_POLY, POLY_GOOD)
예제 #4
0
def test_polygon_NON_intersection():
    ## Test check_polygon_intersection() with two polygons that do NOT intersect
    result = check_polygon_intersection(POLY_1, POLY_2)
    assert (result == INTERSECTION_FALSE) == True
예제 #5
0
def test_polygon_intersection():
    ## Test check_polygon_intersection() with two polygons that do intersect
    result = check_polygon_intersection(POLY_1, POLY_1)
    assert (result == INTERSECTION_TRUE) == True