简体   繁体   中英

WMS GetFeatureinfo for featurelayers

I'm looking the way how to use browser to query all WMS features( with all attributes the feature have) by just defining the layer parameter or what parameters I need to add to get desired result? Request all features WMS is serving, output format must be txt, gml or xml. Something like this...

wms?request=GetFeatureInfo&QUERY_LAYERS=my_layer&info_format=application/vnd.ogc.gml&select_all_features.

It's not possible, a WMS GetFeatureInfo operation fetches a point location (pixel coordinate) in a map image (created through a GetMap operation).

Also a WMS also doesn't serve out features it serves out images (or videos) that are representations of some input often, but not always, a vector data set.

What you need is for there to be a WFS (or WCS) these are 'download' services that let you get at the actual data.

It is not possible using WMS, but using WFS you can get all the GetFeatureInfo and also apply some limited amount of conditions to get the desired results.

For this you need to use WFS REQUEST=GetFeature

The documentation for WMS GetFeature describes the various options in more details.

A simple example would be

GET 
http://example.com/geoserver/wfs?
  service=wfs&
  version=2.0.0&
  request=GetFeature&
  typeNames=namespace:featuretype&
  count=N

GET
http://example.com/geoserver/wfs?
  service=wfs&
  version=1.1.0&
  request=GetFeature&
  typeName=namespace:featuretype&
  maxFeatures=N

If you want to filter by BBOX you can use the following, as mentioned in the documentation

POST
http://example.com/geoserver/wfs?
  service=wfs&
  version=2.0.0&
  request=GetFeature&
  typeNames=namespace:featuretype&
  srsName=CRS&
  bbox=a1,b1,a2,b2

For me it worked with GET too.

Note if bbox=a1,b1,a2,b2 does not work, try bbox=a1,b1,a2,b2,CRS

For me even with srsName=CRS&bbox=a1,b1,a2,b2 I got "features": [], with srsName=CRS&bbox=a1,b1,a2,b2,CRS I got results

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM