Flexberry / Leaflet-WFST

OGC WFS-T client layer for Leaflet.
http://flexberry.github.io/Leaflet-WFST/
MIT License
151 stars 50 forks source link

can not get Layer and Layer Properties use 'getLayers()' #45

Closed ailong closed 7 years ago

ailong commented 7 years ago

I can add wfs layer to map,but can not get Layer and Layer Properties use 'getLayers()'

ailong commented 7 years ago

image How to get feature properties?

arszp10 commented 7 years ago
  1. you can use boundaries.addTo(map)
  2. getLayer() should be call in inner function of event 'load'
arszp10 commented 7 years ago
const objGeneral = {
  url: 'http://' + document.domain + ':8080/geoserver/wfs',
  geometryField: 'test',
  typeNS: 'test',
  typeName: 'test',
  filter: new L.Filter.EQ().append('test', 0),
  crs: L.CRS.EPSG4326,
  style: {
    color: 'blue',
    weight: 12,
    opacity: 0.5
  }
};

const wfsGeneral = new L.WFST(objGeneral).addTo(map);

wfsGeneral.on('load', function () {
  wfsGeneral.eachLayer((layer) => {
    console.log(layer.getProperty('test'))
  });
});
ailong commented 7 years ago

Thank You @arszp10