Leaflet-WFST icon indicating copy to clipboard operation
Leaflet-WFST copied to clipboard

Provide more docs about the plugin constructor

Open maux224 opened this issue 5 years ago • 0 comments

In my project i'm trying to view data returned from Qgis Server. The data are MultiPolygon. So basically i wrote this kind of file below:

import 'leaflet-wfst'
export default function (map) {
const L = window.L
const wfstPointOptions = {
  crs: L.CRS.EPSG4326,
  showExisting: true,
  geometryField: 'geom',
  url: `http://localhost:8080/geoserver/wfs`,
  typeNS: 'test',
  typeName: 'test',
  maxFeatures: 90,
  opacity: 1,
  style: function(layer) {
    // you can use if statemt etc
    return {
      color: 'black',
      weight: 1
    }
  },
}
const wfstPoint = new L.WFST(wfstPointOptions, new L.Format.GeoJSON({
  crs: L.CRS.EPSG4326,
  pointToLayer(geoJsonPoint, latlng) {
    const layer = new L.CircleMarker(latlng, {
      radius: 10,
    });
    return layer;
  },
}))
wfstPoint.addTo(map)
}

Then in my map component i just do

import WMSLayer from '.....'
// pass the Leaflet instance of the map not Vue2Leaflet
new WMSLayer(myLeafletMap)

The results are black rounded polygons on the map and this is ok. The question here is what is iside the wfstPoint constant? I wasn't able to find documentation about it. Moreover i tried to insert a log inside the pointToLayer function but it seems that code is never executed. My intention is to draw a polygon on the map with a text (or a marker) showing the name of object.

I am developing a project with Vue.js and Vue2Leaflet.

maux224 avatar Mar 10 '20 18:03 maux224