1

I want to style points (vector data) in openlayers. So far console does not show any errors, but points are not displayed as well. My code:

let urlLayer = new ol.layer.Vector({
    source: urlSource,
    style: new ol.style.Style({
        fill: new ol.style.Fill({
            color: 'rgba(255,255,255,0.4)'
        }),
    })
})

Points disappearing after I am adding style.

1 Answer 1

2

Points can only be styled with image or text options. An image can be a RegularShape or Circle, and that can have fill, for example

let urlLayer = new ol.layer.Vector({
    source: urlSource,
    style: new ol.style.Style({
        image: new ol.style.Circle({
            radius: 5,
            fill: new ol.style.Fill({
                color: 'rgba(255,255,255,0.4)'
            }),
        }),
    })
})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.