【发布时间】:2017-03-07 04:45:08
【问题描述】:
我正在尝试标记矢量瓦片点特征,但它们总是在瓦片边界处被裁剪。我已经尝试(以及许多其他事情)使用 renderBuffer 选项但没有成功。 我使用的是 OL 3.19,矢量切片由 Geoserver 2.10RC1 提供,我在生产环境中遇到了同样的错误,并且在编辑 Boundless 示例 (http://suite.opengeo.org/docs/latest/dataadmin/vectortiles/index.html)。
我认为可能从 Geoserver 正确地提供了瓷砖,并且 Openlayers 以某种方式渲染然后在呈现之前对瓷砖进行切片,但我有点坚持这一点。
有什么想法吗?
Screenshot of the way it looks
还有代码sn-p:
<script>
var style_simple = new ol.style.Style({
fill: new ol.style.Fill({
color: '#ADD8E6'
}),
stroke: new ol.style.Stroke({
color: '#880000',
width: 1
}),
text: new ol.style.Text({
text:'LOREMIPSUM'})
});
function simpleStyle(feature) {
return style_simple;
}
var map = new ol.Map({
target: 'map',
view: new ol.View({
center: [0,0],
zoom: 4
}),
layers: [new ol.layer.VectorTile({
renderBuffer:50, //doesn't matter
style:simpleStyle,
source: new ol.source.VectorTile({
tilePixelRatio: 1,
tileGrid: ol.tilegrid.createXYZ({maxZoom: 19}),
format: new ol.format.MVT(),
url: 'http://localhost:8080/geoserver/gwc/service/tms/1.0.0/testlayer@EPSG%3A3857@pbf/{z}/{x}/{-y}.pbf'
})
})]
});
</script>
【问题讨论】:
-
renderBuffer选项无济于事。就像下面答案中建议的那样,您的图块需要在相邻图块上重复标签点。