Home > geoserver > Using GeoServer WFS to GetFeature by Clicking on it on the map

Using GeoServer WFS to GetFeature by Clicking on it on the map

September 4Hits:1
Advertisement

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 database) on the map. I now want to click on the map and in its click event, send a WFS GetFeature request to find the attributes associated with that geometry.

I read the tutorial and it looks like CQL_Filter Contains is what I need but I'm having trouble finding the correct syntax. I'm working with this URL at the moment:

var requestUrl = 'http://localhost:8080/geoserver/wfs?&OUTPUTFORMAT=application/json&REQUEST=GetFeature&SERVICE=WFS&VERSION=1.1.1&srsName=EPSG:4326&TYPENAME=namespace:layer&CQL_FILTER=CONTAINS(geom, Point(' + location.longitude + ',' + location.latitude + '))'; 

When I post the above URL I get the following error:

<ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://localhost:8080/geoserver/schemas/ows/1.1.0/owsAll.xsd">   <ows:Exception exceptionCode="NoApplicableCode">     <ows:ExceptionText>Could not parse CQL filter list. Encountered &amp;quot;,&amp;quot; at line 1, column 40.
 Was expecting one of:
     &amp;quot;-&amp;quot; ...
     &amp;lt;INTEGER_LITERAL&amp;gt; ...
     &amp;lt;FLOATING_LITERAL&amp;gt; ...
      Parsing : CONTAINS(geom, Point(-84.39313136004358,33.757086728151805)).</ows:ExceptionText>   </ows:Exception> </ows:ExceptionReport> 

Thanks, Zi

Answers

The error message says it all really, you just need to read it :-)

It says that you have an error at line 1, character 40 because it is expecting a - or an Integer or Floating Point number.

If you look at your filter character 40 is a , which is not a - or a number so this is the problem. If you were to write your filter using standard WKT representation of a point it would work.

CONTAINS(geom, Point(-84.39313136004358 33.757086728151805))

PS You almost certainly don't need that much precision in your coordinates.

Related Articles

  • 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

  • Receiving -infinity in geoserver wfs GetFeature resultOctober 16

    I'm currently using: - Geoserver 2.7.2 - PostgreSQL 9.4.4 - PostGIS 2.1.9 When I submit the following wfs GetFeature request: http://localhost:8080/geoserver/wfs?service=wfs&version=2.0.0&request=GetFeature&typeNames=gis:roads&propertyName

  • 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

  • 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 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=

  • 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)

  • 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

  • Geoserver WFS 2.0 CSV Output Multiple Features/typeNamesJanuary 27

    I'm setting up an export function so that users may download data from a Geoserver WFS 2.0 service in a variety of the supported formats. The service has multiple FeatureTypes which should be available for export in a single query (along with BBOX an

  • 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

  • Oracle / GeoServer / WFS-T / Openlayers many polygons as one featureFebruary 26

    Newbie question regarding Oracle / GeoServer / WFS-T / Openlayers. I am creating a table that will hold geometry features a user creates/updates. My question is, I would like to have just one record in the table per customer (customerId). Can I creat

  • Accessing GeoServer WFS services in ArcGIS Online map viewer?September 9

    Has anyone was able to add GeoServer WFS service into ArcGIS Online map viewer? By this I mean having an ArcGIS Online account (either free or for Organizations), logging in and adding layers from the web. I have no problems adding a WMS service such

  • 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

  • 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

  • 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

  • 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

  • Geoserver WFS-T insert no response. bug?December 1

    I use Geoserver + Openlayers and want to add and save some new Points via WFS-T. I created insert transaction (correct) and sent it, but no response (include errors) was returned. In console was only: 01 dec 17:34:16 INFO [geoserver.wfs] - Request: g

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