@@ -1317,14 +1317,14 @@ cdef class PrimeMeridian(_CRSParts):
1317
1317
1318
1318
1319
1319
_DATUM_TYPE_MAP = {
1320
- " GeodeticReferenceFrame " : " Geodetic Reference Frame" ,
1321
- " DynamicGeodeticReferenceFrame " : " Dynamic Geodetic Reference Frame" ,
1322
- " VerticalReferenceFrame " : " Vertical Reference Frame" ,
1323
- " DynamicVerticalReferenceFrame " : " Dynamic Vertical Reference Frame" ,
1324
- " DatumEnsemble " : " Datum Ensemble" ,
1325
- " TemporalDatum " : " Temporal Datum" ,
1326
- " EngineeringDatum " : " Engineering Datum" ,
1327
- " ParametricDatum " : " Parametric Datum" ,
1320
+ PJ_TYPE_GEODETIC_REFERENCE_FRAME : " Geodetic Reference Frame" ,
1321
+ PJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME : " Dynamic Geodetic Reference Frame" ,
1322
+ PJ_TYPE_VERTICAL_REFERENCE_FRAME : " Vertical Reference Frame" ,
1323
+ PJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME : " Dynamic Vertical Reference Frame" ,
1324
+ PJ_TYPE_DATUM_ENSEMBLE : " Datum Ensemble" ,
1325
+ PJ_TYPE_TEMPORAL_DATUM : " Temporal Datum" ,
1326
+ PJ_TYPE_ENGINEERING_DATUM : " Engineering Datum" ,
1327
+ PJ_TYPE_PARAMETRIC_DATUM : " Parametric Datum" ,
1328
1328
}
1329
1329
1330
1330
_PJ_DATUM_TYPE_MAP = {
@@ -1338,19 +1338,6 @@ _PJ_DATUM_TYPE_MAP = {
1338
1338
}
1339
1339
1340
1340
1341
- cdef _get_datum_type_name(PJ_CONTEXT* context, PJ* datum):
1342
- # workaround: https://github.com/OSGeo/PROJ/pull/2274
1343
- cdef const char * proj_json_string = proj_as_projjson(
1344
- context,
1345
- datum,
1346
- NULL ,
1347
- )
1348
- if proj_json_string == NULL :
1349
- return None
1350
- json_dict = json.loads(cstrdecode(proj_json_string))
1351
- return _DATUM_TYPE_MAP.get(json_dict[" type" ])
1352
-
1353
-
1354
1341
cdef class Datum(_CRSParts):
1355
1342
"""
1356
1343
.. versionadded:: 2.2.0
@@ -1378,7 +1365,7 @@ cdef class Datum(_CRSParts):
1378
1365
datum.context = context
1379
1366
datum.projobj = datum_pj
1380
1367
datum._set_base_info()
1381
- datum.type_name = _get_datum_type_name (datum.context, datum. projobj)
1368
+ datum.type_name = _DATUM_TYPE_MAP[proj_get_type (datum.projobj)]
1382
1369
return datum
1383
1370
1384
1371
@staticmethod
@@ -1458,7 +1445,7 @@ cdef class Datum(_CRSParts):
1458
1445
)
1459
1446
if (
1460
1447
datum_pj == NULL or
1461
- _get_datum_type_name(context, datum_pj) is None
1448
+ proj_get_type( datum_pj) not in _DATUM_TYPE_MAP
1462
1449
):
1463
1450
proj_destroy(datum_pj)
1464
1451
proj_context_destroy(context)
0 commit comments