Skip to content

Error found when using L.icon #110

Description

@AlbertoMCS

Hi,
I have the following layer:

lyrPow = L.geoJSON(jsnPow,{pointToLayer:returnPow}).addTo(mymap);

function returnPow(json, latlng) {
                var att = json.properties;
                var name = att.distname;
                var custompopPow = '<p style="padding: 3px 3px;text-align: center;font-family: sans-serif;color:white;margin-bottom: 0;font-weight: bold;font-size: 12px;background:#BF40BF">Place Of Worship</p><b>Name: </b>'+name;
                
                return L.marker(latlng, {opacity:1, fillOpacity:1, icon:iconPow}).bindPopup(custompopPow, {permanent: false, opacity: 0, className : 'popupCustom', closeButton:'', maxWidth:400})

var svgPow = '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="pray" class="svg-inline--fa fa-pray fa-w-12" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" height="12" width="12"><path fill="darkorchid" d="M256 128c35.35 0 64-28.65 64-64S291.35 0 256 0s-64 28.65-64 64 28.65 64 64 64zm-30.63 169.75c14.06 16.72 39 19.09 55.97 5.22l88-72.02c17.09-13.98 19.59-39.19 5.62-56.28-13.97-17.11-39.19-19.59-56.31-5.62l-57.44 47-38.91-46.31c-15.44-18.39-39.22-27.92-64-25.33-24.19 2.48-45.25 16.27-56.37 36.92l-49.37 92.03c-23.4 43.64-8.69 96.37 34.19 123.75L131.56 432H40c-22.09 0-40 17.91-40 40s17.91 40 40 40h208c34.08 0 53.77-42.79 28.28-68.28L166.42 333.86l34.8-64.87 24.15 28.76z"></path></svg>'; 
                var iconUrlPow = 'data:image/svg+xml;base64,' + btoa(svgPow);
                //var iconUrl = 'data:image/svg+xml;base64,' + svg;
                var iconPow = L.icon({
                iconUrl: iconUrlPow,
                });

But when clicking on one element I get the following error:

Leaflet.StyleEditor.js:1084 Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf')
at e._getMarkerUrl (Leaflet.StyleEditor.js:1084)
at e._getMarkerUrlForStyle (Leaflet.StyleEditor.js:1079)
at e.createMarkerIcon (Leaflet.StyleEditor.js:1062)
at e._createMarkerIcon (Leaflet.StyleEditor.js:945)
at e.setNewMarker (Leaflet.StyleEditor.js:884)
at e.setStyle (Leaflet.StyleEditor.js:905)
at Leaflet.StyleEditor.js:934
at Array.forEach ()
at e.resetIconOptions (Leaflet.StyleEditor.js:933)
at e.initChangeStyle (Leaflet.StyleEditor.js:1524)

Any idea how can I solve this?

With normal L.marker (without L.Icon) it works well.
Many thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions