Is it possible to get the EPSG code of a shapefile with ogrinfo
?
I know I can get layers SRS WKT with::
ogrinfo -so -al stands1.shp
but I am looking for the EPSG code.
You can get the EPSG code only if the software has written it into the WKT definition of the .prj file.
Using gdalsrsinfo
on the .prj file also does not offer the information you want. Mabe because there are some EPSG codes that have the same proj definition, but different names.
Mike Toews has a good example that can do this using the OGR python bindings on overflow here.
It centers around
osr.SpatialReference(srsWkt).AutoIdentifyEPSG()