From 1b741c3b2f7c920b2f25fe33c180dd9fd773d460 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Mon, 16 Sep 2024 11:38:47 +0200 Subject: [PATCH] revert geojson import --- gpx/src/gpx.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gpx/src/gpx.ts b/gpx/src/gpx.ts index caf5cd59..1191a804 100644 --- a/gpx/src/gpx.ts +++ b/gpx/src/gpx.ts @@ -1,7 +1,6 @@ import { ramerDouglasPeucker } from "./simplify"; import { Coordinates, GPXFileAttributes, GPXFileType, LineStyleExtension, Link, Metadata, RouteType, TrackExtensions, TrackPointExtensions, TrackPointType, TrackSegmentType, TrackType, WaypointType } from "./types"; import { immerable, isDraft, original, freeze } from "immer"; -import { Feature, FeatureCollection } from "geojson"; function cloneJSON(obj: T): T { if (obj === null || typeof obj !== 'object') { @@ -24,7 +23,7 @@ export abstract class GPXTreeElement> { abstract getSegments(): TrackSegment[]; abstract getTrackPoints(): TrackPoint[]; - abstract toGeoJSON(): Feature | Feature[] | FeatureCollection | FeatureCollection[]; + abstract toGeoJSON(): GeoJSON.Feature | GeoJSON.Feature[] | GeoJSON.FeatureCollection | GeoJSON.FeatureCollection[]; // Producers abstract _reverse(originalNextTimestamp?: Date, newPreviousTimestamp?: Date); @@ -219,7 +218,7 @@ export class GPXFile extends GPXTreeNode { }); } - toGeoJSON(): FeatureCollection { + toGeoJSON(): GeoJSON.FeatureCollection { return { type: "FeatureCollection", features: this.children.flatMap((child) => child.toGeoJSON()) @@ -519,7 +518,7 @@ export class Track extends GPXTreeNode { return undefined; } - toGeoJSON(): Feature[] { + toGeoJSON(): GeoJSON.Feature[] { return this.children.map((child) => { let geoJSON = child.toGeoJSON(); if (this.extensions && this.extensions['gpx_style:line']) { @@ -880,7 +879,7 @@ export class TrackSegment extends GPXTreeLeaf { return this.trkpt; } - toGeoJSON(): Feature { + toGeoJSON(): GeoJSON.Feature { return { type: "Feature", geometry: {