Create, save, and preview a KML multi-track captured from a location data source.

Use case
When capturing location data for outdoor activities such as hiking or skiing, it can be useful to record and share your path. This sample demonstrates how you can collect individual KML tracks during a navigation session, then combine and export them as a KML multi-track.
How to use the sample
Tap “Record Track” to start recording your current path on the simulated trail. Tap “Stop Recording” to end recording and capture a KML track. Repeat these steps to capture multiple KML tracks in a single session. Tap the save button to convert the recorded tracks into a KML multi-track and save it to a local
file. Then, use the picker to select a track from the saved KML multi-track. Tap the Delete button to remove the local file and reset the sample.How it works
- Create a with a basemap style and a to display the path geometry for your navigation route.
- Create a to drive the .
- As you receive updates, add each point to a list of objects while recording.
- Once recording stops, create a using one or more objects.
- Combine one or more objects into a .
- Save the inside a , then export the document to a file.
- Load the saved file into a and locate the in the dataset’s . From the document’s , get the and retrieve the geometry.
- Retrieve the geometry of each track in the by iterating through the list of tracks and obtaining the respective .
Relevant API
- KMLDataset
- KMLDocument
- KMLMultiTrack
- KMLPlacemark
- KMLTrack
- KMLTrackElement
- LocationDisplay
- SimulatedLocationDataSource
Tags
export, hiking, KML, KMZ, multi-track, record, track