load and display gpx

This commit is contained in:
vcoppe
2024-04-17 16:46:51 +02:00
parent 0c97410c87
commit 685c2bb541
7 changed files with 141 additions and 302 deletions

View File

@@ -123,7 +123,21 @@ export class Track extends GPXTreeNode<TrackSegment> {
}
toGeoJSON(): any {
return this.getChildren().map((child) => child.toGeoJSON());
return this.getChildren().map((child) => {
let geoJSON = child.toGeoJSON();
if (this.extensions && this.extensions['gpx_style:line']) {
if (this.extensions['gpx_style:line'].color) {
geoJSON.properties['color'] = this.extensions['gpx_style:line'].color;
}
if (this.extensions['gpx_style:line'].opacity) {
geoJSON.properties['opacity'] = this.extensions['gpx_style:line'].opacity;
}
if (this.extensions['gpx_style:line'].weight) {
geoJSON.properties['weight'] = this.extensions['gpx_style:line'].weight;
}
}
return geoJSON;
});
}
};

View File

@@ -16,9 +16,9 @@
<type>Cycling</type>
<extensions>
<gpx_style:line>
<color>2d3ee9</color>
<color>#2d3ee9</color>
<opacity>0.5</opacity>
<weight>5</weight>
<weight>6</weight>
</gpx_style:line>
</extensions>
<trkseg>