0

I can't show these icons from FontAwesome:

var map = new ol.Map({
        layers: [
          new ol.layer.Tile({
                source: new ol.source.OSM()
            })
        ]
        , target: 'map'
        , controls: ol.control.defaults({
            attributionOptions: {
                collapsible: true
            }
        }), //Vista inicial del mapa
        view: new ol.View({
            center: ol.proj.fromLonLat([-5.9334, 43.5848])
            , zoom: 15
        })
    });
    var vectorLayer = new ol.layer.Vector({
        source: new ol.source.Vector({
            features: new ol.format.GeoJSON().readFeatures(geojsonObject, {
                featureProjection: 'EPSG:3857'
            })
        })
        , style: new ol.style.Style({
            /*image: new ol.style.Circle( /** @type {olx.style.IconOptions} ({
                radius: 20
                , fill: new ol.style.Fill({
                    color: '#000000'
                })
            }))*/
            text: new ol.style.Text({
                text: '\uf041'
                , font: 'normal 38px FontAwesome'
                , fill: new ol.style.Fill({
                    color: '#ff0000'
                 })
            })
        })
    });
    map.addLayer(vectorLayer);

Does anybody use typographic icons as Openlayers icons? I need help...

2

You just need to look at the existing solution on parent forum website StackOverflow

You may prefer using ol.style.FontSymbol from ol-ext project

  • can you give an exemple with maki2? – jlSta Feb 14 at 19:14
  • Please read and follow the answers. The second link of my answer redirects to a solution where Maki2 is supported... Can't do more, sorry. – ThomasG77 Feb 14 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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