L.TileLayer.BetterWMS = L.TileLayer.WMS.extend({

  onAdd: function (map) {
    // Triggered when the layer is added to a map.
    //   Register a click listener, then do all the upstream WMS things
    L.TileLayer.WMS.prototype.onAdd.call(this, map);
  },

  onRemove: function (map) {
    // Triggered when the layer is removed from a map.
    //   Unregister a click listener, then do all the upstream WMS things
    L.TileLayer.WMS.prototype.onRemove.call(this, map);
  }

});

L.tileLayer.betterWms = function (url, options) {
  return new L.TileLayer.BetterWMS(url, options);
};
@@ -249,13 +249,61 @@
 p);%0A
+    map.on('click', this.getFeatureInfo, this);%0A
   %7D,%0A
-
 %0A  o
@@ -517,13 +517,1988 @@
 p);%0A
+    map.off('click', this.getFeatureInfo, this);%0A  %7D,%0A%0A  getFeatureInfo: function (evt) %7B%0A    // Make an AJAX request to the server and hope for the best%0A    var url = this.getFeatureInfoUrl(evt.latlng),%0A        showResults = L.Util.bind(this.showGetFeatureInfo, this);%0A    $.ajax(%7B%0A      url: url,%0A      success: function (data, status, xhr) %7B%0A        var err = typeof data === 'string' ? null : data;%0A        showResults(err, evt.latlng, data);%0A      %7D,%0A      error: function (xhr, status, error) %7B%0A        showResults(error);%0A      %7D%0A    %7D);%0A  %7D,%0A%0A  getFeatureInfoUrl: function (latlng) %7B%0A    // Construct a GetFeatureInfo request URL given a point%0A    var point = this._map.latLngToContainerPoint(latlng, this._map.getZoom()),%0A        size = this._map.getSize(),%0A%0A        params = %7B%0A          request: 'GetFeatureInfo',%0A          service: 'WMS',%0A          srs: 'EPSG:4326',%0A          styles: this.wmsParams.styles,%0A          transparent: this.wmsParams.transparent,%0A          version: this.wmsParams.version,%0A          format: this.wmsParams.format,%0A          bbox: this._map.getBounds().toBBoxString(),%0A          height: size.y,%0A          width: size.x,%0A          layers: this.wmsParams.layers,%0A          query_layers: this.wmsParams.layers,%0A          info_format: 'application/vnd.ogc.gml'%0A        %7D;%0A%0A    params%5Bparams.version === '1.3.0' ? 'i' : 'x'%5D = point.x;%0A    params%5Bparams.version === '1.3.0' ? 'j' : 'y'%5D = point.y;%0A%0A    return this._url + L.Util.getParamString(params, this._url, true);%0A  %7D,%0A%0A  showGetFeatureInfo: function (err, latlng, content) %7B%0A    if (err) %7B console.log(err); return; %7D // do nothing if there's an error%0A%0A    //get raster value from content%0A    xmlDoc = $.parseXML( content ),%0A     $xml = $( xmlDoc ),%0A     $rasterVal = $xml.find( %22value_0%22 );%0A     val=$rasterVal.text();%0A%0A    // Otherwise show the content in a popup, or something.%0A    L.popup(%7B maxWidth: 800%7D)%0A      .setLatLng(latlng)%0A      .setContent(val)%0A      .openOn(this._map);%0A
   %7D%0A
-%0A
 %7D);%0A

add support getting pixel values this resolves #9