Skip to content

GPX

The gpx module contains data types for the GPS Exchange Format (GPX) version 1.1.

val document =
Document(
metadata = Metadata(name = "My GPX File"),
waypoints =
listOf(
Waypoint(1.0, 2.0),
Waypoint(3.0, 4.0),
Waypoint(5.0, 6.0),
Waypoint(7.0, 8.0),
),
)
val gpxString = Gpx.encodeToString(document)

Details can be found in the API reference.

commonMain {
dependencies {
implementation("org.maplibre.spatialk:gpx:0.8.0")
}
}

This module provides extension functions to convert GPX data into GeoJson. The original Gpx type is attached as feature properties.

val waypoint = Waypoint(10.0, 2.0)
val feature: Feature<Point, Waypoint> = waypoint.toGeoJson()