这是我的代码:
var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([-95.3698,29.7604], 'EPSG:4326' , 'EPSG:3857')),
name: 'Null Island',
});
var iconStyle = new ol.style.Style({
image: new ol.style.Icon({
opacity: 0.75,
src: 'flag.png',
height:10,
width:10,
})
});
iconFeature.setStyle(iconStyle);
我也尝试过使用锚点,但无法减小尺寸,请帮忙
ol.style.Icon http://openlayers.org/en/latest/apidoc/module-ol_style_Icon-Icon.html需要一个scale
可用于缩放图标的参数。
var iconStyle = new ol.style.Style({
image: new ol.style.Icon({
opacity: 0.75,
src: 'flag.png',
// the real size of your icon
size: [10, 10],
// the scale factor
scale: 0.5
})
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)