예제 #1
0
def test_datum_from_name__auth_type(auth_name):
    dd = Datum.from_name(
        "WGS_1984_Geoid",
        auth_name=auth_name,
        datum_type=DatumType.VERTICAL_REFERENCE_FRAME,
    )
    assert dd.name == "WGS_1984_Geoid"
예제 #2
0
def test_datum__from_epsg():
    if PROJ_GTE_82:
        datum_wkt = (
            'ENSEMBLE["World Geodetic System 1984 ensemble",'
            'MEMBER["World Geodetic System 1984 (Transit)",ID["EPSG",1166]],'
            'MEMBER["World Geodetic System 1984 (G730)",ID["EPSG",1152]],'
            'MEMBER["World Geodetic System 1984 (G873)",ID["EPSG",1153]],'
            'MEMBER["World Geodetic System 1984 (G1150)",ID["EPSG",1154]],'
            'MEMBER["World Geodetic System 1984 (G1674)",ID["EPSG",1155]],'
            'MEMBER["World Geodetic System 1984 (G1762)",ID["EPSG",1156]],'
            'MEMBER["World Geodetic System 1984 (G2139)",ID["EPSG",1309]],'
            'ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],'
            'ID["EPSG",7030]],ENSEMBLEACCURACY[2.0],ID["EPSG",6326]]'
        )
    else:
        datum_wkt = (
            'ENSEMBLE["World Geodetic System 1984 ensemble",'
            'MEMBER["World Geodetic System 1984 (Transit)",ID["EPSG",1166]],'
            'MEMBER["World Geodetic System 1984 (G730)",ID["EPSG",1152]],'
            'MEMBER["World Geodetic System 1984 (G873)",ID["EPSG",1153]],'
            'MEMBER["World Geodetic System 1984 (G1150)",ID["EPSG",1154]],'
            'MEMBER["World Geodetic System 1984 (G1674)",ID["EPSG",1155]],'
            'MEMBER["World Geodetic System 1984 (G1762)",ID["EPSG",1156]],'
            'ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],'
            'ID["EPSG",7030]],ENSEMBLEACCURACY[2.0],ID["EPSG",6326]]'
        )
    assert Datum.from_epsg("6326").to_wkt() == datum_wkt
예제 #3
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum__from_string(input_str):
    dd = Datum.from_string(input_str)
    if PROJ_GTE_8:
        assert dd.name == "World Geodetic System 1984 ensemble"
        assert dd.type_name == "Datum Ensemble"
    else:
        assert dd.name == "World Geodetic System 1984"
        assert dd.type_name == "Geodetic Reference Frame"
예제 #4
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum__from_authority__invalid():
    with pytest.raises(CRSError, match="Invalid authority"):
        Datum.from_authority("BOB", 1)
예제 #5
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum__from_epsg__invalid():
    with pytest.raises(CRSError, match="Invalid authority"):
        Datum.from_epsg(1)
예제 #6
0
def test_datum__from_epsg__empty():
    Datum.from_epsg(1) is None
예제 #7
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum__from_name__invalid_type():
    with pytest.raises(CRSError, match="Invalid datum name: WGS84"):
        Datum.from_name("WGS84", datum_type="VERTICAL_REFERENCE_FRAME")
예제 #8
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum_from_name__any_type():
    dd = Datum.from_name("WGS_1984_Geoid")
    assert dd.name == "WGS_1984_Geoid"
    assert dd.type_name == "Vertical Reference Frame"
예제 #9
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum__from_string__type_name(input_str, type_name):
    dd = Datum.from_string(input_str)
    assert dd.type_name == type_name
예제 #10
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum_equals():
    datum = Datum.from_epsg(6326)
    assert datum == 6326
    assert not datum != 6326
    assert datum != "invalid"
