@raruto/leaflet-elevation 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,324 +1,325 @@
1
- # leaflet-elevation.js
2
-
3
- [![NPM version](https://img.shields.io/npm/v/@raruto/leaflet-elevation.svg?color=red)](https://www.npmjs.com/package/@raruto/leaflet-elevation)
4
- [![License](https://img.shields.io/badge/license-GPL%203-blue.svg?style=flat)](LICENSE)
5
-
6
- A Leaflet plugin that allows to add elevation profiles using d3js
7
-
8
- <p align="center">
9
- <a href="https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hoverable-tracks.html"><img src="https://raruto.github.io/img/leaflet-elevation.png" alt="Leaflet elevation viewer" /></a>
10
- </p>
11
-
12
- ---
13
-
14
- _For a working example see one of the following demos:_
15
-
16
- - [loading .gpx file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation.html)
17
- - [loading .geojson file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-data.html)
18
- - [loading .kml file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_kml-data.html)
19
- - [loading .tcx file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_tcx-data.html)
20
- - [loading a local .gpx file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_upload-gpx.html)
21
- - [loading data from a textarea](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_string-data.html)
22
- - [loading individual .geojson tracks](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-group.html)
23
- - [loading individual .gpx tracks](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_toggable-tracks.html)
24
- - [loading multiple .gpx tracks (hover to toggle)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hoverable-tracks.html)
25
- - [loading multiple .gpx tracks (click to toggle)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_toggable-charts.html)
26
- - [loading multiple maps](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_multiple-maps.html)
27
- - [translating plugin labels](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_i18n-strings.html)
28
- - [rotating chart labels](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_chart_labels.html)
29
- - [using custom colors](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-theme.html)
30
- - [using .gpx extensions (cadence, heart, pace)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_extended-ui.html)
31
- - [using .gpx waypoint icons](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_gpx-waypoints.html)
32
- - [using .geojson waypoint icons](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-waypoints.html)
33
-
34
-
35
- <br/>
36
-
37
- - [autohide map](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hidden-map.html)
38
- - [autohide chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hidden-chart.html)
39
- - [clear button](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_clear-button.html)
40
- - [collapsible button](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_close-button.html)
41
- - [custom summary](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-summary.html)
42
- - [edge scale control](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_edge-scale.html)
43
- - [follow marker](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_follow-marker.html)
44
- - [layer almostover](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_almost-over.html)
45
- - [slope chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_slope-chart.html)
46
- - [speed chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_speed-chart.html)
47
- - [walking marker](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_dynamic-runner.html)
48
-
49
- ---
50
-
51
- <blockquote>
52
- <p align="center">
53
- <em>Initially based on the <a href="http://mrmufflon.github.io/Leaflet.Elevation/">work</a> of <strong>Felix “MrMufflon” Bache</strong></em>
54
- </p>
55
- </blockquote>
56
-
57
- ---
58
-
59
- ## How to use
60
-
61
- 1. **include CSS & JavaScript**
62
- ```html
63
- <head>
64
- ...
65
- <style> html, body, #map, #elevation-div { height: 100%; width: 100%; padding: 0; margin: 0; } #map { height: 75%; } #elevation-div { height: 25%; font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; } </style>
66
-
67
- <!-- leaflet-ui -->
68
- <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
69
- <script src="https://unpkg.com/leaflet-ui@0.6.0/dist/leaflet-ui.js"></script>
70
-
71
- <!-- leaflet-elevation -->
72
- <link rel="stylesheet" href="https://unpkg.com/@raruto/leaflet-elevation/dist/leaflet-elevation.css" />
73
- <script src="https://unpkg.com/@raruto/leaflet-elevation/dist/leaflet-elevation.js"></script>
74
- ...
75
- </head>
76
- ```
77
- 2. **choose the div container used for the slippy map**
78
- ```html
79
- <body>
80
- ...
81
- <div id="map"></div>
82
- ...
83
- </body>
84
- ```
85
- 3. **create your first simple “leaflet-elevation” slippy map**
86
- ```html
87
- <script>
88
- // Full list options at "leaflet-elevation.js"
89
- var elevation_options = {
90
-
91
- // Default chart colors: theme lime-theme, magenta-theme, ...
92
- theme: "lightblue-theme",
93
-
94
- // Chart container outside/inside map container
95
- detached: true,
96
-
97
- // if (detached), the elevation chart container
98
- elevationDiv: "#elevation-div",
99
-
100
- // if (!detached) autohide chart profile on chart mouseleave
101
- autohide: false,
102
-
103
- // if (!detached) initial state of chart profile control
104
- collapsed: false,
105
-
106
- // if (!detached) control position on one of map corners
107
- position: "topright",
108
-
109
- // Toggle close icon visibility
110
- closeBtn: true,
111
-
112
- // Autoupdate map center on chart mouseover.
113
- followMarker: true,
114
-
115
- // Autoupdate map bounds on chart update.
116
- autofitBounds: true,
117
-
118
- // Chart distance/elevation units.
119
- imperial: false,
120
-
121
- // [Lat, Long] vs [Long, Lat] points. (leaflet default: [Lat, Long])
122
- reverseCoords: false,
123
-
124
- // Acceleration chart profile: true || "summary" || "disabled" || false
125
- acceleration: false,
126
-
127
- // Slope chart profile: true || "summary" || "disabled" || false
128
- slope: false,
129
-
130
- // Speed chart profile: true || "summary" || "disabled" || false
131
- speed: false,
132
-
133
- // Altitude chart profile: true || "summary" || "disabled" || false
134
- altitude: true,
135
-
136
- // Display time info: true || "summary" || false
137
- time: true,
138
-
139
- // Display distance info: true || "summary" || false
140
- distance: true,
141
-
142
- // Summary track info style: "inline" || "multiline" || false
143
- summary: 'multiline',
144
-
145
- // Download link: "link" || false || "modal"
146
- downloadLink: 'link',
147
-
148
- // Toggle chart ruler filter
149
- ruler: true,
150
-
151
- // Toggle chart legend filter
152
- legend: true,
153
-
154
- // Toggle "leaflet-almostover" integration
155
- almostOver: true,
156
-
157
- // Toggle "leaflet-distance-markers" integration
158
- distanceMarkers: false,
159
-
160
- // Toggle "leaflet-edgescale" integration
161
- edgeScale: false,
162
-
163
- // Toggle "leaflet-hotline" integration
164
- hotline: true,
165
-
166
- // Display track datetimes: true || false
167
- timestamps: false,
168
-
169
- // Display track waypoints: true || "markers" || "dots" || false
170
- waypoints: true,
171
-
172
- // Toggle custom waypoint icons: true || { associative array of <sym> tags } || false
173
- wptIcons: {
174
- '': L.divIcon({
175
- className: 'elevation-waypoint-marker',
176
- html: '<i class="elevation-waypoint-icon"></i>',
177
- iconSize: [30, 30],
178
- iconAnchor: [8, 30],
179
- }),
180
- },
181
-
182
- // Toggle waypoint labels: true || "markers" || "dots" || false
183
- wptLabels: true,
184
-
185
- // Render chart profiles as Canvas or SVG Paths
186
- preferCanvas: true,
187
-
188
- };
189
-
190
- // Instantiate map (leaflet-ui).
191
- var map = L.map('map', { mapTypeId: 'terrain', center: [41.4583, 12.7059], zoom: 5 });
192
-
193
- // Instantiate elevation control.
194
- var controlElevation = L.control.elevation(elevation_options).addTo(map);
195
-
196
- // Load track from url (allowed data types: "*.geojson", "*.gpx", "*.tcx")
197
- controlElevation.load("https://raruto.github.io/leaflet-elevation/examples/via-emilia.gpx");
198
-
199
- </script>
200
- ```
201
-
202
- ### Build Guide
203
-
204
- Within your local development environment:
205
-
206
- ```shell
207
- git clone git@github.com:Raruto/leaflet-elevation.git
208
- cd ./leaflet-elevation
209
-
210
- npm i # install dependencies
211
- npm run dev # start dev server at: http://localhost:8080
212
- npm run build # generate "dist" files (once)
213
- npm run test # test all "*.spec.js" files (once)
214
- ```
215
-
216
- After that you can start developing inside the `src` and `test` folders (eg. open "http://localhost:8080/test" in your browser to preview changes). Check also [CONTRIBUTING.md](.github/CONTRIBUTING.md) file for some information about it.
217
-
218
- ### FAQ
219
-
220
- <details>
221
- <summary>1. How can I change the color of the elevation plot?</summary><br>
222
-
223
- There are multiple options to achieve this:
224
-
225
- * You could either use some default presets (see: theme: "lightblue-theme" option in readme file and the following file `leaflet-elevation.css` for some other default "*-theme" names).
226
- * check out [this example](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-theme.html)
227
- * Or add the following lines for custom colors.
228
- ```css
229
- .elevation-control .area {
230
- fill: red;
231
- }
232
- .elevation-control .background {
233
- background-color: white;
234
- ```
235
- </details>
236
-
237
- <details>
238
- <summary>2. How to enable/disable the leaflet user interface customizations?</summary><br>
239
-
240
- These customizations are actually part of the [leaflet-ui](https://github.com/Raruto/leaflet-ui) and can be toggled on/off using e.g. the following options:
241
- ```js
242
- var map = L.map('map', {
243
- center: [41.4583, 12.7059], // needs value to initialize
244
- zoom: 5, // needs value to initialize
245
- mapTypeId: 'topo',
246
- mapTypeIds: ['osm', 'terrain', 'satellite', 'topo'],
247
- gestureHandling: false, // zoom with Cmd + Scroll
248
- zoomControl: true, // plus minus buttons
249
- pegmanControl: false,
250
- locateControl: false,
251
- fullscreenControl: true,
252
- layersControl: true,
253
- minimapControl: false,
254
- editInOSMControl: false,
255
- loadingControl: false,
256
- searchControl: false,
257
- disableDefaultUI: false,
258
- printControl: false,
259
- });
260
- ```
261
- </details>
262
-
263
- <details> <summary>3. How can I import this library as ES module?</summary>
264
-
265
- Usually, when working with a js bundler like [Vite](https://vitest.dev/) or [Webpack](https://webpack.js.org/), you need to provide to this library the full path to some dynamically imported files from the [`srcFolder`](./src/):
266
-
267
- ```js
268
- import './your-custom-style.css';
269
- import 'leaflet/dist/leaflet.css';
270
- import L from 'leaflet';
271
- import '@raruto/leaflet-elevation/src/index.js';
272
- import '@raruto/leaflet-elevation/src/index.css';
273
-
274
- const map = L.map('map', {
275
- center: [41.4583, 12.7059]
276
- zoom: 5,
277
- });
278
-
279
- const controlElevation = L.control.elevation({
280
- // CHANGE ME: with your own http server folder (eg. "http://custom-server/public/path/to/leaflet-elevation/src/")
281
- srcFolder: 'http://unpkg.com/@raruto/leaflet-elevation/src/'
282
- }).addTo(map);
283
-
284
- // Load track from url (allowed data types: "*.geojson", "*.gpx", "*.tcx")
285
- controlElevation.load("https://raruto.github.io/leaflet-elevation/examples/via-emilia.gpx");
286
- ```
287
-
288
- </details>
289
-
290
- <details>
291
- <summary>4. Some real world projects based on this plugin?</summary><br>
292
-
293
- - https://parcours.scasb.org/
294
- - https://velocat.ru/velo/phpBB3/map.php
295
- - https://plugins.qgis.org/plugins/track_profile_2_web/
296
- - https://wordpress.org/plugins/os-datahub-maps/
297
- - https://wordpress.org/plugins/extensions-leaflet-map/
298
- - https://github.com/der-stefan/OpenTopoMap
299
- - https://gpx.n-peloton.fr/
300
- - https://walkaholic.me/map
301
-
302
- </details>
303
-
304
- _Related: [Leaflet-UI presets](https://github.com/raruto/leaflet-ui), [QGIS Integration](https://github.com/faunalia/trackprofile2web)_
305
-
306
- ### Changelog
307
-
308
- All notable changes to this project are documented in the [releases](https://github.com/Raruto/leaflet-elevation/releases) page.
309
-
310
- ---
311
-
312
- **Compatibile with:**
313
- [![Leaflet 1.x compatible!](https://img.shields.io/badge/Leaflet-1.7.0-1EB300.svg?style=flat)](http://leafletjs.com/reference.html)
314
- [![d3.js v6 compatibile!](https://img.shields.io/badge/d3.js-6.5-1EB300.svg?style=flat)](https://www.npmjs.com/package/d3)
315
- [![@tmcw/togeojson v4.6.0 compatibile!](https://img.shields.io/badge/@tmcw/togeojson-4.6-1EB300.svg?style=flat)](https://www.npmjs.com/package/@tmcw/togeojson)
316
-
317
-
318
- ---
319
-
320
- **Contributors:** [MrMufflon](https://github.com/MrMufflon/Leaflet.Elevation), [HostedDinner](https://github.com/HostedDinner/Leaflet.Elevation), [ADoroszlai](http://ADoroszlai.github.io/joebed/), [Raruto](https://github.com/Raruto/leaflet-elevation)
321
-
322
- ---
323
-
324
- **License:** GPL-3.0+
1
+ # leaflet-elevation.js
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/@raruto/leaflet-elevation.svg?color=red)](https://www.npmjs.com/package/@raruto/leaflet-elevation)
4
+ [![License](https://img.shields.io/badge/license-GPL%203-blue.svg?style=flat)](LICENSE)
5
+
6
+ A Leaflet plugin that allows to add elevation profiles using d3js
7
+
8
+ <p align="center">
9
+ <a href="https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hoverable-tracks.html"><img src="https://raruto.github.io/img/leaflet-elevation.png" alt="Leaflet elevation viewer" /></a>
10
+ </p>
11
+
12
+ ---
13
+
14
+ _For a working example see one of the following demos:_
15
+
16
+ - [loading .gpx file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation.html)
17
+ - [loading .geojson file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-data.html)
18
+ - [loading .kml file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_kml-data.html)
19
+ - [loading .tcx file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_tcx-data.html)
20
+ - [loading a local .gpx file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_upload-gpx.html)
21
+ - [loading data from a textarea](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_string-data.html)
22
+ - [loading individual .geojson tracks](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-group.html)
23
+ - [loading individual .gpx tracks](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_toggable-tracks.html)
24
+ - [loading multiple .gpx tracks (hover to toggle)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hoverable-tracks.html)
25
+ - [loading multiple .gpx tracks (click to toggle)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_toggable-charts.html)
26
+ - [loading multiple maps](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_multiple-maps.html)
27
+ - [translating plugin labels](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_i18n-strings.html)
28
+ - [rotating chart labels](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_chart_labels.html)
29
+ - [using custom colors](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-theme.html)
30
+ - [using .gpx extensions (cadence, heart, pace)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_extended-ui.html)
31
+ - [using .gpx waypoint icons](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_gpx-waypoints.html)
32
+ - [using .geojson waypoint icons](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-waypoints.html)
33
+
34
+
35
+ <br/>
36
+
37
+ - [autohide map](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hidden-map.html)
38
+ - [autohide chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hidden-chart.html)
39
+ - [clear button](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_clear-button.html)
40
+ - [collapsible button](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_close-button.html)
41
+ - [custom summary](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-summary.html)
42
+ - [edge scale control](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_edge-scale.html)
43
+ - [follow marker](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_follow-marker.html)
44
+ - [layer almostover](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_almost-over.html)
45
+ - [linear gradient](https://raruto.github.io/leaflet-elevation/examples/leaflet-linear-gradient.html)
46
+ - [slope chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_slope-chart.html)
47
+ - [speed chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_speed-chart.html)
48
+ - [walking marker](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_dynamic-runner.html)
49
+
50
+ ---
51
+
52
+ <blockquote>
53
+ <p align="center">
54
+ <em>Initially based on the <a href="http://mrmufflon.github.io/Leaflet.Elevation/">work</a> of <strong>Felix “MrMufflon” Bache</strong></em>
55
+ </p>
56
+ </blockquote>
57
+
58
+ ---
59
+
60
+ ## How to use
61
+
62
+ 1. **include CSS & JavaScript**
63
+ ```html
64
+ <head>
65
+ ...
66
+ <style> html, body, #map, #elevation-div { height: 100%; width: 100%; padding: 0; margin: 0; } #map { height: 75%; } #elevation-div { height: 25%; font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; } </style>
67
+
68
+ <!-- leaflet-ui -->
69
+ <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
70
+ <script src="https://unpkg.com/leaflet-ui@0.6.0/dist/leaflet-ui.js"></script>
71
+
72
+ <!-- leaflet-elevation -->
73
+ <link rel="stylesheet" href="https://unpkg.com/@raruto/leaflet-elevation/dist/leaflet-elevation.css" />
74
+ <script src="https://unpkg.com/@raruto/leaflet-elevation/dist/leaflet-elevation.js"></script>
75
+ ...
76
+ </head>
77
+ ```
78
+ 2. **choose the div container used for the slippy map**
79
+ ```html
80
+ <body>
81
+ ...
82
+ <div id="map"></div>
83
+ ...
84
+ </body>
85
+ ```
86
+ 3. **create your first simple “leaflet-elevation” slippy map**
87
+ ```html
88
+ <script>
89
+ // Full list options at "leaflet-elevation.js"
90
+ var elevation_options = {
91
+
92
+ // Default chart colors: theme lime-theme, magenta-theme, ...
93
+ theme: "lightblue-theme",
94
+
95
+ // Chart container outside/inside map container
96
+ detached: true,
97
+
98
+ // if (detached), the elevation chart container
99
+ elevationDiv: "#elevation-div",
100
+
101
+ // if (!detached) autohide chart profile on chart mouseleave
102
+ autohide: false,
103
+
104
+ // if (!detached) initial state of chart profile control
105
+ collapsed: false,
106
+
107
+ // if (!detached) control position on one of map corners
108
+ position: "topright",
109
+
110
+ // Toggle close icon visibility
111
+ closeBtn: true,
112
+
113
+ // Autoupdate map center on chart mouseover.
114
+ followMarker: true,
115
+
116
+ // Autoupdate map bounds on chart update.
117
+ autofitBounds: true,
118
+
119
+ // Chart distance/elevation units.
120
+ imperial: false,
121
+
122
+ // [Lat, Long] vs [Long, Lat] points. (leaflet default: [Lat, Long])
123
+ reverseCoords: false,
124
+
125
+ // Acceleration chart profile: true || "summary" || "disabled" || false
126
+ acceleration: false,
127
+
128
+ // Slope chart profile: true || "summary" || "disabled" || false
129
+ slope: false,
130
+
131
+ // Speed chart profile: true || "summary" || "disabled" || false
132
+ speed: false,
133
+
134
+ // Altitude chart profile: true || "summary" || "disabled" || false
135
+ altitude: true,
136
+
137
+ // Display time info: true || "summary" || false
138
+ time: true,
139
+
140
+ // Display distance info: true || "summary" || false
141
+ distance: true,
142
+
143
+ // Summary track info style: "inline" || "multiline" || false
144
+ summary: 'multiline',
145
+
146
+ // Download link: "link" || false || "modal"
147
+ downloadLink: 'link',
148
+
149
+ // Toggle chart ruler filter
150
+ ruler: true,
151
+
152
+ // Toggle chart legend filter
153
+ legend: true,
154
+
155
+ // Toggle "leaflet-almostover" integration
156
+ almostOver: true,
157
+
158
+ // Toggle "leaflet-distance-markers" integration
159
+ distanceMarkers: false,
160
+
161
+ // Toggle "leaflet-edgescale" integration
162
+ edgeScale: false,
163
+
164
+ // Toggle "leaflet-hotline" integration
165
+ hotline: true,
166
+
167
+ // Display track datetimes: true || false
168
+ timestamps: false,
169
+
170
+ // Display track waypoints: true || "markers" || "dots" || false
171
+ waypoints: true,
172
+
173
+ // Toggle custom waypoint icons: true || { associative array of <sym> tags } || false
174
+ wptIcons: {
175
+ '': L.divIcon({
176
+ className: 'elevation-waypoint-marker',
177
+ html: '<i class="elevation-waypoint-icon"></i>',
178
+ iconSize: [30, 30],
179
+ iconAnchor: [8, 30],
180
+ }),
181
+ },
182
+
183
+ // Toggle waypoint labels: true || "markers" || "dots" || false
184
+ wptLabels: true,
185
+
186
+ // Render chart profiles as Canvas or SVG Paths
187
+ preferCanvas: true,
188
+
189
+ };
190
+
191
+ // Instantiate map (leaflet-ui).
192
+ var map = L.map('map', { mapTypeId: 'terrain', center: [41.4583, 12.7059], zoom: 5 });
193
+
194
+ // Instantiate elevation control.
195
+ var controlElevation = L.control.elevation(elevation_options).addTo(map);
196
+
197
+ // Load track from url (allowed data types: "*.geojson", "*.gpx", "*.tcx")
198
+ controlElevation.load("https://raruto.github.io/leaflet-elevation/examples/via-emilia.gpx");
199
+
200
+ </script>
201
+ ```
202
+
203
+ ### Build Guide
204
+
205
+ Within your local development environment:
206
+
207
+ ```shell
208
+ git clone git@github.com:Raruto/leaflet-elevation.git
209
+ cd ./leaflet-elevation
210
+
211
+ npm i # install dependencies
212
+ npm run dev # start dev server at: http://localhost:8080
213
+ npm run build # generate "dist" files (once)
214
+ npm run test # test all "*.spec.js" files (once)
215
+ ```
216
+
217
+ After that you can start developing inside the `src` and `test` folders (eg. open "http://localhost:8080/test" in your browser to preview changes). Check also [CONTRIBUTING.md](.github/CONTRIBUTING.md) file for some information about it.
218
+
219
+ ### FAQ
220
+
221
+ <details>
222
+ <summary>1. How can I change the color of the elevation plot?</summary><br>
223
+
224
+ There are multiple options to achieve this:
225
+
226
+ * You could either use some default presets (see: theme: "lightblue-theme" option in readme file and the following file `leaflet-elevation.css` for some other default "*-theme" names).
227
+ * check out [this example](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-theme.html)
228
+ * Or add the following lines for custom colors.
229
+ ```css
230
+ .elevation-control .area {
231
+ fill: red;
232
+ }
233
+ .elevation-control .background {
234
+ background-color: white;
235
+ ```
236
+ </details>
237
+
238
+ <details>
239
+ <summary>2. How to enable/disable the leaflet user interface customizations?</summary><br>
240
+
241
+ These customizations are actually part of the [leaflet-ui](https://github.com/Raruto/leaflet-ui) and can be toggled on/off using e.g. the following options:
242
+ ```js
243
+ var map = L.map('map', {
244
+ center: [41.4583, 12.7059], // needs value to initialize
245
+ zoom: 5, // needs value to initialize
246
+ mapTypeId: 'topo',
247
+ mapTypeIds: ['osm', 'terrain', 'satellite', 'topo'],
248
+ gestureHandling: false, // zoom with Cmd + Scroll
249
+ zoomControl: true, // plus minus buttons
250
+ pegmanControl: false,
251
+ locateControl: false,
252
+ fullscreenControl: true,
253
+ layersControl: true,
254
+ minimapControl: false,
255
+ editInOSMControl: false,
256
+ loadingControl: false,
257
+ searchControl: false,
258
+ disableDefaultUI: false,
259
+ printControl: false,
260
+ });
261
+ ```
262
+ </details>
263
+
264
+ <details> <summary>3. How can I import this library as ES module?</summary>
265
+
266
+ Usually, when working with a js bundler like [Vite](https://vitest.dev/) or [Webpack](https://webpack.js.org/), you need to provide to this library the full path to some dynamically imported files from the [`srcFolder`](./src/):
267
+
268
+ ```js
269
+ import './your-custom-style.css';
270
+ import 'leaflet/dist/leaflet.css';
271
+ import L from 'leaflet';
272
+ import '@raruto/leaflet-elevation/src/index.js';
273
+ import '@raruto/leaflet-elevation/src/index.css';
274
+
275
+ const map = L.map('map', {
276
+ center: [41.4583, 12.7059]
277
+ zoom: 5,
278
+ });
279
+
280
+ const controlElevation = L.control.elevation({
281
+ // CHANGE ME: with your own http server folder (eg. "http://custom-server/public/path/to/leaflet-elevation/src/")
282
+ srcFolder: 'http://unpkg.com/@raruto/leaflet-elevation/src/'
283
+ }).addTo(map);
284
+
285
+ // Load track from url (allowed data types: "*.geojson", "*.gpx", "*.tcx")
286
+ controlElevation.load("https://raruto.github.io/leaflet-elevation/examples/via-emilia.gpx");
287
+ ```
288
+
289
+ </details>
290
+
291
+ <details>
292
+ <summary>4. Some real world projects based on this plugin?</summary><br>
293
+
294
+ - https://parcours.scasb.org/
295
+ - https://velocat.ru/velo/phpBB3/map.php
296
+ - https://plugins.qgis.org/plugins/track_profile_2_web/
297
+ - https://wordpress.org/plugins/os-datahub-maps/
298
+ - https://wordpress.org/plugins/extensions-leaflet-map/
299
+ - https://github.com/der-stefan/OpenTopoMap
300
+ - https://gpx.n-peloton.fr/
301
+ - https://walkaholic.me/map
302
+
303
+ </details>
304
+
305
+ _Related: [Leaflet-UI presets](https://github.com/raruto/leaflet-ui), [QGIS Integration](https://github.com/faunalia/trackprofile2web)_
306
+
307
+ ### Changelog
308
+
309
+ All notable changes to this project are documented in the [releases](https://github.com/Raruto/leaflet-elevation/releases) page.
310
+
311
+ ---
312
+
313
+ **Compatibile with:**
314
+ [![Leaflet 1.x compatible!](https://img.shields.io/badge/Leaflet-1.7.0-1EB300.svg?style=flat)](http://leafletjs.com/reference.html)
315
+ [![d3.js v7 compatibile!](https://img.shields.io/badge/d3.js-7.8-1EB300.svg?style=flat)](https://www.npmjs.com/package/d3)
316
+ [![@tmcw/togeojson v5 compatibile!](https://img.shields.io/badge/@tmcw/togeojson-5.6-1EB300.svg?style=flat)](https://www.npmjs.com/package/@tmcw/togeojson)
317
+
318
+
319
+ ---
320
+
321
+ **Contributors:** [MrMufflon](https://github.com/MrMufflon/Leaflet.Elevation), [HostedDinner](https://github.com/HostedDinner/Leaflet.Elevation), [ADoroszlai](http://ADoroszlai.github.io/joebed/), [Raruto](https://github.com/Raruto/leaflet-elevation)
322
+
323
+ ---
324
+
325
+ **License:** GPL-3.0+