2

I am using GetFeatureInfo query to WMS service. When I click a WMS object on the map, the response is coming.

http://localhost:8080/geoserver/wms?
request=GetFeatureInfo
&service=WMS
&version=1.1.1
&layers=topp%3Astates
&styles=
&srs=EPSG%3A4326
&format=image%2Fpng
&bbox=-145.151041%2C21.73192%2C-57.154894%2C58.961059
&width=780
&height=330
&query_layers=topp%3Astates
&info_format=text%2Fhtml
&feature_count=50
&x=353
&y=145
&exceptions=application%2Fvnd.ogc.se_xml

But I want to send a request a polygonal area. Not a single x,y location. How can I do this? Is possible?

5

You can only use a x,y (i,j) coordinate search for GetFeatureInfo requests http://docs.geoserver.org/stable/en/user/services/wms/reference.html#getfeatureinfo

However, you may test for interactions with polygons (and many other geometries) using a Web Feature Service (WFS) request.

E.g. https://wiki.state.ma.us/confluence/display/massgis/GeoServer+-+WFS+-+Get+Feature+by+Polygon+-+Other+Projection

0

Usually a request for features is done on a featureservice (WFS) - esp. when you have a more complex logic like querying features within a given polygon. The GetFeatureInfo is designed to perform a feature-query based on the mouse-position in native (meaning display-) coordinates rather the geographic (transformed) coords. But it is indeed restricted to that single position (don´t get irritated: the BBOX param is the parameter for the map-size itself, it has nothing to do with your actual feature-query). If you have a GeoServer you may have a look at WMS reference also, but also if you don´t (the site deals for WebServices in general, no matter if GeoServer or not).

0

With Geoserver you might want to have a try with the CQL filters which are much easier to write than the official OGC style XML/GML filters.

I took the "DISJOINT" example from the manual http://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.html and converted into WFS GetFeature request with INTERSECTS filter. You can test it with the demo server of Boundless with this request

http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&request=getfeature&typename=topp:states&CQL_FILTER=INTERSECTS(the_geom, POLYGON((-90 40, -90 45, -60 45, -60 40, -90 40)))

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.