Open salvafern opened 2 years ago
Interesting! So should we just switch to POST when passing any filter?
Ideally yes! I have done this before via curl but haven't had the time to try in R
is this actually a ows4r feature request or do you have an example?
From what I see in https://github.com/eblondel/ows4R/blob/632928a100b69e1ca60f10975c38d3325016d97b/R/WFSGetFeature.R#L21, I'm not sure where one would pass "POST".
@salvafern friendly reminder about the question above :smile_cat:
Yes sorry. Most likely it would be a new feature for ows4r
, I don't see an option to do POST requests there. I include an example below:
Example with curl:
Get all features that intersect with a certain polygon. I will use the EEZ layer of MarineRegions.
Create a post request as XML and name as xmlquery.xml
. Contains the name of the layer (MarineRegions:eez), the name of the geometry column (the_geom), the instructions to intersect and the polygon to intersect with as gml
<wfs:GetFeature xmlns:wfs='http://www.opengis.net/wfs' xmlns:ogc='http://www.opengis.net/ogc' xmlns:gml='http://www.opengis.net/gml' service='WFS' version='1.0.0'>
<Query typeName='MarineRegions:eez'>
<ogc:Filter xmlns:gml="http://www.opengis.net/gml">
<Overlaps>
<PropertyName>the_geom</PropertyName>
<gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#63266405">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>-0.258498799963897,58.4594990974729 2.76925390761733,58.4594990974729 2.76925390761733,53.7259702166065 -0.258498799963897,58.4594990974729</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</Overlaps>
</ogc:Filter>
</Query>
</wfs:GetFeature>
Perform POST request with curl:
curl -XPOST -d @wfsquery.xml -H "Content-type: application/xml" "http://geo.vliz.be/geoserver/MarineRegions/ows?" --output test.geojson
But OGC filter are very verbose, not sure if this is something that will be solved quickly/easily.
Some resources:
@salvafern thank you! Would you mind opening a ows4r feature request then?
@maelle Done! :)
I have noticed when using
ows4R
that, when you pass a large filter (e.g. a complex WKT polygon), the request may fail because of the GET limitations. We could look into passing large filters via POST requests.