leaflet.wms icon indicating copy to clipboard operation
leaflet.wms copied to clipboard

GetFeatureInfo Url

Open KroniK907 opened this issue 8 years ago • 2 comments

So In my setup I have a GeoServer setup to provide WMS.

When I provide my source I generally want to source the cached tiles using the GeoWebCache url for GeoServer (eg. http://myserver.com/geoserver/gwc/service/wms)

However, GeoServer does not provide GetFeatureInfo capability at that url. Instead you have to use the standard wms url (which is not cached).

So could we add a parameter to the GetFeatureInfo to provide an optional url which the GetFeatureInfo would use rather than the base source url?

Thanks.

KroniK907 avatar Aug 10 '17 20:08 KroniK907

I think this would be useful as well, have you found a solution to this yet, @KroniK907?

mooman avatar Sep 05 '17 04:09 mooman

It could be achieved using custom implementation of getFeatureInfo function:

    L.WMS.Source.MySource = L.WMS.Source.extend({
        'getFeatureInfo': function (point, latlng, layers, callback) {
            // It can be passed somehow, using options object, for example
            var getFeatureInfoUrl = 'http://....';
            var params = this.getFeatureInfoParams(point, layers),
                url = getFeatureInfoUrl + L.Util.getParamString(params, getFeatureInfoUrl);

            this.showWaiting();
            this.ajax(url, done);

            function done(result) {
                this.hideWaiting();
                var text = this.parseFeatureInfo(result, url);
                callback.call(this, latlng, text);
            }
        }
    });

apdevelop avatar Dec 16 '17 07:12 apdevelop