WMS vs. WMTS and GetFeatureInfo Requests

How to get GetFeatureInfo requests to perform against GeoWebCache?  Just don’t.  I’m unclear as to whether it is problematic to do this because of a known bug or known implementation differences between the (unofficial) WMTS standard as implemented by OpenLayers and GeoServer, but in Googling for answers to how to perform a GetFeatureInfo request against GeoWebCache, I discovered a workaround (logged here for example).  The trick is to specify the url for the WMSGetFeatureInfo request as your WMS service, and layersUrls as your GeoWebCache, if that’s what you’re using for all your layers, like in my case.

Here is a control all fleshed out (thanks to my intern John for writing/modifying all but two of these lines… ):


var info = new OpenLayers.Control.WMSGetFeatureInfo({
	drillDown: false,
	queryVisible: true,
	url: GeoserverWMS,
	layerUrls: [GeowebcacheURL],
	eventListeners: {
		getfeatureinfo: function(event) {
			popup = new OpenLayers.Popup.FramedCloud(
				"popinfo",
				map.getLonLatFromPixel(event.xy),
				null,
				event.text,
				null,
				true
			);

			map.addPopup(popup, true);
		}
	}
});

map.addControl(info);

info.activate();

One thought on “WMS vs. WMTS and GetFeatureInfo Requests

  1. Apparently, GeoWebCache now can proxy GetFeatureInfo requests to a WMS backend, so there’s no need to expose GeoServer to the world for WMTS and GetFeatureInfo requests that GeoWebCache can fill.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.