1

I have several tile WMS layers with about 5000 earthquakes and I want to query their features by clicking: example That works fine for me, but I would like to query individual features, like only the date, the coordinates and the magnitude and not the whole attribute table.

So is there a way to query individual features of a tile WMS?

My recent research has shown that I should send the URL as JSON and than parse it.

  • Do you mean request the response as JSON, then parse it? Note you can only request JSON as an output format if the service reports that it supports that format. – nmtoken Mar 24 '17 at 8:44
  • a little late to the party but, when you say: That works fine for me, but I would like to query individual features, you mean individual attributes, right? because query individual features is exactly what your example does. Date, coordinates and magnitude would be attributes of the selected feature, not features themselves. Did you mean attributes or I understood you wrong? – Scaramouche Feb 9 '18 at 14:22
2

in your example the GetFeatureInfo-Response comes from a Geoserver:

http://demo.boundlessgeo.com/geoserver/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&FORMAT=image%2Fpng&TRANSPARENT=true&QUERY_LAYERS=ne%3Ane&LAYERS=ne%3Ane&INFO_FORMAT=text%2Fhtml&I=45&J=211&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&STYLES=&BBOX=0%2C0%2C20037508.342789244%2C20037508.342789244

If you use Geoserver you can make use of so called Freemarker Templates to control what is delivered as a repsonse to a GetFeatureInfo-Request:

http://docs.geoserver.org/stable/en/user/tutorials/GetFeatureInfo/index.html#tutorials-getfeatureinfo

0

The term tile WMS is a bit of a misnomer, Web Map Services (WMS) are not tile services, the term applies to how OpenLayers makes requests to the server. So a tile WMS is a WMS.

So is there a way to query individual features of a tile WMS?

No, because a WMS doesn't provide any features, it just provides images that are based on some data source(s).

The GetFeatureInfo request (when supported by the WMS) allows you to click on the image and get a response for the data that created the image, which may not correspond to an actual feature.

The response from a GetFeatureInfo request (the formats returned and the properties returned) is governed by the service provider. There is no requirement for all the properties to be returned.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.