feat(tours): import KML and KMZ routes as tours, with a preview first

A route planned in Google My Maps or Google Earth can now become a tour
without converting it to GPX first. The import button and a file dropped on
the tours workspace take .kml and .kmz files beside .gpx, through the same
preview, the same import routes and the same transaction as a GPX file.

The preview shows every line of the file on its own, numbered, with its
distance and heights; two lines of one placemark are numbered after its name
and never joined. Heights count only where they are heights: kept for an
absolute line, dropped for any other altitude mode and for the all-zero
placeholder My Maps writes, so a missing height stays unknown. What the file
holds besides its lines (pins, areas, overlays, links to other files) is
counted in a dashed card, and nothing is fetched from elsewhere.

The KML reading reuses the place import's codec. A KMZ only ever has its KML
entry unpacked, counted byte by byte against the decompressed cap whatever
its header claims. A file that cannot be read is refused with its reason
(damaged, an archive without KML, too large unpacked), and the toast names
the file and the reason. A KML or KMZ import keeps the gpx origin of a file
import; its provenance names the real format from the stored file name.
This commit is contained in:
Maurice
2026-10-20 12:28:57 +02:00
parent f57a0dbd31
commit 3659297af1
58 changed files with 1883 additions and 400 deletions
+23 -10
View File
@@ -7,7 +7,7 @@ const tours: TranslationStrings = {
'tours.mode.label': 'Afegeix una vista',
'tours.title': 'Excursions',
'tours.empty.title': 'Encara no hi ha excursions',
'tours.empty.body': 'Planifica una excursió o importa un fitxer GPX per començar.',
'tours.empty.body': 'Planifica una excursió o importa un fitxer GPX o KML per començar.',
'tours.addToDay': 'Afegeix a un dia',
'tours.addToDay.comingSoon': "Assigna excursions a un dia del viatge des de la llista d'excursions.",
'tours.addToDay.pickDay': 'Tria un dia',
@@ -20,20 +20,20 @@ const tours: TranslationStrings = {
'tours.caution.badge': 'fes-la servir amb precaució',
'tours.caution.tooltip': 'Altitud o mètriques incompletes: importada amb reserves',
'tours.import.caution': 'Importada amb reserves: altitud o mètriques incompletes',
'tours.import.success': '{count} excursions importades de GPX',
'tours.import.success.one': '{count} excursió importada de GPX',
'tours.import.success': '{count} excursions importades',
'tours.import.success.one': '{count} excursió importada',
'tours.import.noTrackIn': "No s'ha trobat cap traça ni ruta a {name}",
'tours.import.errorIn': "No s'ha pogut importar {name}",
'tours.import.button': 'Importa GPX',
'tours.import.hint': "Importa fitxers GPX com a excursions d'aquest viatge",
'tours.import.unsupported': 'Només es poden importar fitxers GPX com a excursions.',
'tours.import.button': 'Importa GPX o KML',
'tours.import.hint': "Importa fitxers GPX, KML o KMZ com a excursions d'aquest viatge",
'tours.import.unsupported': 'Només es poden importar fitxers GPX, KML i KMZ com a excursions.',
'tours.import.skipped': "{count} traces ja eren en aquest viatge i s'han omès",
'tours.import.skipped.one': "{count} traça ja era en aquest viatge i s'ha omès",
'tours.import.allSkipped': 'Tot el que hi ha en aquest fitxer ja és en aquest viatge.',
'tours.import.drop': 'Deixa anar fitxers GPX per importar-los',
'tours.import.drop': 'Deixa anar fitxers GPX, KML o KMZ per importar-los',
'tours.import.dropHint': "Cada traça o ruta d'un fitxer es converteix en una excursió d'aquest viatge.",
'tours.import.dropNoPermission': 'No pots afegir excursions a aquest viatge.',
'tours.import.importing': "S'està important el GPX…",
'tours.import.importing': "S'està important…",
'tours.days.label': 'Dies del viatge',
'tours.days.none': 'Encara no és a cap dia del viatge.',
'tours.days.short': 'Dies {days}',
@@ -99,7 +99,7 @@ const tours: TranslationStrings = {
'tours.planner.newTour': 'Planifica una nova excursió',
'tours.planner.addTour': 'Afegeix una ruta',
'tours.planner.addTourHint':
"Planifica una ruta nova, importa fitxers GPX o un passeig de Google Maps, o porta una ruta d'un altre viatge",
"Planifica una ruta nova, importa fitxers GPX o KML o un passeig de Google Maps, o porta una ruta d'un altre viatge",
'tours.planner.neutralTitle': 'Planifica una excursió',
'tours.planner.neutralBody': 'Comença una ruta nova i fes clic al mapa per marcar-ne els punts.',
'tours.planner.newTitle': 'Nova excursió',
@@ -237,6 +237,7 @@ const tours: TranslationStrings = {
'tours.provenance.label': 'Origen',
'tours.provenance.source': 'Font',
'tours.provenance.importedAt': 'Importat',
'tours.provenance.fileImport': 'Importació {format}',
'tours.provenance.createdAt': 'Creat',
'tours.provenance.externalUpdated': 'Modificat a wanderer',
'tours.provenance.externalUpdatedHint':
@@ -794,7 +795,7 @@ const tours: TranslationStrings = {
'tours.map.pisteLift': 'Remuntadors',
'tours.map.pisteStatic': 'Dades del mapa, no un informe: res sobre què és obert o trepitjat, la neu o les allaus.',
'tours.map.pisteFullKey': 'Llegenda completa a OpenSnowMap',
'tours.import.previewTitle': 'Previsualització del GPX',
'tours.import.previewTitle': 'Previsualització de la importació',
'tours.import.previewHint': 'Encara no s’ha desat res. Revisa el recorregut i després importa.',
'tours.import.previewFiles': '{count} fitxers',
'tours.import.previewFiles.one': '{count} fitxer',
@@ -803,6 +804,18 @@ const tours: TranslationStrings = {
'tours.import.previewPoints': '{count} punts',
'tours.import.previewPoints.one': '{count} punt',
'tours.import.previewNoHeights': 'Sense altituds al fitxer',
'tours.import.previewLeftOut': 'No importat',
'tours.import.previewLeftOutHint':
"Les excursions només es fan de línies. Les xinxetes, àrees, superposicions i enllaços a altres fitxers queden fora, i no es carrega res d'enlloc més.",
'tours.import.leftOutPoints': '{count} xinxetes',
'tours.import.leftOutPoints.one': '{count} xinxeta',
'tours.import.leftOutAreas': '{count} àrees',
'tours.import.leftOutAreas.one': '{count} àrea',
'tours.import.leftOutOther': '{count} elements més',
'tours.import.leftOutOther.one': '{count} element més',
'tours.import.unreadableIn': "No s'ha pogut llegir {name}: el fitxer està malmès o no és GPX, KML ni KMZ",
'tours.import.archiveNoKmlIn': "No s'ha trobat cap fitxer KML a {name}",
'tours.import.archiveTooLargeIn': '{name} és massa gran un cop descomprimit',
'tours.import.previewDuplicate': 'Ja és al viatge',
'tours.import.previewAllDuplicates': 'Tots els tracks ja són al viatge, no hi ha res a importar.',
'tours.import.previewAs': 'Importa com a',