[英]How can OpenLayers 3 be forced to use new geometry on each zoom with VectorTile
We have features returned from the GeoJSON that ol.source.VectorTile
consumes that have differing geometries at the varying zoom levels. ol.source.VectorTile
是从GeoJSON返回的功能,它们在不同的缩放级别具有不同的几何形状。 When using the ol.layer.VectorTile
the geometry doesn't appear to update or uses the geometry provided from a different zoom level. 使用ol.layer.VectorTile
,几何似乎没有更新或使用其他缩放级别提供的几何。
Is there a way to force a redraw with the feature geometry for the relative zoom level? 有没有办法针对相对缩放级别强制使用要素几何进行重绘?
So far I've been messing with ol.style.Style
's geometry parameter to see if I can get it through that but no joy as of yet. 到目前为止,我一直在弄乱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);
Check geometry is correct. 检查几何是否正确。 I found the data I was getting didn't have the correct geometries hence they weren't appearing where expected! 我发现我得到的数据没有正确的几何形状,因此它们没有出现在预期的位置!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.