![](/img/trans.png)
[英]How to set an extent to a VectorTile layer in OpenLayers 4.2.0?
[英]How can OpenLayers 3 be forced to use new geometry on each zoom with VectorTile
ol.source.VectorTile
是从GeoJSON返回的功能,它们在不同的缩放级别具有不同的几何形状。 使用ol.layer.VectorTile
,几何似乎没有更新或使用其他缩放级别提供的几何。
有没有办法针对相对缩放级别强制使用要素几何进行重绘?
到目前为止,我一直在弄乱ol.style.Style
的geometry参数,以查看是否可以通过它实现,但到目前为止还没有任何乐趣。
let map = map = new ol.Map({
controls: controls,
loadTilesWhileAnimating: true,
loadTilesWhileInteracting: true,
target: config.target,
interactions: ol.interaction.defaults({
altShiftDragRotate: false,
pinchRotate: false
}),
view: config.view
});
let tileLayer = new ol.layer.Tile({
source: new ol.source.XYZ({
url: config.tileUrl,
tilePixelRatio: 2,
projection: config.projection
});
});
map.addLayer(tileLayer);
let vectorLayer = new ol.layer.VectorTile({
projection: config.projection,
renderMode: 'vector',
source: new ol.source.VectorTile({
projection: config.projection,
format: new ol.format.GeoJSON(),
url: config.vectorUrl,
tileGrid: ol.tilegrid.createXYZ({
extent: config.extent
})
}),
style: config.styler
});
map.addLayer(vectorLayer);
检查几何是否正确。 我发现我得到的数据没有正确的几何形状,因此它们没有出现在预期的位置!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.