2016-10-25 4 views
2

ベクトルタイルポイントフィーチャにラベルを付けることを試みていますが、それらは常にタイル境界で切り取られます。私は(多くの他のものの中で)renderBufferオプションを成功させずに使ってみました。 私はOL 3.19を使用しています。ベクタータイルはGeoserver 2.10RC1で提供されています。私は本番環境で同じエラーを受け取り、無限の例(http://suite.opengeo.org/docs/latest/dataadmin/vectortiles/index.html)を編集しています。OL3/Geoserver:ベクトルタイルラベルが切り取られる

タイルはGeoserverから正しく提供され、プレゼンテーションの前に何らかの形でレンダリングしてタイルをスライスすると思うかもしれませんが、私はこれに固執しています。

アイデア?

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 
 
    }), 
 
\t text: new ol.style.Text({ 
 
\t text:'LOREMIPSUM'}) 
 
    }); 
 

 
    function simpleStyle(feature) { 
 
    return style_simple; 
 
    } 
 
    
 
    var map = new ol.Map({ 
 
    target: 'map', 
 
    view: new ol.View({ 
 
\t \t center: [0,0], 
 
\t \t zoom: 4 
 
    }), 
 
    layers: [new ol.layer.VectorTile({ 
 
\t 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/[email protected]%[email protected]/{z}/{x}/{-y}.pbf' 
 
     }) 
 
    })] 
 
    }); 
 
    </script>

+0

'renderBuffer'オプションは役に立ちません。下の回答に示唆されているように、タイルは隣接するタイルのラベルポイントを繰り返す必要があります。 – ahocevar

答えて

2

私はol.layer.VectorTileとテキストラベルで同じ問題を抱えています。
すべてのラベルがタイル境界でスライスされます。

enter image description here
全例:https://jsfiddle.net/rn3qc4ca/

私は助けをOpenLayersを開発者に尋ねた:https://github.com/openlayers/ol3/issues/6275
- >をこれは、OpenLayersをのバグではありません。マップボックスのタイルは、実際には隣接するタイルのラベルポイントを繰り返します。非常に大きなフォントを使用すると、ラベルは切り取られます。


マイ(未実装)アイデアは、別々のol.layer.Vector層にすべてのラベルを配置することです。このタイプのレイヤーはタイルにスライスされないので、常に完全に印刷されます。

+0

OL3の例(http://openlayers.org/en/latest/examples/mapbox-vector-tiles-advanced.html)では、ラベルが素晴らしいようになったので、それは本当に奇妙です。 – JohnnyBrattom

+0

この例のMapboxタイルは、隣接するタイルのラベルを繰り返します。これが彼らがそこで偉大に見える理由です。 – ahocevar

関連する問題