GeoViewer
njw2023 opened this issue · 3 comments
njw2023 commented
Hi dear John
There is a program error in epsg = int(srs.GetAuthorityCode(None)) which TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'.
I don't know why it went wrong. Please help me,Thanks a lot.
Best regards,
Frank
johntruckenbrodt commented
Hi @njw2023. This kind of error might occur if the CRS does not have an EPSG representation. What is the CRS of your input data?
Here is a reproducible independent example:
from osgeo import osr
srs = osr.SpatialReference()
srs.SetFromUserInput('EPSG:4326')
srs.AutoIdentifyEPSG()
code = int(srs.GetAuthorityCode(None))
print(code)
See here for a more comprehensive function for converting between different CRS representations:
https://spatialist.readthedocs.io/en/latest/spatialist.html#spatialist.auxil.crsConvert
njw2023 commented
Thanks for that piece of advice!That solved my issue.
johntruckenbrodt commented
You're welcome