Home > geoserver > Geoserver WFS - Can I Pass in Filter Parameters via the URL?

Geoserver WFS - Can I Pass in Filter Parameters via the URL?

August 13Hits:6
Advertisement

I'm trying to use PHP's CURL function to fetch geoJSON information from a GeoServer instance. I'm doing this using url variables rather than trying to construct a full xml GetFeature request.

However, I would like to be able to get a subset of the results based on some of the property fields' contents.

So, while I can get all of the results using this url:

http://www.myURL.com/geoserver/namespace/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=layername&outputFormat=json&BBOX=1,2,3,4

can I also limit the results to "Where field LIKE value" or "field = value"?

I've spent an hour trawling through the Geoserver/ECQL documentation and none of it clearly states "append the functions to your URL in this format". As a result, I'm not clear if it's possible to use url variables to perform these tasks, but some people seem to suggest that it is.

Can anyone help with a clear example of a working filter using GeoServer's WFS with URL parameters?

Answers

I suppose you have been reading this http://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.html

Here comes some sample requests which are sending queries for the demo server of Boundless but which should work similarly with your own server if you have demo layer topp:states installed.

Select where STATE_NAME is Illinois

http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&request=getfeature&typename=topp:states&PROPERTYNAME=STATE_NAME&CQL_FILTER=STATE_NAME='Illinois'

Notice the use of standard WFS parameter PROPERTYNAME which is used here for shortening the output. Leave is out if you want all attributes, or write a list for selecting some attributes.

Then select states with name starting with "I"

http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&request=getfeature&typename=topp:states&PROPERTYNAME=STATE_NAME&CQL_FILTER=STATE_NAME LIKE 'I%25'

Notice that the comparison string is 'I%' but at least with my browser (Firefox 31.0) it must be URL-encoded and it comes 'I%25'. This is not mentioned in the CQL tutorial. If your own filters fail it may mean that you must URL-encode also some other other characters in your filter.

If you need geojson add &outputformat=application/json

http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&request=getfeature&typename=topp:states&PROPERTYNAME=STATE_NAME&CQL_FILTER=STATE_NAME LIKE 'I%25'&outputformat=application/json

