与 Leaflet 一起使用
Leaflet 是适用于移动友好交互式地图的领先开源 JavaScript 库。
您可以使用 Leaflet.VectorGrid 插件添加矢量瓦片。您必须使用 URL 模板初始化 VectorGrid.Protobuf,就像在 L.TileLayers 中一样。区别在于您应该为所有要素定义样式。
L.vectorGrid
.protobuf('http://localhost:3000/points/{z}/{x}/{y}', {
vectorTileLayerStyles: {
'points': {
color: 'red',
fill: true
}
}
})
.addTo(map);