[GIS] Using Bootstrap Glyphicons as markers for vector layer in Openlayers3

bootstrap-frameworkiconkmlopenlayersvector-layer

I want to use the bootstrap glyphicon set as markers for a kml layer in an application using openlayers 3. I have tried the following:

var shopStyle = new ol.style.Style({
        image: new ol.style.Icon({
            anchor: [0.5, 0.5],
            size: [50, 50],
            opacity: 1,
            scale: 0.25,
            src: $('<span class="glyphicon glyphicon-shopping-cart"></span>')
        })
    });

This doesn't work – the layer isn't rendered at all. What is the right way to do it?

Best Answer

Although the dvmac01 concerns, I would like to complete the answer with glyphicons. You can use the folowing Text Style:

var styleIcon = new ol.style.Style({
    text: new ol.style.Text({
        text: '\ue062',
        font : 'normal 18px "Glyphicons Halflings"',
        textBaseline: 'Bottom',
        fill: new ol.style.Fill({
            color: 'blue',
        })                    
    })