The vector Tile come from geoserver. I want to get the id when I click it and use it to send WFST to geoserver (WFST requires fid).

                var vectorTileOptions = {
                    LayerName: Layer.NAME,
                    layerImg: Layer.IMG,
                    rendererFactory: L.svg.tile,
                    tms: true,
                    interactive: true,
                    getFeatureId: function (f) {
                        return f.id;
                    vectorTileLayerStyles: {
                        [Layer.STYLENAME]: Layer.STYLE
                var vectorTileLayer = new L.vectorGrid.protobuf(Layer.URL, vectorTileOptions).addTo(FeatureGroup);
                vectorTileLayer.on('click', (e) => {
                    this.latlng = e.latlng
                    console.log(f.id)//do something
                    var properties = e.layer.properties;
                    var popupcontent = this.getPopupContent(properties)
                    L.popup({ className: 'featurePopup' })
  • Instead of logging f.id on layer click (which does not exist, since f does not exist there), log e.layer.id. That should be feature id you are looking for.
    – TomazicM
    Jan 12 at 22:04


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.