Skip to content
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

Consider using POST requests when passing large filters #115

Open
salvafern opened this issue May 5, 2022 · 7 comments
Open

Consider using POST requests when passing large filters #115

salvafern opened this issue May 5, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@salvafern
Copy link
Collaborator

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.

@salvafern salvafern added the enhancement New feature or request label May 5, 2022
@salvafern salvafern changed the title Considering use POST requests when passing large filters Consider using POST requests when passing large filters May 5, 2022
@maelle
Copy link
Collaborator

maelle commented Jun 2, 2022

Interesting! So should we just switch to POST when passing any filter?

@salvafern
Copy link
Collaborator Author

Ideally yes! I have done this before via curl but haven't had the time to try in R

@maelle
Copy link
Collaborator

maelle commented Oct 14, 2022

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".

@maelle
Copy link
Collaborator

maelle commented Jan 13, 2023

@salvafern friendly reminder about the question above 😸

@salvafern
Copy link
Collaborator Author

salvafern commented Jan 16, 2023

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:

@maelle
Copy link
Collaborator

maelle commented Jan 20, 2023

@salvafern thank you! Would you mind opening a ows4r feature request then?

@salvafern
Copy link
Collaborator Author

@maelle Done! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants