showGetFeatureInfo: function(err, latlng, content){
// alert(this.wmsParams.layers);
var lyr=this.wmsParams.layers;
if(lyr=='sinhthai:rung_1980' || lyr=='sinhthai:rung_1990' || lyr=='sinhthai:rung_2000' || lyr=='sinhthai:rung_2010' || lyr=='sinhthai:rung_2018'){
var res_obj = JSON.parse(content);
var code=res_obj.features[0].properties.PALETTE_INDEX;
// raster2info(code,this.wmsParams.layers);
// console.log(code, raster2info);
if(code!=9){
var info=raster2info(code,lyr);
var info_frm='<h3>'+info['ten']+'</h3>'+'<img src="upload/images/raster_info_rung/'+info['img']+'" width="440" height="280"></img>';
}else{
// Giá trị 9 là background
var info_frm=''
}
}else{
var info_frm='';
}
if(info_frm!=''){
L.popup({ maxWidth: 800})
.setLatLng(latlng)
.setContent(info_frm)
.openOn(this._map);
}
}
Created
April 8, 2021 02:19
-
-
Save soiqualang/56af950e286d8409b505ea94ae179a59 to your computer and use it in GitHub Desktop.
Get feature info for each layer - L.TileLayer.BetterWMS.js
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment