Skip to content

Commit 45f8bec

Browse files
authored
fix CRS for non-int code by URL (#898)
* fix CRS for non-int code by URL * fix invalid CRS URI for non-EPSG codes
1 parent 5d8e193 commit 45f8bec

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

owslib/crs.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,11 @@ def getcodeuri1(self):
18261826
:returns: String code formated in "http://www.opengis.net/def/crs/EPSG/0/code"
18271827
"""
18281828

1829-
return 'http://www.opengis.net/def/crs/EPSG/0/%s' % self.code
1829+
return 'http://www.opengis.net/def/crs/{}/{}/{}'.format(
1830+
self.authority or "EPSG",
1831+
self.version or "0",
1832+
self.code
1833+
)
18301834

18311835
def getcodeuri2(self):
18321836
"""Create for example "http://www.opengis.net/gml/srs/epsg.xml#4326"

tests/doctests/crs.txt

+2
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@
4444
'1.3'
4545
>>> c.getcodeurn()
4646
'urn:ogc:def:crs:OGC:1.3:CRS84'
47+
>>> c.getcodeuri1()
48+
'http://www.opengis.net/def/crs/OGC/1.3/CRS84'

0 commit comments

Comments
 (0)