Skip to content

Commit e237f2e

Browse files
committed
convert from str to PJType
1 parent 66ceda0 commit e237f2e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pyproj/database.pyx

+3
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,9 @@ def query_geodetic_crs_from_datum(
520520
list[CRS]
521521
"""
522522

523+
if pj_type is not None and not isinstance(pj_type, PJType):
524+
pj_type = PJType.create(pj_type)
525+
523526
cdef const char* c_crs_type = NULL
524527
if pj_type is None:
525528
pass

test/test_database.py

+7
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ def test_get_database_metadata__invalid():
285285

286286

287287
def test_query_geodetic_crs_from_datum():
288+
crss = query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", "GEOCENTRIC_CRS")
289+
assert len(crss) == 1
290+
assert crss[0].to_authority()[1] == "6317"
291+
288292
crss = query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", PJType.GEOCENTRIC_CRS)
289293
assert len(crss) == 1
290294
assert crss[0].to_authority()[1] == "6317"
@@ -317,6 +321,9 @@ def test_query_geodetic_crs_from_datum_invalid():
317321
with pytest.raises(ValueError):
318322
query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", PJType.PROJECTED_CRS)
319323

324+
with pytest.raises(ValueError):
325+
query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", "invalid string")
326+
320327
with pytest.raises(TypeError):
321328
query_geodetic_crs_from_datum("EPSG", "EPSG", None)
322329

0 commit comments

Comments
 (0)