4

I want to be able to draw a bounding polygon and have my MapServer WMS layer return every feature within that bounding box. I have it working for a single point, but I would like for the query to return every single feature within a polygon. Is that possible with WMS GetFeatureInfo? I am using OpenLayers in Java with GWT. There is a bridge between Java and the OpenLayers JS.

  • Did you ever get this working? I also have a wms layer that I would like to select items by bounding box. Thanks. – user3657279 Jan 7 '15 at 19:13
8

You cannot get information for features within a bbox using a WMS getFeatureInfo. Please have a look at the WMS reference for getFeatureInfo.

You will see that according to the standards, you can only pass in points, not a bbox.

Instead, you could use a getFeature Operation on the WFS service.

The BBOX parameter allows you to search for features that are contained (or partially contained) inside a box of user-defined coordinates. The format of the BBOX parameter is bbox=a1,b1,a2,b2wherea1, b1, a2, and b2 represent the coordinate values.

An example request involving returning features based on bounding box would be in the following format:

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

(Please note, that I have linked to the geoserver site, instead of the actual OGC standards, as the Geoserver website is far more readable than the OGC standards.)

2

This is not possible with the present GetFeatureInfo request specification, the argument is a single point of interest.

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.