Python should have a standalone GIS library focused solely on coordinate reference system metadata. That is, a library focused on the various formats used to store and represent crs definitions, including OGC WKT, ESRI WKT, Proj4, and various short-codes defined by organizations like EPSG, ESRI, and SR-ORG. Correctly parsing and converting between these formats is essential in many types of GIS work. For instance when trying to use PyProj to transform coordinates from a non-proj4 crs format. Or when wanting to convert the crs from a GeoJSON file to a .prj file. Or when simply adding a crs definition to a file that was previously missing one.
Currently, the only way to read and convert between crs formats was to use the extensive Python GDAL suite and its srs submodule, but the requirements of some applications might exclude the use of GDAL. There have also been some online websites/services, but these only allow partial lookups or one-way conversion from one format to another.
I therefore created a new package called PyCRS which I hope will make it easier for lightweight applications to read a broader range of data files and correctly interpret and possibly transform their crs definitions. Written entirely in Python I also hope it will help clarify the differences between the various formats, and make it easier for more people to help keep it up-to-date and bug-free.
You can pip install it with “pip install pycrs”, or check it out on GitHub.
Currently, the supported formats are OGC WKT (v1), ESRI WKT, Proj4, and any EPSG, ESRI, or SR-ORG code available from spatialreference.org. In the future I hope to add support for OGC URN identifier strings, and GeoTIFF file tags.
The package is still in alpha version, so it will not perfectly parse or convert between all crs, and it is likely to have several (hopefully minor) differences from the results of other parsers like GDAL. In the source repository there is a tester.py script, which uses a barrage of commonly used crs as listed on http://www.remotesensing.org/geotiff/proj_list/. Currently, the overall success rate for loading as well as converting between the three main formats is 70-90%, and visual inspections of rendering the world with each crs generally look correct. However, whether the converted crs strings are logically equivalent to each other from a mathematical standpoint is something that needs a more detailed quality check.