GPX Thumbnail Image
- UIKit
This example demonstrates how to use GEMKit in a UIKit application to generate a static map thumbnail image from a .gpx track without displaying a full interactive map to the user.
Check the full implementation on GitHub.
Off-screen Map Setup
A MapViewController is created with a fixed frame but never added to the view hierarchy. GEMSdkDelegate callbacks trigger generation only when the map data is current and an internet connection is available:
Loading the GPX Path and Placing Markers
The GPX data is parsed into a PathObject, then start and end markers are placed using ImageDatabaseObject pin images. The path is rendered on the off-screen map with custom border and inner colours:
Waiting for Map Tiles and Capturing the Screenshot
Once the path is centred, a setOnMapViewRendered callback waits until the map is fully rendered and stationary before calling makeScreenshot(), which uses snapshotImage(with:capture:) to produce the final thumbnail: