Autodetection of L.Icon.Default.imagePath, getScript() inclusion
See original GitHub issueThe method used to auto detect the correct path to the default marker and shadow images causes problems under two circumstances:
-
The search regex
/\/?leaflet[\-\._]?([\w\-\._]*)\.js\??/
also matches unintended similar files such asleafletFooBar.js
, giving the markers the wrong relative path. Since onlyleaflet.js
andleaflet-src.js
need to be matched,/\/?leaflet(-src)?\.js\??/
might work instead. -
The nature of the method being used (search the page for the correct script tag) defeats the use of
getScript()
to includeleaflet.js
from another file, as in this case the desired script tag is not present in the page.
Issue Analytics
- State:
- Created 11 years ago
- Comments:18 (5 by maintainers)
Top Results From Across the Web
How to change the default icon pin on leaflet directive?
From the Leaflet documentation, see Icon.Default : In order to change the default icon, just change the properties of L.Icon.Default.prototype.options ...
Read more >"Error: Couldn't autodetect L.Icon.Default.imagePath, set it ...
When researching my issue I came across a related libraries issue. It seemed to suggest that using the inline code method is not...
Read more >L.Icon - WRLD3D
Icon. Represents an icon to provide when creating a marker. Usage example. var myIcon = L.icon({ iconUrl: 'my-icon.png', iconSize: [38, 95], iconAnchor: [22 ......
Read more >Untitled
makeArray( selector, this ); }, // Start with an empty selector selector: "", // The default length of a jQuery object is 0...
Read more >https://ora.ox.ac.uk/objects/uuid:968655ac-e8ec-4b...
toLowerCase().split(ee),a=0,l=s.length;a<l;a++)i=s[a],o=/^\+/.test(i) ... imagePath;if(!n)throw new Error("Couldn't autodetect L.Icon.Default.
Read more >Top Related Medium Post
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue here after moving
<leaflet-map>
from the index file into a component (using Polymer here).I had to set the path like this:
And the map would display the icons again.