Class GpxImport
Turns a parsed GpxDocument into map content: waypoints become bulk-tier markers, track segments become polylines.
public static class GpxImport
- Inheritance
-
objectGpxImport
Remarks
Setup-time glue, not frame-loop code: call it once after Parse(string). The same shape as KmlImport, minus polygons, which GPX does not carry. Damaged content (a segment with fewer than 2 points) is counted on the GpxImport.Result rather than thrown, because an imported file is user data.
Elevations are ignored unless useElevations is true. GPX
elevation is height above sea level, not above the ground, so drawing
it raised would float a terrain-following hiking track hundreds of
meters over a flat map. Opting in also permanently raises the stores'
max-altitude watermark (see
MaxAltitudeMercator for the re-anchor cost
that carries).
Track names are not imported: a polyline is drawn geometry only and PolylineStore carries no text field to put them in.
Methods
Import(GpxDocument, MarkerStore, PolylineStore, float, uint, float, uint, MarkerInfoStore, bool)
Imports every track and waypoint in document
into the stores and reports what was added and what was skipped.
public static GpxImport.Result Import(GpxDocument document, MarkerStore markers, PolylineStore polylines, float markerSizePx, uint markerColorRgba, float lineWidthPx, uint lineColorRgba, MarkerInfoStore markerInfo = null, bool useElevations = false)
Parameters
documentGpxDocumentParsed GPX from Parse(string).
markersMarkerStoreReceives one marker per waypoint.
polylinesPolylineStoreReceives one polyline per track segment.
markerSizePxfloatMarker size in screen px (markers import in SceneSize, the map-pin behaviour).
markerColorRgbauintMarker fill, packed 0xRRGGBBAA.
lineWidthPxfloatPolyline width in screen px.
lineColorRgbauintPolyline color, packed 0xRRGGBBAA.
markerInfoMarkerInfoStoreOptional. When given, a waypoint's non-empty name becomes its marker's name. The marker store itself carries no text, by design; this store is where marker text lives.
useElevationsboolTrue to place markers and track points at their GPX elevation instead of on the map plane. See the type remarks for why the default is false.
Returns
Exceptions
- ArgumentNullException
documentor either store is null.