当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - How to configure the Styles in openlayers 3?

问题描述:

I am very new to openlayers and trying to configure the styles for polygon, line and Point feature, once I configure the styles then I can able to call that styles whenever I define the layers. I tried this code but not working(tried only for polygon).

var test = {

"polygon": {

id: "polygon",

style: new ol.style.Style({

stroke: new ol.style.Stroke({color: 'green', width: 1})

})

},

"polygon1": {

id: "polygon1",

style: new ol.style.Style({

stroke: new ol.style.Stroke({color: 'blue', width: 1})

})

}

};

var geojson_layer = new ol.layer.Vector({

source: new ol.source.Vector({

url: 'file.geojson',

format: new ol.format.GeoJSON()

}),

style: styleFunction

});

分享给朋友:
您可能感兴趣的文章:
随机阅读: