cartodb/lib/importer/misc/srid_from_gdal.py
2020-06-15 10:58:47 +08:00

12 lines
230 B
Python
Executable File

import sys
from osgeo import gdal, osr
f = sys.argv[1]
g = gdal.Open(f)
proj = g.GetProjection()
srs = osr.SpatialReference()
srs.ImportFromESRI([proj])
srs.AutoIdentifyEPSG()
srid = srs.GetAuthorityCode(None)
print "%s" %(srid)