diff --git a/pyproj/database.pyx b/pyproj/database.pyx index 3af1a80e6..f8c0bd07f 100644 --- a/pyproj/database.pyx +++ b/pyproj/database.pyx @@ -514,6 +514,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 cc47e7678..3f00f5df0 100644 --- a/test/test_database.py +++ b/test/test_database.py @@ -272,6 +272,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" @@ -304,6 +308,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)