1

I am setting up a basic Leaflet Dashboard. This combines a Leaflet map view with a live table.

Demo: DAW Dashboard

I have been able to add a WMS service that I have made on Geoserver. This allows me to show project contours by adding de project "Id" in the CQL filter.

I have added the layer in de code:

var geototaal = L.tileLayer.wms("http://h2641061.stratoserver.net/geoserver/DAW_Suport/wms?&CQL_FILTER=Id%3D5", {
layers: 'DAW_Suport:geo_totaal',
attribution: 'Basemap <a href="https://DAW.nl/" target="_blank">DAW Project</a>'
});

The CQL filter is now set to only get the contour of project with Id = 5

I also have a layer with point data (GEOJSON) that the dashboard uses to build the project marker locations and fill the table view. if I click on a project marker is opens a popup with project info (Id and Name). This also highlights the marker.

Code:

pointToLayer: function (feature, latlng) {
  if (feature.properties && feature.properties["marker-color"]) {
    markerColor = feature.properties["marker-color"];
} else {
  markerColor = "#FF0000";
}
return L.circleMarker(latlng, {
  radius: 4,
  weight: 2,
  fillColor: markerColor,
  color: markerColor,
  opacity: 1,
  fillOpacity: 1
});
},
onEachFeature: function (feature, layer) {
if (feature.properties) {
  layer.on({
    click: function (e) {
      identifyFeature(L.stamp(layer));
      highlightLayer.clearLayers();
      highlightLayer.addData(featureLayer.getLayer(L.stamp(layer)).toGeoJSON());


    },
    mouseover: function (e) {
      if (config.hoverProperty) {
        $(".info-control").html(feature.properties[config.hoverProperty]);
        $(".info-control").show();
      }
    },
    mouseout: function (e) {
      $(".info-control").hide();
    }
  });
}

}

I am hoping that some one can help me find a way that will change the URL of the WMS layer (CQL filter number) with a Id of the selected object so the project contour is shown in the map.

I have also made a zip package for download:

http://85.214.221.88/DAW_Support/development/development.rar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.