mpetazzoni / leaflet-gpx

A GPX track plugin for Leaflet.js
http://mpetazzoni.github.io/leaflet-gpx
BSD 2-Clause "Simplified" License
529 stars 114 forks source link

I couldn't see a way to disable marker icons for the start and end points. #102

Closed kreativejuices closed 3 years ago

kreativejuices commented 3 years ago

Love this plugin, just couldn't see any way to disable the start and end markers. I only wanted the polyline to be shown. So i tried this,

marker_options: { startIconUrl: '', endIconUrl: '', shadowUrl: '' }

It does the job but wondered if there was a better way to do this?

Thanks! :)

mpetazzoni commented 3 years ago

That's the way; a slightly cleaner version is to set them to null instead of an empty string. The code just checks for "falsy":

if (options.marker_options.startIcon || options.marker_options.startIconUrl) {

https://github.com/mpetazzoni/leaflet-gpx/blob/main/gpx.js#L537-L554