LocationDisplay

Manages the display of a device's location in a MapView. Location display can retrieve the device's current location from a com.arcgismaps.location.LocationDataSource and display it on top of an com.arcgismaps.mapping.ArcGISMap. As the device moves, the map view can respond to new locations by updating the position of the location symbol on the display. It can also set the viewpoint when an updated location is received, or automatically pan and rotate the map when the current location, heading, or course changes.

Each MapView has its own instance of LocationDisplay so you don't have to explicitly instantiate the location display. The location information is provided by a com.arcgismaps.location.LocationDataSource. The current position of the device is provided by default from the operating system. To start receiving location updates, and display the current location, you must start the location display's data source.

Apart from the device operating system's built-in location, you can also display locations from other sources, including external (high accuracy) GPS, an indoor positioning system (IPS), or simulated locations (for mocking location updates) using the following location data sources:

By default, the location display uses a blue, round symbol to show the current location. Depending on signal strength, satellite positions, and other factors, the accuracy of the reported location can vary. An additional blue circle (LocationDisplay.accuracySymbol) around the location symbol indicates the estimated range of accuracy for the current location. As locations are read from the configured com.arcgismaps.location.LocationDataSource, this outer circle may contract and expand as accuracy increases or decreases. You can display further information about the location using the following symbols:

You can change the default symbology of these symbols to make them more visible against the underlying map cartography, increase their visibility for visually impaired users, or match an app's visual appearance.

Since

200.1.0

See also

Constructors

Link copied to clipboard
constructor()

Create a location display that can be assigned to a MapView.

Properties

Link copied to clipboard

A symbol used to represent location accuracy. The accuracy of the location can vary depending on signal strength, satellite positions, and other factors. This circle may contract and expand as the accuracy of the locations, read from the com.arcgismaps.location.LocationDataSource, increases or decreases.

Link copied to clipboard

The symbol used to display the last known location while the current location is being acquired. The symbol will be shown until a new location fix is found. This symbol may be used immediately after starting the LocationDisplay. Once an up-to-date location is acquired, the LocationDisplay.defaultSymbol, LocationDisplay.courseSymbol, or LocationDisplay.headingSymbol is used, depending on the current settings of the LocationDisplay. The default symbol is a grey circle.

Link copied to clipboard

Defines how the MapView reacts when location updates are received. The different auto-pan modes are suited for different types of app, including modes designed for navigation on foot and in a vehicle. They affect the symbols used to display device location, the initial zooming behavior, and the panning behavior of the MapView.

Link copied to clipboard

The symbol used to display the current location and the course (direction of travel) when moving. This symbol rotates with the heading of the movement. If course information is not available (for example if the device is not moving), the LocationDisplay.defaultSymbol is used.

Link copied to clipboard

The location data source used for generating location updates. LocationDisplay uses a location data source to provide the current position of the device. To start receiving location updates, and display the current location, you must start the location data source.

Link copied to clipboard

The symbol used for the location when not moving. Changing the location symbols is typically done if the existing symbols do not work well with the underlying map cartography, to increase visibility for visually impaired users, or to match an apps visual appearance.

Link copied to clipboard

The heading angle of the current location in degrees relative to north. This is only applicable when the auto-pan mode is com.arcgismaps.location.LocationDisplayAutoPanMode.CompassNavigation. The value 0 means the device is pointed toward magnetic north, 90 means it is pointed due east, 180 means it is pointed due south, and so on. A negative value indicates that the heading could not be determined.

Link copied to clipboard

The symbol used for the location when the auto-pan mode is com.arcgismaps.location.LocationDisplayAutoPanMode.CompassNavigation. The symbol is rotated to match with the heading of the compass. If there is no heading information (for example, if the device does not have a compass sensor), the LocationDisplay.defaultSymbol is used.

Link copied to clipboard

The scale that the map should automatically be zoomed to upon receiving the first location update. The initial map scale to which the MapView will zoom when the first location update is received after the auto-pan mode is changed from com.arcgismaps.location.LocationDisplayAutoPanMode.Off to any other value. The default value is 10,000.

Link copied to clipboard
val location: StateFlow<Location?>

The most recent location reported by the location data source. The com.arcgismaps.location.Location provides data for the single location, including position, course, velocity, and accuracy.

Link copied to clipboard

The map position of the most recent location reported by the location data source in the projection of the current map view.

Link copied to clipboard

The navigation point height factor. The factor will decide the location symbol position vertically from the bottom of the map when the auto-pan mode is com.arcgismaps.location.LocationDisplayAutoPanMode.Navigation. When navigating in a map, the current location is typically vertically positioned near the bottom of the map, and horizontally centered in the map, so that the map displays as much of the route ahead as possible.

Link copied to clipboard

The opacity value of all symbols displayed by the LocationDisplay. The value should be between 0 and 1.

Link copied to clipboard

The symbol that will be animated around the location symbol, to indicate when location updates are received. Location update animations are only shown when LocationDisplay.showPingAnimationSymbol is true.

Link copied to clipboard

True if the LocationDisplay.accuracySymbol is shown, false otherwise.

Link copied to clipboard

True if location symbols are shown, false otherwise.

Link copied to clipboard

True if the LocationDisplay.pingAnimationSymbol is shown, false otherwise.

Link copied to clipboard
val statusChanged: SharedFlow<Boolean>

A SharedFlow that emits a Boolean value when the status of the location display changes. The value emitted indicates if the location data source is started or not.

Link copied to clipboard

True if the LocationDisplay.courseSymbol is used to display current location, when the location updates indicate the device is moving, false otherwise. If no course information is available, the default symbol will be used instead. The LocationDisplay.courseSymbol is rotated in order to indicate the device's direction of travel. Generally, course information is only available if the device is actively moving (the location has a positive speed).

Link copied to clipboard

The wander extent factor controls the re-centering behavior of the MapView when the location changes. The proportion of the current extent within which the location can be without automatically panning the map. Permitted values are in the range between 0 (continuous panning) and 1 (only pan when the location reaches the edge of the current extent). This value only applies when the auto-pan mode is com.arcgismaps.location.LocationDisplayAutoPanMode.Recenter. Lower values within this range will cause the map to re-center more often, leading to higher CPU and battery consumption.

Functions

Link copied to clipboard

Sets the value of the autoPanMode StateFlow property.