I created a "custom" CRS with specifications I got from someone who needs the data in that specific system. It worked well and I now have a *.prj file, so basically a WKT-representation of that CRS. How can I find out if it already exists as some "official" CRS which might even have an EPSG code?

I tried this with Python / OSR:

from osgeo import osr
sr = osr.SpatialReference()
wkt = '''MY_WKT'''
sr.ImportFromWkt(wkt) # returns 0, so that worked
sr.AutoIdentifyEPSG() # returns 7, of which I don't know the meaning, but it does not seem to work
sr.GetAttrValue('AUTHORITY', 1) # returns '4326', but MY_CRS is not the standard WGS84, so that's definitely wrong

Does that mean that my CRS is "truly custom" since there is no EPSG for that? Is there another way of finding out whether it already exists or not?

  • Are you asking about this specific CRS, or about the general process of how to deduce the EPSG-code from the WKT? If the first is the case, providing the WKT would be helpful. – Erik Apr 23 '19 at 12:38
  • No, I want to check if this CRS already exists in some "official" form, which is the reason I tried to check the EPSG. If there are other ways of finding out if the CRS is already out there, that's just fine. I know the process of extracting the EPSG already. – s6hebern Apr 23 '19 at 12:43
  • EPSG is not the only authority for CRS definitions, so, just if you can determine that your CRS is not one defined by EPSG, you can't say for certain that it hasn't been defined by some other authority – nmtoken Apr 23 '19 at 12:45

You can query the prj2epsg API

import urllib3
import json

query = "http://www.prj2epsg.org/search.json?terms=" + prj_string + "&mode=wkt"
http = urllib3.PoolManager()
r = http.request('GET', query)
data = json.loads(r.data)
print data['codes'][0]['code']

with prj_string as the string contained in your prj file


or directly use the website http://prj2epsg.org/search

|improve this answer|||||
  • Cool site, did not know that. So does that basically mean that in case the suggestions do not fit what I set up, MY_CRS does not exist "officially"? With the suggested code, I get an error message Max retries exceeded. – s6hebern Apr 23 '19 at 12:57
  • 1
    Max retries exceeded happens when you send too many requests to a server from the same ip address, if you have a proxy you should configure add a proxy handler in the code. For the unfound CRS even though you didn't find an epsg code for it try to match it on a basemap using the local CRS for the region it covers and check its parameters if they are close enough and don't change much of your distances or areas you could use it – Hicham Zouarhi Apr 23 '19 at 13:51

Export your CRS in PROJ.4 format (just one line), and google for it.

If a CRS with the same parameter values exist, epsg.io or some EPSG collections will have it.

|improve this answer|||||
  • Seems not to work for my specific CRS, but sounds like a good solution, too – s6hebern Apr 24 '19 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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