Skip to content

Commit

Permalink
update readme and examples to 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Raruto committed Mar 7, 2021
1 parent 984ff8c commit 65bc8ed
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 26 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,10 @@ _Related: [Leaflet-UI presets](https://github.com/raruto/leaflet-ui), [QGIS Inte
---

**Compatibile with:**
[![Leaflet 1.x compatible!](https://img.shields.io/badge/Leaflet-1.3.2-1EB300.svg?style=flat)](http://leafletjs.com/reference.html)
[![leaflet-gpx 1.5 compatibile!](https://img.shields.io/badge/Leaflet%20GPX-1.5.0-1EB300.svg?style=flat)](https://github.com/mpetazzoni/leaflet-gpx)
[![d3.js v5 compatibile!](https://img.shields.io/badge/d3.js-5.15-1EB300.svg?style=flat)](https://www.npmjs.com/package/d3)
[![Leaflet 1.x compatible!](https://img.shields.io/badge/Leaflet-1.6.0-1EB300.svg?style=flat)](http://leafletjs.com/reference.html)
[![d3.js v6 compatibile!](https://img.shields.io/badge/d3.js-6.5-1EB300.svg?style=flat)](https://www.npmjs.com/package/d3)
[![@tmcw/togeojson v4.1.0 compatibile!](https://img.shields.io/badge/@tmcw/togeojson-4.1-1EB300.svg?style=flat)](https://www.npmjs.com/package/@tmcw/togeojson)


---

Expand Down
2 changes: 1 addition & 1 deletion examples/demo.kml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>via-emilia.gpx</name>
<name>demo.kml</name>
<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<LineString>
<coordinates>
Expand Down
4 changes: 2 additions & 2 deletions examples/leaflet-elevation.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
imperial: false,
// altitude: "disabled",
slope: "disabled",
speed: "disabled",
acceleration: "disabled",
speed: false,
acceleration: false,
time: "summary",
legend: true,
followMarker: false,
Expand Down
10 changes: 5 additions & 5 deletions examples/leaflet-elevation_geojson-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
resizerControl: true,
},
elevationControl: {
url: "https://raruto.github.io/leaflet-elevation/examples/demo.gpx",
url: "https://raruto.github.io/leaflet-elevation/examples/demo.geojson",
options: {
theme: "lime-theme",
collapsed: false,
Expand All @@ -61,10 +61,10 @@
summary: "inline",
imperial: false,
// altitude: "disabled",
slope: "disabled",
speed: "disabled",
acceleration: "disabled",
time: "summary",
slope: true,
speed: false,
acceleration: false,
time: true,
legend: true,
followMarker: false,
},
Expand Down
62 changes: 47 additions & 15 deletions examples/leaflet-elevation_kml-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@

<!-- leaflet-ui -->
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet-ui.js"></script>

<!-- toGeoJSON -->
<script src="https://unpkg.com/@tmcw/[email protected]/dist/togeojson.umd.js"></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet-ui.js"></script>

<!-- leaflet-elevation -->
<link rel="stylesheet" href="https://unpkg.com/@raruto/leaflet-elevation@1.4.0/dist/leaflet-elevation.min.css" />
<script src="https://unpkg.com/@raruto/leaflet-elevation@1.4.0/dist/leaflet-elevation.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@raruto/leaflet-elevation@1.6.0/dist/leaflet-elevation.min.css" />
<script src="https://unpkg.com/@raruto/leaflet-elevation@1.6.0/dist/leaflet-elevation.min.js"></script>

</head>

Expand All @@ -55,10 +52,21 @@
elevationControl: {
url: "https://raruto.github.io/leaflet-elevation/examples/demo.kml",
options: {
theme: "lightblue-theme",
theme: "yellow-theme",
collapsed: false,
autohide: false,
autofitBounds: true,
position: "bottomleft",
detached: true,
summary: "multiline",
summary: "inline",
imperial: false,
// altitude: "disabled",
slope: "disabled",
speed: "disabled",
acceleration: "disabled",
time: true,
legend: true,
followMarker: false,
},
},
layersControl: {
Expand All @@ -80,13 +88,37 @@
controlLayer.addOverlay(e.layer, e.name);
});

fetch(opts.elevationControl.url)
.then((response) => response.text())
.then((xml) => {
var data = toGeoJSON.kml(new DOMParser().parseFromString(xml, "text/xml"));
if(!data.name) data.name = data.features[0].properties.name;
controlElevation.load(data);
});
controlElevation.load(opts.elevationControl.url);
</script>

<!-- i18n -->
<script>

// Register a custom locale
L.registerLocale('it', {
"Acceleration" : "Accelerazione",
"Altitude" : "Altitudine",
"Slope" : "Pendenza",
"Speed" : "Velocità",
"Total Length: " : "Distanza: ",
"Max Elevation: " : "Altezza Max: ",
"Min Elevation: " : "Altezza Min: ",
"Total Time: " : "Durata: ",
"Total Ascent: " : "Salita: ",
"Total Descent: " : "Discesa: ",
"Min Slope: " : "Pendenza Min: ",
"Max Slope: " : "Pendenza Max: ",
"Min Speed: " : "Velocità Min: ",
"Max Speed: " : "Velocità Max: ",
"Avg Speed: " : "Velocità Media: ",
"Min Acceleration: ": "Accelerazione Min: ",
"Max Acceleration: ": "Accelerazione Max: ",
"Avg Acceleration: ": "Accelerazione Media: ",
});

// Enable a custom locale
// L.setLocale('it');
// L.setLocale('en');

</script>

Expand Down

0 comments on commit 65bc8ed

Please sign in to comment.