我如何在Geoserver的传单wms层上实现弹出窗口

时间:2019-03-24 16:51:13

标签: popup leaflet geoserver

我想在地图上显示该图层的弹出窗口,该图层来自geoserver wms

map.addEventListener("click", onMapClick);
popup_layer= new L.Popup({maxwidth:700});
wms_server='http://localhost:8080/geoserver/wms';


fonction onMapClick(e) {
 var BBOX=map.getBounds().toBBoxString();
 var WIDTH=map.getSize().x;
 var HEIGHT=map.getSize().y;
 var X=map.layerPointToContainerPoint(e.LayerPoint).x;
 var Y=map.layerPointToContainerPoint(e.LayerPoint).y;
 var URL=wms_server+'wms?service=WMS&version=1.1.0&request=GetMap&layers=abhbc%3Avw_ires&bbox='+BBOX+'&width=330&height=768&srs=EPSG%3A26191&format=application/openlayers';
 $.ajax({
    url: URL,
    datatype:"html",
    type:GET,
    success: function (data) {
       var popup= new L.popup({maxwidth:300})
   popup.setcontent(data)
   popup.setlatlng(e.latlng);
   map.openPopup(popup);
                             },

      });
                  }

这是我尝试过的代码,但不起作用

0 个答案:

没有答案