diff --git a/pyproj/database.pyx b/pyproj/database.pyx index 8a53131f5..d04fae5a5 100644 --- a/pyproj/database.pyx +++ b/pyproj/database.pyx @@ -520,6 +520,9 @@ def query_geodetic_crs_from_datum( list[CRS] """ + if pj_type is not None and not isinstance(pj_type, PJType): + pj_type = PJType.create(pj_type) + cdef const char* c_crs_type = NULL if pj_type is None: pass diff --git a/test/test_database.py b/test/test_database.py index 551e8c5b5..c1bfa5bd1 100644 --- a/test/test_database.py +++ b/test/test_database.py @@ -285,6 +285,10 @@ def test_get_database_metadata__invalid(): def test_query_geodetic_crs_from_datum(): + crss = query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", "GEOCENTRIC_CRS") + assert len(crss) == 1 + assert crss[0].to_authority()[1] == "6317" + crss = query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", PJType.GEOCENTRIC_CRS) assert len(crss) == 1 assert crss[0].to_authority()[1] == "6317" @@ -317,6 +321,9 @@ def test_query_geodetic_crs_from_datum_invalid(): with pytest.raises(ValueError): query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", PJType.PROJECTED_CRS) + with pytest.raises(ValueError): + query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", "invalid string") + with pytest.raises(TypeError): query_geodetic_crs_from_datum("EPSG", "EPSG", None)