fix(tours): keep the waypoints of a GPX/KML file that also holds a track

With the Tours addon on, a file picked or dropped on the places column goes
into the Tours import as soon as it holds one line, and that import reads
lines only. A Sygic or Trip-o-matic export (a route plus its stops) came in
as one tour and every place was dropped without a word.

The preview now counts a GPX file's waypoints as it already counted a KML
file's pins, and the dialog offers to add those points as places of the
trip, on by default. Confirming runs the Tours import for the lines and the
places import (points only) for the same files. A file whose tracks the
trip already holds can still bring its points.

Closes #2969
This commit is contained in:
Maurice
2026-11-03 20:19:43 +01:00
parent f8e51cb83d
commit 2e683f8609
36 changed files with 374 additions and 42 deletions
+3 -3
View File
@@ -51,9 +51,9 @@ export type TourGpxPreviewTrack = z.infer<typeof tourGpxPreviewTrackSchema>;
const leftOutCount = z.number().int().nonnegative();
/** What a KML or KMZ file held besides its lines, counted by kind; none of it is imported. */
/** What a file held besides its lines, counted by kind; none of it becomes a tour. */
export const tourFileLeftOutSchema = z.object({
/** Single points (pins). */
/** Single points: a KML file's pins, a GPX file's waypoints. The client can add them as places. */
points: leftOutCount,
/** Polygons. */
areas: leftOutCount,
@@ -64,7 +64,7 @@ export type TourFileLeftOut = z.infer<typeof tourFileLeftOutSchema>;
export const tourGpxPreviewResponseSchema = z.object({
tracks: z.array(tourGpxPreviewTrackSchema),
/** Only a KML or KMZ preview counts what it leaves out; a GPX preview never counted its loose waypoints. */
/** Absent when the file held nothing besides its lines. A GPX file only ever has points here. */
left_out: tourFileLeftOutSchema.optional(),
});
export type TourGpxPreviewResponse = z.infer<typeof tourGpxPreviewResponseSchema>;