我试图为leafletJS地图设置一个映射层的样式,并有以下代码,但它似乎一点颜色都没有:
var vectorTileOptions = {
rendererFactory: L.canvas.tile,
vectorTileLayerStyles: {
weight: 2,
color: 'yellow',
},
};
var mapLayer = L.vectorGrid.protobuf("/tiles/admin_countries/{z}/{x}/{y}", vectorTileOptions)它只是呈现标准的蓝色,我不知道我做错了什么,任何建议都会很好。
发布于 2020-04-16 17:51:46
答案可以是found here,通过单击日志e.layer来控制台,您可以获得用作vectorTileOptions键的属性,然后根据需要进行样式设置。
发布于 2020-04-15 18:59:17
这样可以做到:
.setStyle({fillColor: '#dd0000', color: '#dd0000', weight: 1, opacity: 0.8, fillOpacity: 0.8});实际上,不,我认为你需要调整一下你所拥有的:
vectorTileLayerStyles: {
weight: 2,
fillColor: '#9bc2c4'
},这里有很多关于它的地方:https://leaflet.github.io/Leaflet.VectorGrid/vectorgrid-api-docs.html#styling-vectorgrids
https://stackoverflow.com/questions/61233583
复制相似问题