@raruto/leaflet-elevation 1.8.5 → 1.8.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raruto/leaflet-elevation",
3
- "version": "1.8.5",
3
+ "version": "1.8.6",
4
4
  "description": "A Leaflet plugin that allows to add elevation profiles using d3js",
5
5
  "main": "dist/leaflet-elevation.min.js",
6
6
  "module": "src/index.js",
package/src/control.js CHANGED
@@ -663,9 +663,9 @@ export const Elevation = L.Control.Elevation = L.Control.extend({
663
663
  .then((response) => response.text())
664
664
  .then((data) => {
665
665
  this._downloadURL = url; // TODO: handle multiple urls?
666
- this.load(data);
667
- })
668
- .catch((err) => console.warn(err));
666
+ this._parseFromString(data)
667
+ .then( geojson => geojson && this._loadLayer(geojson));
668
+ }).catch((err) => console.warn(err));
669
669
  },
670
670
 
671
671
  /**
@@ -881,8 +881,8 @@ export const Elevation = L.Control.Elevation = L.Control.extend({
881
881
  if (!(type in toGeoJSON)) {
882
882
  type = xml.documentElement.tagName == "TrainingCenterDatabase" ? 'tcx' : 'gpx';
883
883
  }
884
- let geojson = toGeoJSON[type](xml);
885
- geojson.name = name.length > 0 ? Array.from(name).find(tag => tag.parentElement.tagName == "trk").textContent : '';
884
+ let geojson = toGeoJSON[type](xml);
885
+ geojson.name = name.length > 0 ? (Array.from(name).find(tag => tag.parentElement.tagName == "trk") ?? name[0]).textContent : '';
886
886
  return geojson;
887
887
  },
888
888