从OGR PostGIS连接读取图层时,可以获取该图层的SpatialReference,但是可以获取EPSG值吗?是否有任何文档?
例如:
lyr = conn.GetLayerByName(tbl) # Where conn is OGR PG connection
srs = ly.GetSpatialRef()
print srs
返回值:
PROJCS["OSGB 1936 / British National Grid",
GEOGCS["OSGB 1936",
DATUM["OSGB_1936",
SPHEROID["Airy 1830",6377563.396,299.3249646,
AUTHORITY["EPSG","7001"]],
AUTHORITY["EPSG","6277"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.01745329251994328,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4277"]],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",49],
PARAMETER["central_meridian",-2],
PARAMETER["scale_factor",0.9996012717],
PARAMETER["false_easting",400000],
PARAMETER["false_northing",-100000],
AUTHORITY["EPSG","27700"],
AXIS["Easting",EAST],
AXIS["Northing",NORTH]]
那么,如何获得投影的EPSG值?例如:
srs.GetEPSG()
print srs
27700
我试过了srs.GetAttrValue('AUTHORITY')
,但这只是回报'EPSG'
。
I've tried srs.GetAttrValue('AUTHORITY'), but this just returns 'EPSG'
哪个是正确的。EPSG是权威机构