예제 #11
0
def test_datum__from_string__invalid():
    with pytest.raises(CRSError, match="Invalid datum string"):
        Datum.from_string("3-598y5-98y")
    with pytest.raises(CRSError, match="Invalid datum string"):
        Datum.from_string("urn:ogc:def:ellipsoid:EPSG::7001")
예제 #12
0
def test_datum__from_string():
    dd = Datum.from_string("urn:ogc:def:datum:EPSG::6326")
    assert dd.name == "World Geodetic System 1984"
예제 #13
0
def test_datum__from_epsg():
    assert Datum.from_epsg("6326").to_wkt() == (
        'DATUM["World Geodetic System 1984",'
        'ELLIPSOID["WGS 84",6378137,298.257223563,'
        'LENGTHUNIT["metre",1]],ID["EPSG",6326]]')
예제 #14
0
def test_datum__from_string(input_str):
    dd = Datum.from_string(input_str)
    assert dd.name == "World Geodetic System 1984"
    assert dd.type_name == "Geodetic Reference Frame"
예제 #15
0
def test_datum__from_string(input_str):
    dd = Datum.from_string(input_str)
    assert dd.name == "World Geodetic System 1984"
예제 #16
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum__from_user_input(user_input):
    assert Datum.from_user_input(user_input) == Datum.from_epsg(6326)
예제 #17
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum__from_user_input__invalid():
    with pytest.raises(CRSError, match="Invalid datum"):
        Datum.from_user_input({})
예제 #18
0
def test_datum__from_authority():
    dt = Datum.from_authority("EPSG", 6326)
    assert dt.name == "World Geodetic System 1984 ensemble"
예제 #19
0
def test_datum__from_string(input_str):
    dd = Datum.from_string(input_str)
    assert dd.name == "World Geodetic System 1984 ensemble"
    assert dd.type_name == "Datum Ensemble"
예제 #20
0
def test_datum__from_name(input_name):
    dd = Datum.from_name(input_name)
    assert dd.name == "World Geodetic System 1984 ensemble"
예제 #21
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum__from_name(input_name):
    dd = Datum.from_name(input_name)
    assert dd.name == get_wgs84_datum_name()
예제 #22
0
파일: test_crs.py 프로젝트: djhoese/pyproj
        Datum.from_epsg(1)


def test_datum__from_authority__invalid():
    with pytest.raises(CRSError, match="Invalid authority"):
        Datum.from_authority("BOB", 1)


@pytest.mark.parametrize(
    "user_input",
    [
        6326,
        ("EPSG", 6326),
        "urn:ogc:def:ensemble:EPSG::6326"
        if PROJ_GTE_8 else "urn:ogc:def:datum:EPSG::6326",
        Datum.from_epsg(6326),
        Datum.from_epsg(6326).to_json_dict(),
        "World Geodetic System 1984",
    ],
)
def test_datum__from_user_input(user_input):
    assert Datum.from_user_input(user_input) == Datum.from_epsg(6326)


def test_datum__from_user_input__invalid():
    with pytest.raises(CRSError, match="Invalid datum"):
        Datum.from_user_input({})


def test_prime_meridian__from_epsg():
    assert PrimeMeridian.from_epsg(8903).to_wkt() == (
예제 #23
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum__from_name__invalid(invalid_str):
    with pytest.raises(CRSError, match="Invalid datum name:"):
        Datum.from_name(invalid_str)
예제 #24
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum__from_authority():
    dt = Datum.from_authority("EPSG", 6326)
    assert dt.name == get_wgs84_datum_name()
예제 #25
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_datum__from_string__invalid(invalid_str):
    with pytest.raises(CRSError, match="Invalid datum string"):
        Datum.from_string(invalid_str)
예제 #26
0
def test_datum__from_epsg():
    assert Datum.from_epsg("6326").to_wkt() == (
        'DATUM["World Geodetic System 1984",'
        'ELLIPSOID["WGS 84",6378137,298.257223563,'
        'LENGTHUNIT["metre",1]],ID["EPSG",6326]]'
    )