cartodb-4.42/lib/importer/misc/srid_from_gdal.py
2024-04-06 05:25:13 +00:00

12 lines
231 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))