Esempio n. 1
0
def test_query_crs_info(auth, pj_type, deprecated):
    crs_info_list = query_crs_info(auth, pj_type, allow_deprecated=deprecated)
    assert crs_info_list
    any_deprecated = any(crs_info.deprecated for crs_info in crs_info_list)
    if deprecated:
        assert any_deprecated
    else:
        assert not any_deprecated
Esempio n. 2
0
def test_query_crs_info__aoi_contains():
    aoi = BBox(west=-40, south=50, east=-20, north=70)
    crs_info_list = query_crs_info(
        auth_name="IGNF",
        pj_types=[PJType.PROJECTED_CRS],
        area_of_interest=AreaOfInterest(
            west_lon_degree=aoi.west,
            south_lat_degree=aoi.south,
            east_lon_degree=aoi.east,
            north_lat_degree=aoi.north,
        ),
        contains=True,
    )
    assert crs_info_list
    for crs_info in crs_info_list:
        assert BBox(*crs_info.area_of_use.bounds).contains(aoi)
        assert crs_info.auth_name == "IGNF"
        assert crs_info.type == PJType.PROJECTED_CRS
        assert not crs_info.deprecated
Esempio n. 3
0
def test_query_crs_info__aoi():
    aoi = BBox(west=-40, south=50, east=-20, north=70)
    crs_info_list = query_crs_info(
        auth_name="ESRI",
        pj_types=PJType.PROJECTED_CRS,
        area_of_interest=AreaOfInterest(
            west_lon_degree=aoi.west,
            south_lat_degree=aoi.south,
            east_lon_degree=aoi.east,
            north_lat_degree=aoi.north,
        ),
    )
    assert crs_info_list
    not_contains_present = False
    for crs_info in crs_info_list:
        bbox = BBox(*crs_info.area_of_use.bounds)
        assert bbox.intersects(aoi)
        assert crs_info.auth_name == "ESRI"
        assert crs_info.type == PJType.PROJECTED_CRS
        assert not crs_info.deprecated
        if not bbox.contains(aoi):
            not_contains_present = True
    assert not_contains_present
Esempio n. 4
0
def test_query_crs_info__invalid_code():
    with pytest.raises(ValueError):
        query_crs_info("ITRF", "frank")
Esempio n. 5
0
def test_query_crs_info__invalid_auth():
    with pytest.raises(TypeError):
        query_crs_info(123, PJType.BOUND_CRS)
Esempio n. 6
0
def test_query_crs_info__empty(auth, pj_type):
    assert not query_crs_info(auth, pj_type)
Esempio n. 7
0
def get_projections():
    supported_proj = database.query_crs_info()
    return {i[2]: f"{i[0]}:{i[1]}" for i in supported_proj}