Table of Contents

Class GpxImport

Namespace
LansMap.Core.Import

Turns a parsed GpxDocument into map content: waypoints become bulk-tier markers, track segments become polylines.

public static class GpxImport
Inheritance
object
GpxImport

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

document GpxDocument

Parsed GPX from Parse(string).

markers MarkerStore

Receives one marker per waypoint.

polylines PolylineStore

Receives one polyline per track segment.

markerSizePx float

Marker size in screen px (markers import in SceneSize, the map-pin behaviour).

markerColorRgba uint

Marker fill, packed 0xRRGGBBAA.

lineWidthPx float

Polyline width in screen px.

lineColorRgba uint

Polyline color, packed 0xRRGGBBAA.

markerInfo MarkerInfoStore

Optional. 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.

useElevations bool

True 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

GpxImport.Result

Exceptions

ArgumentNullException

document or either store is null.