def test_to_crs_CRS(): # should just return same object crs = CRS.from_epsg(4326) assert convert.to_crs(crs) is crs
def test_to_crs_OSR(ex_crs): from stems.gis import utils osr_crs = utils.crs2osr(ex_crs) assert convert.to_crs(osr_crs) == ex_crs
def test_to_crs_dict(): crs = CRS.from_epsg(4326) assert convert.to_crs(dict(crs)) == crs
def test_to_crs_str_error(): bad = '+proj=wrong' msg = 'Could not interpret CRS.*WKT or Proj4' with pytest.raises(rasterio.errors.CRSError, match=msg): convert.to_crs(convert.to_crs(bad))
def test_to_crs_str(ex_crs): # proj4 assert convert.to_crs(ex_crs.to_string()) == ex_crs # wkt assert convert.to_crs(ex_crs.wkt) == ex_crs
def test_to_crs_int(code): assert convert.to_crs(code) == CRS.from_epsg(code)