You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Display your device's location history on the map.
4
+
5
+

6
+
7
+
## Use case
8
+
9
+
You can track device location history and display it as lines and points on the map. The history can be used to visualize how the user moved through the world, to retrace their steps, or to create new feature geometry. An unmapped trail, for example, could be added to the map using this technique.
10
+
11
+
## How to use the sample
12
+
13
+
Tap 'Start Tracking' to start tracking your location, which will appear as points on the map. A line will connect the points for easier visualization. Tap 'Stop Tracking' to stop updating the location history. This sample uses a simulated data source to allow the sample to be useful on desktop/non-mobile devices. To track a user's real position, use the `LocationDataSource` instead.
14
+
15
+
## How it works
16
+
17
+
1. Create a graphics overlay to show each point and another graphics overlay for displaying the route line.
18
+
2. Create a `SimulatedLocationDataSource` and initialize it with a polyline. Start the `SimulatedLocationDataSource` to begin receiving location updates.
19
+
- NOTE: To track a user's real position, use `LocationDataSource` instead.
20
+
3. Subscribe to the `onLocationChanged` event to handle location updates.
21
+
4. Every time the location updates, store that location, display a point on the map, and recreate the route line.
22
+
23
+
## Relevant API
24
+
25
+
* LocationDataSource
26
+
* LocationDisplay
27
+
* LocationDisplayAutoPanMode
28
+
* PolylineBuilder
29
+
* SimpleLineSymbol
30
+
* SimpleMarkerSymbol
31
+
* SimpleRenderer
32
+
* SimulatedLocationDataSource
33
+
* Graphic
34
+
* GraphicsOverlay
35
+
36
+
## About the data
37
+
38
+
A custom set of points is used to create a `Polyline` and initialize a `SimulatedLocationDataSource`. This simulated location data source enables easier testing and allows the sample to be used on devices without an actively updating GPS signal.
0 commit comments