leaflet-gpx icon indicating copy to clipboard operation
leaflet-gpx copied to clipboard

Specifying marker URL doesn't work

Open akkana opened this issue 5 months ago • 1 comments

Great plugin, thanks!

The README says I can specify custom marker icons with the URL of the image file, so I tried

 const options = {
   async: true,
   polyline_options: { color: 'purple' },
   startIcon: 'css/images/start-icon.png',
 };

But it isn't working for me, even when I specify an absolute URL like

   startIcon: 'http://localhost/nmhiking/css/images/start-icon.png',
   endIcon: 'http://localhost/nmhiking/css/images/start-icon.png',

and verify that the URL works in a browser. The track still starts and ends with the default leaflet icon that's used for other markers. Am I misunderstanding the documentation? I know the options are getting processed because changing the color of the polyline works.

Also, could you clarify in the README what those wptIcons keys like 'Coffee shop' correspond to in a GPX file?I'm not sure what to make of "wptIcons and wptTypeIcons are mappings of waypoint symbols and types to the icon you want to use for each". What's a type? Can I add something like Coffee shop to my waypoints? (I've never seen a GPX that has types for icons, and web searching isn't finding much.) And what's the difference between wptIcons and wptTypeIcons -- do their keys match different fields, like for wptIcons and for wptTypeIcons?

akkana avatar Nov 06 '25 22:11 akkana

Did you try specifying it within the markers parameter like this:

const options = {
  async: true,
  markers: {
    startIcon: 'css/images/start-icon.png',
  },
  polyline_options: { color: 'purple' }
};

jengalas avatar Nov 08 '25 13:11 jengalas