mirror of
https://github.com/wassname/PyCRS.git
synced 2026-09-12 12:10:50 +08:00
Colleted esri_wkt and esri_wkt parsing into one function which works, and added find() methods in each mod for easier name-to-obj parsing
This commit is contained in:
@@ -1,4 +1,26 @@
|
||||
|
||||
|
||||
def find(datumname, crstype, strict=False):
|
||||
if not strict:
|
||||
datumname = datumname.lower()
|
||||
for itemname,item in globals().items():
|
||||
if itemname.startswith("_"):
|
||||
continue
|
||||
try:
|
||||
if hasattr(item, crstype):
|
||||
itemname = getattr(item, crstype)
|
||||
if not strict:
|
||||
itemname = itemname.lower()
|
||||
if datumname == itemname:
|
||||
return item
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
|
||||
|
||||
class WGS84:
|
||||
proj4 = "WGS84"
|
||||
ogc_wkt = "WGS_1984"
|
||||
@@ -31,6 +53,14 @@ class NAD27:
|
||||
ellipsdef = "" # ellipsoids...
|
||||
to_wgs84 = None
|
||||
|
||||
class SphereArcInfo:
|
||||
proj4 = "" # no name
|
||||
ogc_wkt = "D_Sphere_ARC_INFO" # confirmed but odd that uses D_
|
||||
esri_wkt = "D_Sphere_ARC_INFO"
|
||||
|
||||
semimaj_ax = 6370997.0
|
||||
inv_flat = 0.0
|
||||
|
||||
class Unknown:
|
||||
proj4 = "unknown" # no datum name, just ellips + towgs84 params...
|
||||
ogc_wkt = "Unknown"
|
||||
|
||||
Reference in New Issue
Block a user