-
Notifications
You must be signed in to change notification settings - Fork 284
Add support for topological filters #780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Example usage: from owslib.wfs import WebFeatureService
from owslib.fes2 import Intersects
from owslib.gml import Point
import geojson
def test_intersects():
p = Point(id="qc", srsName="http://www.opengis.net/gml/srs/epsg.xml#4326", pos=[-71, 46])
f = Intersects(propertyname="the_geom", geometry=p)
intersects = f.toXML()
wfs = WebFeatureService("https://pavics.ouranos.ca/geoserver/wfs", version="2.0.0")
resp = wfs.getfeature(typename="public:canada_admin_boundaries", outputFormat="application/json",
propertyname="PRENAME", method="POST", filter=intersects)
out = geojson.load(resp)
assert out["totalFeatures"] == 1
assert out["features"][0]["properties"]["PRENAME"] == "Quebec" |
Thanks @huard. There are no plans to drop 3.6 anytime soon given it is the default Python version on major OSs (i.e. bionic). |
Ok, will modify the PR. |
As mentioned, at the moment the |
@kwilcox @lpinner @jorisvandenbossche Is this what you were looking for in issue #128 ? |
@tomkralidis Ready for review. |
Thanks @huard ! |
is there any provision for stable implementation of geometry types other than Point? |
Not from my part. This PR was meant to solve a problem I had. |
This PR allows users to filter WFS requests using spatial filters: Intercepts, Contains, Within, Touches, Disjoint, Overlaps, Equals.
Notes
set_filter
method in GetFeature is weird. It expects a GetFeature xml request, instead of just the Filter node. I've added a shortcut to allow passing a filter XML object directly. Suggestions welcome. I suggest that when passingfilter
to getfeature, we only pass the filter node, not the getfeature node.Related
#128