0

Using the FlexBerry WFS-T leaflet plugin, I am looking to add a subset of my WFS-T service using a filter. The following code works if I exclude the filter parameter.

The function creates a polygon around a map click and attempts to add WFS-T service features intersecting with this polygon to the map. Hopefully I am interpreting the plugin docs correctly for correct usage of filters.

var map = L.map('map', {
    zoomControl:true,
    maxZoom:28,
    minZoom:1,
    tap: false
});

map.on("click", clickFeature);

function clickFeature(e) {
  var rooturl = 'http://localhost/geoserver/ged/ows';
  var clickPolygon = L.polygon([L.latLng(e.latlng.lat, e.latlng.lng), L.latLng(e.latlng.lat, e.latlng.lng + .1), L.latLng(e.latlng.lat + .1, e.latlng.lng + .1), L.latLng(e.latlng.lat+ .1, e.latlng.lng)])

  clickPolygon.addTo(map);

  var intersect_click_filter = new L.Filter.Intersects('ogr_geometry', clickPolygon, L.CRS.EPSG4326);

  var selected_wfst = new L.WFST({
    url: rooturl,
    typeNS: 'ged',
    typeName: 'GED_IDV',
    crs: L.CRS.EPSG4326,
    geometryField: 'geom',
    showExisting: true,
    filter: intersect_click_filter,
    style: {
      color: 'blue',
      weight: 2
    }
  });

    selected_wfst.addTo(map);    
  }

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.