bashkan
bashkan

Reputation: 464

Openlayer 3 Vector KML style no longer work?

I'm using OpenLayers 3 since a short time. I've finished an application include of map with OpenLayers 3 ten days ago. But today I checked the application that, styles no longer work on KML. Does anyone have any idea?

var layer1 = new ol.layer.Vector({
        source: new ol.source.KML(({
            url: '#',
            projection: 'EPSG:900913'
        }))
         , style: [new ol.style.Style({
             stroke: new ol.style.Stroke({ color: 'black', width: 10 })
         })]
    });

Upvotes: 1

Views: 1662

Answers (1)

tonio
tonio

Reputation: 2376

Yes, there’s been a change in the library: [1] now feature styles has precedence over layer style. To make your code works, tell your format not to extract styles from the KML like in [2]:

source: new ol.source.KML(({
    extractStyles: false,
    url: '#',
    projection: 'EPSG:900913'
}))

Upvotes: 2

Related Questions