Skip to content

Commit

Permalink
Fixed bug inherit to .GPX files upload
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoPazz committed Dec 6, 2024
1 parent 7b783ae commit 7299eed
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions lib/ModelMixins/GeojsonMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,9 @@ function GeoJsonMixin<T extends AbstractConstructor<BaseType>>(Base: T) {
let jsonCoords: JsonArray | undefined;
let filename: any;
let pathNotes: any;

console.log("this.readyData", this.readyData);

switch (this._pathType) {
case PathTypes.featureCollectionMultiLineString:
if (
Expand Down Expand Up @@ -1523,25 +1526,32 @@ function GeoJsonMixin<T extends AbstractConstructor<BaseType>>(Base: T) {
return;
}

console.log("GPX: jsonCoords", jsonCoords);

const coordinates: Cartographic[] = jsonCoords.map((elem) => {
console.log("elem", elem);
if (
elem &&
isJsonArray(elem) &&
elem.length === 3 &&
isJsonNumber(elem[0]) &&
isJsonNumber(elem[1]) &&
isJsonNumber(elem[2])
isJsonNumber(elem[1])
) {
return Cartographic.fromDegrees(
elem[0],
elem[1],
Math.round(elem[2])
);
if (elem.length === 3 && isJsonNumber(elem[2])) {
return Cartographic.fromDegrees(
elem[0],
elem[1],
Math.round(elem[2])
);
} else {
return Cartographic.fromDegrees(elem[0], elem[1], 0);
}
} else {
return Cartographic.fromDegrees(0, 0, 0);
}
});

console.log("GPX: coordinates", coordinates);

this.asPath(coordinates, filename, pathNotes);
}

Expand Down

0 comments on commit 7299eed

Please sign in to comment.