Related Articles

  • Geoserver WFS - Can I Pass in Filter Parameters via the URL?August 13

    I'm trying to use PHP's CURL function to fetch geoJSON information from a GeoServer instance. I'm doing this using url variables rather than trying to construct a full xml GetFeature request. However, I would like to be able to get a subset of the re

  • Can you pass multiple filter parameters from a custom provider web part to a list view web part?December 27

    I've created a custom provider web part that I would like use to pass multiple filter parameters to a list view web part. Is this possible? If so, is there an example or tutorial out there that shows how to do this? --------------Solutions-----------

  • How to pass exposed filter value to Rewrite URL?August 17

    I have search filter criteria in the view.I need to pass the exposed filter value to the title field to rewrite URL. Please let me know how to get this exposed filter value in the rewrite URL.

  • Releasing GeoServer WFS-T Feature LockMay 24

    For some reason I'm having trouble finding any documentation about releasing feature locks in a GeoServer WFS (or any WFS for that matter). I can easily request a FeatureLock with a request like this http://localhost:8080/geoserver/wfs?service=WFS&ve

  • What's the correct link for adding GeoServer WFS to ArcMap?

    What's the correct link for adding GeoServer WFS to ArcMap?January 27

    What is the correct URL to enter in ArcCatalog WFS Parameters when adding a WFS layer from GeoServer into ArcMap? Here's a link to our Get Capabilities document: https://weaveprod.ucdp.utah.edu/geoserver/ows?service=wfs&version=1.0.0&request=GetCa

  • Geoserver WFS POST and format_options=PRJFILEFORMATMay 9

    I'm using geoserver (2.4.4) to provide users with shapefile downloads. Some of the software the shapefiles are going to be used in requires .prj-files that follows the "ESRI-standard". A bit of searching lead me to a Geoserver ticket (GEOS-4503)

  • GeoTools WFS Query sortBy not working for GeoServer WFSFebruary 17

    I am using GeoTools to query a GeoServer WFS using the following code: Map connectionParameters = new HashMap(); connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL", String.format("%s&request=GetCapabilities", wfsUr

  • Using GeoServer WFS to GetFeature by Clicking on it on the mapSeptember 4

    Can someone point me to document of crafting a Geoserver WFS GetFeature request with CQL_Filters? I've already read the GeoServer CQL_Filter Geometric filter section I have a Geoserver WMS set up to return multiple polygon geometries (from a postgres

  • Geoserver WFS-T "Feature type 'Workspace:Layer' is not available" Error on update / deleteDecember 1

    I am using the following code for insert / update (changed from this source: http://wordpress-dbauszus.rhcloud.com/?p=71): var formatWFS = new ol.format.WFS(); // GML Format zur Interaktion mit WFS var formatGML = new ol.format.GML({ featureNS: 'http

  • Windows 7 XP Mode: Passing command-line parameters to VM apps?October 31

    Does anyone know a way to pass command line parameters to virtualized programs inside an XP Mode VM? I have a VM with Internet Explorer6 installed (and another with Internet Explorer7), and using the shortcut publishing functionality I can launch tho

  • Drupal-Geoserver WFS error September 24

    I am having trouble getting a WFS layer working using Geoserver, OpenLayers and GeoExt. I get the following error: XMLHttpRequest cannot load http://10.0.0.155/geoserver/wfs. Origin http://10.0.0.155:8080 is not allowed by Access-Control-Allow-Origin

  • How to add GeoServer wfs layer on OpenLayers?

    How to add GeoServer wfs layer on OpenLayers?March 4

    I can't seem to add a WFS layer like this. It works when i copy all this code locally but as soon as i change the values to point to my own layer within my own GeoServer this is the response viewed in firebug: Could not locate {http://www.mydomain.co

  • geoserver wfs insert errorApril 27

    I keep getting an insert error from geoserver when trying to save a point, poly etc etc to my postgis table. any ideas, my code is below var Projection = new OpenLayers.Projection("EPSG:4326"); var map = new OpenLayers.Map("Map", { //p

  • Can you pass user/pass for HTTP Basic Authentication in URL parameters?March 21

    I believe this is not possible, but someone I know insisted that it works. I don't even know what parameters to try, and I haven't found this documented anywhere. I tried http://myserver.com/~user=username&password=mypassword but it doesn't work. Can

  • Allow GeoServer WFS request by featureIDApril 6

    I'm not able to use the featureID parameter in a WFS URL request for my dataset on GeoServer. Example: http://demo.opengeo.org/geoserver/wfs?version=1.1.0&service=wfs&request=GetFeature&typeName=topp:tasmania_roads&maxFeatures=10&featu

  • GeoServer WFS OpenLayers EditingPanel ProblemJune 13

    I'm trying to use OpenLayers to edit features of vector data served from a local geoserver. So far, I'm able to pull WMS and WFS layers using OpenLayers from the same geoserver. But now, I'd like enable editing of features of the vector layers. The r

  • OpenGL: How to map textures to geometry without using filter parametersAugust 12

    following my another question I have studied in the documentations that I should use this procedure : Define the texture filter parameters. This will control what happens when a texture is scaled up or down. glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE

  • Geoserver WFS get feature doesn't work - "SyntaxError: missing ; before statement"

    Geoserver WFS get feature doesn't work - "SyntaxError: missing ; before statement"December 3

    I'm trying to use geoserver WFS json for creating vector layer (instead of using WMS) because this is a layer I redraw every 20 seconds. This is the code I use : function getJSON() { var geoJsonUrl = "http://localhost:8080/geoserver/test/ows?service=

  • Geoserver WFS Fails to Load in OpenLayers

    Geoserver WFS Fails to Load in OpenLayersMarch 31

    I'm working with Postgis->Geoserver->openlayers on localhost. I followed a Geoserver tutorial to import some nyc sample data into my postgres/postgis database and link it to Geoserver. The layer seems to display correctly in Geoserver using the open

  • QGIS does not update data in Geoserver WFS-TNovember 14

    I am trying to edit a WFS from geoserver (using PostGIS data) within QGIS. This is the request as recorded by Fiddler <Transaction xmlns="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version=&quo

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.498 s.