[OSGeo-Discuss] GetFeatureInfo Filter

Andrea Aime aaime at opengeo.org
Fri May 14 08:04:44 PDT 2010


Miranda Mauricio ha scritto:
> Hi people!
> 
> Quick question... is it possible to filter a getfeatureinfo request with a cql_filter parameter or something like that?

In GeoServer it is possible, but we're talking about a custom extension
here, cql_filters are not part of the standard WMS protocol.

For example, here is a WMS query that will return all US states starting 
with an M (filter is STATE_NAME LIKE 'M%')

http://demo.opengeo.org/geoserver/wms?HEIGHT=330&WIDTH=780&LAYERS=topp%3Astates&STYLES=&SRS=EPSG%3A4326&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&CQL_FILTER=STATE_NAME%20LIKE%20%27M%25%27&BBOX=-139.84813671875,18.549615234375,-51.85286328125,55.778384765625

And then we can do a GetFeatureInfo over Kansas, and if
you don't add the filter, you get back the usual HTML table:

http://demo.opengeo.org/geoserver/wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX=-139.848137%2C18.549615%2C-51.852863%2C55.778385&X=363&Y=148&INFO_FORMAT=text%2Fhtml&QUERY_LAYERS=topp%3Astates&FEATURE_COUNT=50&Layers=topp%3Astates&Styles=&Srs=EPSG%3A4326&WIDTH=780&HEIGHT=330&format=image%2Fpng

but if you add the filter, you get back nothing as Kansas does not 
satisfy it:

http://demo.opengeo.org/geoserver/wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX=-139.848137%2C18.549615%2C-51.852863%2C55.778385&X=363&Y=148&INFO_FORMAT=text%2Fhtml&QUERY_LAYERS=topp%3Astates&FEATURE_COUNT=50&Layers=topp%3Astates&Styles=&Srs=EPSG%3A4326&WIDTH=780&HEIGHT=330&format=image%2Fpng&CQL_FILTER=STATE_NAME%20LIKE%20%27M%25%27

As I said, all of this is GeoServer specific. Other server might have
different ways of providing a similar functionality

Cheers
Andrea

-- 
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Discuss mailing list