OpenLayers 3 中的样式矢量切片层点特征被裁剪
Style vector tile layers point features in OpenLayers 3 get cropped
使用 OpenLayers 3 (v3.18.2) 在 ol.layer.VectorTile
图层中渲染时,有没有办法避免 cropped point styles?
示例相关代码如下:
layer = new ol.layer.VectorTile({
source: new ol.source.VectorTile({
url: 'http://localhost:8181/schools/{z}/{x}/{y}.pbf',
format: new ol.format.MVT(),
tileGrid: ol.tilegrid.createXYZ({maxZoom: 22}),
tilePixelRatio: 16
}),
style: function(feature) {
return new ol.style.Style({
image: new ol.style.Circle({
fill: new ol.style.Fill({
color: 'rgba(105, 105, 105, 1.0)'
}),
stroke: new ol.style.Stroke({
width: 1,
color: 'rgba(105, 105, 105, 0.3)'
}),
radius: 7
}),
text: new ol.style.Text({
color: '#FFFFFF',
fontFamily: 'Calibri,sans-serif',
fontSize: 12,
text: feature.get("count").toString(),
labelYOffset: -12
})
});
}
});
map.addLayer(layer);
您必须以不同方式生成矢量切片,即使用缓冲区,因此您的切片还包括来自相邻切片的附近点。
使用 OpenLayers 3 (v3.18.2) 在 ol.layer.VectorTile
图层中渲染时,有没有办法避免 cropped point styles?
示例相关代码如下:
layer = new ol.layer.VectorTile({
source: new ol.source.VectorTile({
url: 'http://localhost:8181/schools/{z}/{x}/{y}.pbf',
format: new ol.format.MVT(),
tileGrid: ol.tilegrid.createXYZ({maxZoom: 22}),
tilePixelRatio: 16
}),
style: function(feature) {
return new ol.style.Style({
image: new ol.style.Circle({
fill: new ol.style.Fill({
color: 'rgba(105, 105, 105, 1.0)'
}),
stroke: new ol.style.Stroke({
width: 1,
color: 'rgba(105, 105, 105, 0.3)'
}),
radius: 7
}),
text: new ol.style.Text({
color: '#FFFFFF',
fontFamily: 'Calibri,sans-serif',
fontSize: 12,
text: feature.get("count").toString(),
labelYOffset: -12
})
});
}
});
map.addLayer(layer);
您必须以不同方式生成矢量切片,即使用缓冲区,因此您的切片还包括来自相邻切片的附近点。