OWSLib icon indicating copy to clipboard operation
OWSLib copied to clipboard

Implement remaining spatial filters in owslib.fes

Open kwilcox opened this issue 11 years ago • 3 comments

Only BBOX is currently implemented

kwilcox avatar Mar 03 '14 22:03 kwilcox

+1 for this to be implemented.

I'm currently working around with some simple envelope only code based on the owslib.fes.BBox code:

## owslib.fes only supports BBox spatial filter, so add a few more
## Modified by Luke Pinner (2014) from original owslib.fes.BBox code
class SpatialOp(OgcExpression):
    """Construct a BBox, two pairs of coordinates (west-south and east-north)"""
    def __init__(self, operator, bbox, crs=None):
        self.operator = operator
        self.bbox = bbox
        self.crs = crs
    def toXML(self):
        tmp = etree.Element(util.nspath_eval(self.operator, namespaces))
        etree.SubElement(tmp, util.nspath_eval('ogc:PropertyName', namespaces)).text = 'ows:BoundingBox'
        tmp2 = etree.SubElement(tmp, util.nspath_eval('gml:Envelope', namespaces))
        if self.crs is not None:
            tmp2.set('srsName', self.crs)
        etree.SubElement(tmp2, util.nspath_eval('gml:lowerCorner', namespaces)).text = '%s %s' % (self.bbox[0], self.bbox[1])
        etree.SubElement(tmp2, util.nspath_eval('gml:upperCorner', namespaces)).text = '%s %s' % (self.bbox[2], self.bbox[3])
        return tmp

class Contains(SpatialOp):
    def __init__(self, bbox, crs=None):
        SpatialOp.__init__(self,'ogc:Contains',bbox,crs)

class Disjoint(SpatialOp):
    def __init__(self, bbox, crs=None):
        SpatialOp.__init__(self,'ogc:Disjoint',bbox,crs)

class Within(SpatialOp):
    def __init__(self, bbox, crs=None):
        SpatialOp.__init__(self,'ogc:Within',bbox,crs)

lpinner avatar Jan 06 '15 03:01 lpinner

Is this issue still a work in progress ?

Zeitsperre avatar May 25 '21 20:05 Zeitsperre

Fixed for WFS2.0 and POST requests in #780

huard avatar Jul 05 '21 20:07 huard