mpetazzoni / leaflet-gpx

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

Alternative distance marker version. #73

Closed dave-p closed 4 years ago

dave-p commented 6 years ago

This is an alternative to my PR#72. It avoids the problem of the distance markers being overwritten by the track, by using a divIcon instead of CircleMarker (which is higher in the Z-order than the track). The PR uses a few lines of code from the Leaflet-distance-marker plugin. I believe the Copyright notice permits that. Please use whichever version you prefer.

jfdemeyre commented 5 years ago

Hi, Thanks for your work. The kilometer points (in red on the map) are not on the track, they are a bit below and are not round like the mile points (in blue). Can you explain why ? image

dave-p commented 5 years ago

Are you using the default options for the markers (other than colour)? And are the kilometer and mile options the same? Incidentally the 'radius' option actually specifies the diameter for this version. screenshot

jfdemeyre commented 5 years ago

Yes, I think I'm using the default options...

The demo page is here but my server is not always up.

Here is a copy of my faulty code...

 

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.4/dist/leaflet.css"   | integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA=="   | crossorigin=""/>  

<script src="https://unpkg.com/leaflet@1.3.4/dist/leaflet.js" integrity="sha512-nMMmRyTVoLYqjP9hrbed9S+FzjZHW5gY1TWCHA5ckwXZBadntCNs8kEqAWdrb9O7rxbCaA4lKTIWjDXZxflOcA==" crossorigin="">

dave-p commented 5 years ago

Please try the latest version of the PR - there was a copy + paste error in setting the marker size. And thanks for reporting the problem.

jfdemeyre commented 5 years ago

Great !

image

The new PR works. Thanks a lot I didn't find the copy paste error when I checked ! Best regards, JF