Paket zum Laden, Bearbeiten und Speichern von GPS-Daten im GPX-Format (ein leichtgewichtiges XML-Datenformat zum Austausch von GPS-Daten – Wegpunkte, Routen und Tracks).
Aus öffentlichen Paketdaten erstellte Orientierung.
Das gpx-Paket ermöglicht Flutter-Entwicklern das Laden, Bearbeiten und Speichern von GPS-Daten im GPX-Format – einem leichtgewichtigen, auf XML basierenden Standard zum Austausch von Wegpunkten, Routen und Tracks. Es unterstützt das Lesen und Schreiben von GPX-Dateien auf allen wichtigen Plattformen und ist daher ideal für Geolocation-Anwendungen, die eine Interoperabilität von GPS-Daten erfordern. Das Paket bietet eine saubere Dart-API zum Parsen und Generieren von GPX-Inhalten mit minimalem Overhead.
Anwendungsfälle
GPS-Tracks aus Dateien lesen
Routendaten nach GPX exportieren
Integration mit Karten- und Navigations-Apps
Synchronisieren von GPS-Daten zwischen Geräten
Verarbeitung von Outdoor-Aktivitätsprotokollen
Hauptmerkmale
Unterstützt Wegpunkte, Routen und Tracks
Plattformübergreifende Kompatibilität
Einfache XML-Parsing und -Generierung
Leichtgewichtig und effizient
Vollständige Übereinstimmung mit der GPX 1.1-Spezifikation
Geeignet für
Fitness- und Outdoor-Apps
GPS-Datenanalysetools
kartengestützte Anwendungen
Datenaustausch zwischen GPS-Geräten
Entwickler, die mit geospatialen Daten arbeiten
Hinweise
Benötigt manuelle Handhabung von Datei-E/A
Nur auf GPX-Format beschränkt
Keine integrierte Kartendarstellung
Nicht für große Datensätze optimiert
Abhängig von externer XML-Parsing-Logik
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
gpx
A Dart library for loading, manipulating, and saving GPS data in GPX format
(https://www.topografix.com/gpx.asp), a light-weight XML data format for the
interchange of GPS data, including waypoints, routes, and tracks.
View the official GPX 1.1 Schema at https://www.topografix.com/GPX/1/1/gpx.xsd.
It also supports exporting Gpx data into:
KML (a file format used to display geographic data in an Earth browser such as Google Earth, https://developers.google.com/kml/)
CSV (not implemented yet)
Getting Started
In your dart/flutter project add the dependency:
dependencies:...gpx:^2.5.0
Reading XML
To read XML input use the GpxReader object and function Gpx fromString(String input):
Some GPX applications expect the standard GPX 1.1 namespace and schema declarations on the root <gpx> element. Use
GpxCompatibilityMode.gpx11 when writing files for applications such as EasyGPS, JPX, Garmin BaseCamp, and other strict
GPX parsers:
final xml = GpxWriter().asString(
gpx,
pretty: true,
compatibility: GpxCompatibilityMode.gpx11,
);
This writes a root element with the standard GPX 1.1 declarations:
For Garmin BaseCamp files that also need the Garmin GpxExtensions/v3
namespace, combine the GPX 1.1 compatibility mode with GpxNamespaces.garmin:
final xml = GpxWriter().asString(
gpx,
pretty: true,
compatibility: GpxCompatibilityMode.gpx11,
namespaces: GpxNamespaces.garmin,
);
Custom namespaces and attributes are applied after the compatibility mode,
so they can extend or override the default GPX 1.1 declarations when needed.
Garmin GpxExtensions v3
The package includes typed models for the Garmin GpxExtensions/v3, TrackPointExtension/v1, and
WaypointExtension/v1 schemas: