I am trying to get the GeoJSON of a VectorGrid layer on a click event.
Something like this:
...
var vectorTile = new L.vectorGrid.protobuf(url, options).addTo(map)
vectorTile.on('click', e => {
let layerJson = e.layer.toGeoJson() //toGeoJson is not a function of layer
});
My goal is to be able to store the GeoJSON of the clicked layer in a db, so I can draw it later on another page.
I was not able to find a lot information about this in the internet.
I found a similar question/request, but no solution: https://github.com/Leaflet/Leaflet.VectorGrid/issues/176
Is this doable? Any suggestion on how to accomplish this?