OL3/Geoserver:矢量图块标签被裁剪 [英] OL3 / Geoserver: Vector tile labels gets cropped

查看:108
本文介绍了OL3/Geoserver:矢量图块标签被裁剪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试标记矢量平铺点要素,但是它们总是在平铺边界处被裁剪.我已经尝试了renderBuffer选项(还有很多其他事情),但没有成功. 我使用的是OL 3.19,Geoserver 2.10RC1提供了矢量图块,在生产环境中以及编辑无边距示例时,我也遇到了相同的错误(

I am trying to label vector tile point features but they always gets cropped at the tile border. I have tried (among many other things) using the renderBuffer option with no success. I am using OL 3.19 and the vector tiles are served with Geoserver 2.10RC1 and I get the same errors in my production environment as well as editing an Boundless example (http://suite.opengeo.org/docs/latest/dataadmin/vectortiles/index.html).

我认为可能是从Geoserver正确提供了切片,并且Openlayers以某种方式呈现了这些切片,然后在切片之前对其进行了切片,但我对此有些犹豫.

I think maybe the tiles are served correctly from Geoserver and that Openlayers somehow render and then slices the tiles before presentation but I am kind of stuck on this.

有什么想法吗?

屏幕外观截图

以及代码段:

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

推荐答案

我在ol.layer.VectorTile和文本标签上也遇到了同样的问题.
所有标签均在图块边界上切片.

I have the same problem with ol.layer.VectorTile and text labels.
All labels are sliced on the tile boundaries.


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


Full example: https://jsfiddle.net/rn3qc4ca/

我向openlayers开发人员寻求帮助: https://github.com/openlayers/ol3 /issues/6275
->这不是openlayers中的错误. Mapbox磁贴实际上在相邻磁贴中重复了标签点.如果使用非常大的字体,标签仍将被裁剪.

I asked the openlayers developers for help: https://github.com/openlayers/ol3/issues/6275
-> This is not a bug in openlayers. The mapbox tiles really repeat the label points in neighbored tiles. If you use very big fonts the label will still be cropped.

我(未实现)的想法是将所有标签放置在单独的ol.layer.Vector层中.由于这种类型的图层没有切成小块,因此始终可以完全打印出来.

My (unimplemented) idea is to place all labels into a separate ol.layer.Vector layer. As this type of layer is not sliced into tiles it is always printed completely.

这篇关于OL3/Geoserver:矢量图块标签被裁剪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