All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

GpxFileDataAdapter Class

A data adapter that loads data from GPX files, and displays it on vector layers.

Namespace: DevExpress.Xpf.Map

Assembly: DevExpress.Xpf.Map.v20.1.dll

Declaration

public class GpxFileDataAdapter :
    MapGeoDataAdapter,
    IListSource,
    IGpxOptionsProvider
Public Class GpxFileDataAdapter
    Inherits MapGeoDataAdapter
    Implements IListSource,
               IGpxOptionsProvider

Remarks

TIP

To try out the GpxFileDataAdapter, see the GPX Data Adapter demo.

GPX files store coordinate-based data such as waypoints, routes, and tracks in an XML-like format.

The Map Control converts GPX file elements as follows:

  • <wpt> (waypoint) is displayed as MapDot.
  • <rte> (route) is converted to a MapPolyline.
  • <trk> (track) is represented by a MapPath.

Routes and tracks are built based on trkpt coordinates nested inside <rte> or <trk> elements. If you enable the CreateRoutePoints property, map dots are generated for each trkpt element.

Follow the steps below to load data from a .GPX file:

  1. Add a VectorLayer object to the MapControl.Layers collection.
  2. Create a GpxFileDataAdapter object.
  3. Specify the path to a GPX file via the MapGeoDataAdapter.FileUri property.
  4. Assign the GpxFileDataAdapter to the VectorItemsLayer.Data property.
<Window xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:FileDataAdapters"
        x:Class="FileDataAdapters.MainWindow"
        xmlns:sys="clr-namespace:System;assembly=System"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <dxm:MapControl x:Name="mapControl">
            <dxm:ImageLayer>
                <dxm:BingMapDataProvider Kind="Road" BingKey="Your-BingKey-here"/>
            </dxm:ImageLayer>
            <dxm:VectorLayer x:Name="vectorLayer" DataLoaded="OnVectorLayerDataLoaded">
                <dxm:VectorLayer.Data>
                    <dxm:GpxFileDataAdapter ShapesLoaded="OnDataAdapterShapesLoaded" CreateRoutePoints="True">
                        <dxm:GpxFileDataAdapter.FileUri>
                            <sys:Uri>pack://application:,,,/FileDataAdapters;component/Data/boston-marathon-course.gpx</sys:Uri>
                        </dxm:GpxFileDataAdapter.FileUri>
                    </dxm:GpxFileDataAdapter>                    
                </dxm:VectorLayer.Data>
            </dxm:VectorLayer>
        </dxm:MapControl>
    </Grid>
</Window>

Note: In the example above, the GPX file's Build Action is set to Resource.

See Also