首页 文章

OL3 / Geoserver:矢量切片标签被裁剪

提问于
浏览
2

我正在尝试标记矢量切片点要素,但它们总是在切片边框处被裁剪 . 我已尝试(在许多其他事情中)使用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

和代码片段:

<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>

1 回答

  • 2

    我对 ol.layer.VectorTile 和文本标签也有同样的问题 .
    所有标签都在瓷砖边界上切片 .

    enter image description here

    完整示例:https://jsfiddle.net/rn3qc4ca/

    我向openlayers开发者寻求帮助:https://github.com/openlayers/ol3/issues/6275

    • 这不是openlayers中的错误 . Map 框图块实际上重复了相邻图块中的标注点 . 如果使用非常大的字体,标签仍将被裁剪 .


    我的(未实现的)想法是将所有标签放入单独的 ol.layer.Vector 层 . 由于这种类型的图层没有切成瓷砖,因此总是完全打印 .

相关问题