1

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?

New contributor
D.Franco is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

0

Your Answer

D.Franco is a new contributor. Be nice, and check out our Code of Conduct.

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.