7

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.

2 Answers 2

3

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.

0

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()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.