Package for load, manipulate, and save GPS data in GPX format (a light-weight XML data format for the interchange of GPS data - waypoints, routes, and tracks).
Package selection guidance compiled from public package information, community data, and project usage.
The gpx package enables Flutter developers to load, manipulate, and save GPS data in the GPX format—a lightweight XML-based standard for exchanging waypoints, routes, and tracks. It supports reading and writing GPX files across all major platforms, making it ideal for geolocation applications that require GPS data interoperability. The package provides a clean Dart API for parsing and generating GPX content with minimal overhead.
Use cases
Reading GPS tracks from files
Exporting route data to GPX
Integrating with mapping and navigation apps
Synchronizing GPS data between devices
Processing outdoor activity logs
Key features
Supports waypoints, routes, and tracks
Cross-platform compatibility
Simple XML parsing and generation
Lightweight and efficient
Full GPX 1.1 specification compliance
Suitable for
Fitness and outdoor apps
GPS data analysis tools
Map-based applications
Data exchange between GPS devices
Developers working with geospatial data
Considerations
Requires manual handling of file I/O
Limited to GPX format only
No built-in map rendering
Not optimized for large datasets
Depends on external XML parsing logic
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
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: