Esempio n. 1
0
def test_center():
    ul = some_raster.corner('ul').get_shape(some_raster.crs)
    br = some_raster.corner('br').get_shape(some_raster.crs)
    expected_center = Point((ul.x + br.x) / 2, (ul.y + br.y) / 2)
    expected_center_vector = GeoVector(expected_center, some_raster.crs)

    assert expected_center_vector.almost_equals(some_raster.center())
Esempio n. 2
0
def test_almost_equals():
    some_crs = CRS({'init': 'epsg:32630'})
    another_crs = CRS({'init': 'epsg:32631'})

    pt = GeoVector(Point(0, 0), some_crs)

    similar = GeoVector(Point(0, 0.00000000001), some_crs)
    assert pt.almost_equals(similar.reproject(another_crs))

    different = GeoVector(Point(0, 1), some_crs)
    assert pt != different