Skip to content

Commit

Permalink
fix CRS for non-int code by URL (#898)
Browse files Browse the repository at this point in the history
* fix CRS for non-int code by URL

* fix invalid CRS URI for non-EPSG codes
  • Loading branch information
fmigneault authored Nov 1, 2023
1 parent 5d8e193 commit 45f8bec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion owslib/crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1826,7 +1826,11 @@ def getcodeuri1(self):
:returns: String code formated in "http://www.opengis.net/def/crs/EPSG/0/code"
"""

return 'http://www.opengis.net/def/crs/EPSG/0/%s' % self.code
return 'http://www.opengis.net/def/crs/{}/{}/{}'.format(
self.authority or "EPSG",
self.version or "0",
self.code
)

def getcodeuri2(self):
"""Create for example "http://www.opengis.net/gml/srs/epsg.xml#4326"
Expand Down
2 changes: 2 additions & 0 deletions tests/doctests/crs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@
'1.3'
>>> c.getcodeurn()
'urn:ogc:def:crs:OGC:1.3:CRS84'
>>> c.getcodeuri1()
'http://www.opengis.net/def/crs/OGC/1.3/CRS84'

0 comments on commit 45f8bec

Please sign in to comment.