如何在传单的标记弹出窗口中显示图层详细信息?

时间:2019-07-05 09:43:24

标签: leaflet

我尝试获取弹出窗口的代码不起作用,我希望每当我的标记指向位置时自动获取弹出窗口,在弹出窗口中我想显示图层详细信息。

function pop_Area_ZONE_1(feature, layer) {
  var popupContent = feature.properties.Zone_Name;
  layer.bindPopup(popupContent).addTo(map);
}

var layer_Area_ZONE_1 = new L.geoJson(json_Area_ZONE_1, {
  attribution: "",
  pane: "pane_Area_ZONE_1",
  onEachFeature: pop_Area_ZONE_1,
  style: style_Area_ZONE_1_0
});
bounds_group.addLayer(layer_Area_ZONE_1);
map.addLayer(layer_Area_ZONE_1);

L.marker([{{lat}}, {{lng}}], { icon: myIcon })
  .addTo(map)
  .bindPopup(popupContent)
  .openPopup();
map.setView(new L.LatLng({{lat}}, {{lng}}), {{zoom}});
setBounds();

0 个答案:

没有答案