Display device location with NMEA data sources

View inFormsWPFWinUIView on GitHub

Parse NMEA sentences and use the results to show device location on the map.

Image of NMEA location data source

Use case

NMEA sentences can be retrieved from GPS receivers and parsed into a series of coordinates with additional information. Devices without a built-in GPS receiver can retrieve NMEA sentences by using a separate GPS dongle, commonly connected bluetooth or through a serial port.

The NMEA location data source allows for detailed interrogation of the information coming from the GPS receiver. For example, allowing you to report the number of satellites in view.

How to use the sample

Tap "Start" to parse the NMEA sentences into a simulated location data source, and initiate the location display. Tap "Recenter" to recenter the location display. Tap "Reset" to reset the location display.

How it works

  1. Load NMEA sentences from a local file.
  2. Parse the NMEA sentence strings, and push data into NmeaLocationDataSource.
  3. Set the NmeaLocationDataSource to the location display's data source.
  4. Start the location display to begin receiving location and satellite updates.

Relevant API

  • Location
  • LocationDisplay
  • NmeaLocationDataSource
  • NmeaSatelliteInfo

About the data

A list of NMEA sentences is used to initialize a to simulate a stream of NMEA data. This simulated data source provides NMEA data periodically, and allows the sample to be used on devices without a GPS dongle that produces NMEA data.

The route taken in this sample features a 2-minute driving trip around Redlands, CA.

Additional information

Below is a list of protocol strings for commonly used GNSS external accessories. Please refer to the ArcGIS Field Maps documentation for model and firmware requirements.

Supported by this sample

  • com.bad-elf.gps
  • com.eos-gnss.positioningsource
  • com.geneq.sxbluegpssource

Others

  • com.amanenterprises.nmeasource
  • com.dualav.xgps150
  • com.garmin.pvt
  • com.junipersys.geode
  • com.leica-geosystems.zeno.gnss
  • com.searanllc.serial
  • com.trimble.correction, com.trimble.command (1)

(1) Some Trimble models require a proprietary SDK for NMEA output.

Tags

dongle, GNSS, GPS, history, navigation, NMEA, real-time, RTK, trace

Sample Code

LocationWithNMEA.xamlLocationWithNMEA.xamlLocationWithNMEA.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<ContentPage x:Class="ArcGISRuntimeXamarin.Samples.LocationWithNMEA.LocationWithNMEA"
             xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:resources="clr-namespace:Forms.Resources">
    <RelativeLayout>
        <esriUI:MapView x:Name="MyMapView"
                        BindingContext="{x:Reference Name=ResponsiveFormContainer}"
                        Style="{StaticResource MapWithFormStyle}" />
        <resources:ResponsiveFormContainer x:Name="ResponsiveFormContainer">
            <StackLayout>
                <Label x:Name="AccuracyLabel" Text="Press start to begin." />
                <Label x:Name="CountLabel" />
                <Label x:Name="SatellitesLabel" />
                <Label x:Name="SystemLabel" />
                <Label x:Name="NmeaMessageLabel" LineBreakMode="TailTruncation" />
                <StackLayout Orientation="Horizontal">
                    <Button Margin="5"
                            Clicked="StartClick"
                            Text="Start" />
                    <Button Margin="5"
                            Clicked="ResetClick"
                            Text="Reset" />
                </StackLayout>
            </StackLayout>
        </resources:ResponsiveFormContainer>
    </RelativeLayout>
</ContentPage>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.