How to add GeoJSON points as a vector tile in Leaflet?

六眼飞鱼酱① 提交于 2019-12-06 13:23:12

I've had a look at this for a few minutes, and I've concluded there are bugs in Leaflet.VectorGrid affecting slicing points. I've opened a bug report with relevant information.

I was able to resolve the issue I was experiencing with Leaflet.VectorGrid.Slicer.

First I downloaded the Leaflet.VectorGrid.js source code and changed the lines indicated here (note that that corresponds to lines 1483 to 1495 from the source code available on the VectorGrid github site).

Then, after troubleshooting, I found that if I added a radius option when calling L.vectorGrid.slicer, the GeoJSON points were added to the map. This is the code that worked:

var layer = L.vectorGrid.slicer(geoJson, { 
    vectorTileLayerStyles: {
        sliced: {
            radius: 1,
        }
    }
}).addTo(map);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!