Insert viewparameters into WFS GetFeatureInfo from WMS layer

253 views
Skip to first unread message

Zach Seaman

unread,
Apr 13, 2015, 2:12:13 PM4/13/15
to cesiu...@googlegroups.com
My URL for displaying my WMS is using a parameterized SQL view from GeoServer:

http://server.com/geoserver/wms?transparent=true&
format
=image%2Fpng&
viewparams
=edo%3A23&
service
=WMS&
version
=1.1.1&
request
=GetMap&
layers
=fonatur%3Alayer&
srs
=EPSG%3A4326&
bbox
=-112.5%2C-11.25%2C-101.25%2C0&
width
=256&
height
=256

When I click on the WMS Feature, the WFS GetFeatureInfo is baked in (so it doesn't show any features) like this:

http://server.com/geoserver/wms?service=WMS&
version
=1.1.1&
request
=GetFeatureInfo&
layers
=fonatur%3Alayer&
query_layers
=fonatur%3Alayer&
srs
=EPSG%3A4326&
bbox
=-115.31250000000001%2C30.937499999999996%2C-113.90625%2C32.34375000000001&
x
=31&
y
=103&
width
=256&
height
=256&
info_format
=application%2Fjson



so I need to insert the view parameters into the URL.

viewparams=edo%3A23&



Is there a way to capture the URL of the WFS request when the click happens to customize the WFS GetFeatureInfo request? 


Any help on where to locate the module or create a work around would be greatly appreciated!


Zach Seaman

unread,
Apr 13, 2015, 2:34:21 PM4/13/15
to cesiu...@googlegroups.com
Figured it out!

Should have looked harder before posting though this will probably help someone out in the future...

Just throw that info object into the WMS layer property, getFeatureInfoParameters and you're good to go.

It's just like adding parameters.

var wms = imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
                url
: liga,
                layers
: nombre,
                parameters
: parametros,
                getFeatureInfoParameters
: viewparams
           
}));

Reply all
Reply to author
Forward
0 new messages