Skip to content

Commit 96cc10c

Browse files
committedDec 23, 2017
[bugfix] [MetaSearch] make gml:Envelope CRS explicit for spatial queries (fixes #17739)
1 parent ea983fa commit 96cc10c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
 

‎python/ext-libs/owslib/fes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,15 @@ def toXML(self):
340340

341341
class BBox(OgcExpression):
342342
"""Construct a BBox, two pairs of coordinates (west-south and east-north)"""
343-
def __init__(self, bbox):
343+
def __init__(self, bbox, crs=None):
344344
self.bbox = bbox
345+
self.crs = crs
345346
def toXML(self):
346347
tmp = etree.Element(util.nspath_eval('ogc:BBOX', namespaces))
347348
etree.SubElement(tmp, util.nspath_eval('ogc:PropertyName', namespaces)).text = 'ows:BoundingBox'
348349
tmp2 = etree.SubElement(tmp, util.nspath_eval('gml:Envelope', namespaces))
350+
if self.crs is not None:
351+
tmp2.set('srsName', self.crs)
349352
etree.SubElement(tmp2, util.nspath_eval('gml:lowerCorner', namespaces)).text = '%s %s' % (self.bbox[0], self.bbox[1])
350353
etree.SubElement(tmp2, util.nspath_eval('gml:upperCorner', namespaces)).text = '%s %s' % (self.bbox[2], self.bbox[3])
351354
return tmp

‎python/plugins/MetaSearch/dialogs/maindialog.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ def search(self):
438438
self.timeout = self.spnTimeout.value()
439439

440440
# bbox
441+
# CRS is WGS84 with axis order longitude, latitude
442+
# defined by 'urn:ogc:def:crs:OGC:1.3:CRS84'
441443
minx = self.leWest.text()
442444
miny = self.leSouth.text()
443445
maxx = self.leEast.text()
@@ -448,7 +450,8 @@ def search(self):
448450
# even for a global bbox, if a spatial filter is applied, then
449451
# the CSW server will skip records without a bbox
450452
if bbox != ['-180', '-90', '180', '90']:
451-
self.constraints.append(BBox(bbox))
453+
self.constraints.append(BBox(bbox,
454+
crs='urn:ogc:def:crs:OGC:1.3:CRS84'))
452455

453456
# keywords
454457
if self.leKeywords.text():

0 commit comments

Comments
 (0)
Please sign in to comment.