New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edit/Snapping to Vector Tiles (Protobuf) #1011
Comments
After digging into it, it looks bad for you. It's the same like Leaflet.VecotGrid. It displays the protobuf data as SVG direktly on the map, so there is no Leaflet Layer which can be editted. Maybe it is possible to create snapping points but I haven't test it yet. Maybe we can make it work to move it around with a offset to the tiles but I think it would be never possible to edit them. What do you want to achive? Do you need to modify each single line? And why do you need to have this tiles as protobuf? I suggest you to export the data as GeoJSON. |
@Falke-Design Thank you for your reply!
Primarily, we need to be able to draw shapes using Geoman, and snap the Geoman shapes to the VectorTile layer. (Though full support would of course be ideal.)
Edit: I think the plugins might be using their own custom implementation of Leaflet-layer, instead of using the default one, which might be why Geoman isn't picking up on it. At least, It definitely appears to be getting a lot of the same CSS classes as a standard Leaflet layer.
This is simply what we're currently using. ( It's coming directly from a Tile server, and I'm given to understand it's more performant.) I'm not certain, but it may be possible to convert to GeoJSON, if necessary. Can we still use VectorTiles, or is Geoman incompatible with VectorTiles in general? |
I updated Leaflet.VectorTileLayer and made it possible to create a L.Polyline out of the .pbf data: https://gitlab.com/Falke-Design/Leaflet.VectorTileLayer New functions:
Important! If you get the LatLngs from a low zoom-level the latlngs are not exactly correct. Here you can download the dist files: dist.zip My sample with your tiles:
You can also only use It would be nice if you have some other vector tiles for testing then I can make a Pull Request to the main Library. Also some polygon vector tiles would be nice. |
As requested, I pulled some more vector tiles from various codepens from the internet.... this turned into this turned into (They don't seem to like the toLatLngs function, but other than that, they seem to work pretty well.) (Note: The performance seems very slow inside a codepen, but if I run the code locally, performance is perfectly OK. I suspect the javascript debugger is causing a significant performance slowdown. ) |
Leaflet has some plugins for working with VectorTiles here: https://leafletjs.com/plugins.html#vector-tiles
But none of them appear to work with Geoman.
In this related issue: #664 it seems that Geoman is incompatible with Leaflet.VectorGrid . (Note: This isn't using protobuf, but it's using a VectorTile nonetheless.)
However, the only other Leaflet plugin for this, Leaflet.VectorTileLayer, appears to work in a similar way, and therefore seems to have the same problem. Is this true? Perhaps there's a work-around? (JSFiddle: https://jsfiddle.net/Terrafire123/96b8yvwg/16/.)
If both plugins are incompatible, then what's the recommended method of using Geoman to work with protobuf VectorTiles?
Thank you!
The text was updated successfully, but these errors were encountered: