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