1
我现在搜索了2个小时,但目前还不清楚OL3中是否有可能。 我想我的图标是固定的大小(不是屏幕,而是我使用的图像映射)。我的意思是,它应该覆盖相同的区域,即使我缩小了,并且不覆盖地图的一半(比如我使用的是圆多边形,但是我有复杂的图标,所以我必须将它用作点要素)。有没有解决办法? 像QGIS:MAP UNITS一样。修复OpenLayers中的图标大小3
我已经有这些:
var jelekStyle = function(feature, resolution) {
if(feature.get('tipus')=== 'falu') {
icon = '00_ikonok/falu.png',
size = [115, 233],
scale = 0.05,
anchor = [0.5,46];
} else if(feature.get('tipus')=== 'puszta') {
image = '00_ikonok/puszta.png';
} ...
}
return [new ol.style.Style({
image: new ol.style.Icon({
src: icon,
scale: scale,
size: size,
anchor: anchor,
anchorXUnits: 'fraction',
anchorYUnits: 'pixels'
})
})];
};
...
var jelek = new ol.layer.Vector({
source: new ol.source.Vector({
url: 'sopron_honlap/json/Gorog-Kerekes_Sopron_jelek_GeoJSON.geojson',
format: new ol.format.GeoJSON()
}),
updateWhileAnimating: true,
updateWhileInteracting: true,
style: jelekStyle
});