Track

Use dark colors for code blocksCopy
1
import "@arcgis/map-components/components/arcgis-track";

Track component is a button that animates the map or scene to the user's location when clicked. The view rotates based on device heading. The default heading symbol will display when speed is greater than zero and the browser provides heading information.

Known Limitations

  • The heading symbol is not currently supported within an arcgis-scene component.

Demo

Properties

PropertyAttributeType
auto-destroy-disabled
boolean
error
any
geolocation-options
any
go-to-location-disabled
boolean
(((view: MapView | SceneView, goToParameters: GoToParameters) => void))
icon
string
label
string
{ componentLabel?: string | undefined; startTracking?: string | undefined; stopTracking?: string | undefined; permissionError?: string | undefined; timeoutError?: string | undefined; positionUnavailable?: string | undefined; }
position
"bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"
Function
reference-element
ArcgisLinkChart | ArcgisMap | ArcgisScene | string
scale
number
state
readonly
"disabled" | "error" | "feature-unsupported" | "ready" | "tracking" | "waiting"
tracking
readonly
boolean

autoDestroyDisabled

Property
autoDestroyDisabled: boolean

If true, the component will not be destroyed automatically when it is disconnected from the document. This is useful when you want to move the component to a different place on the page, or temporary hide it. If this is set, make sure to call the `destroy` method when you are done to prevent memory leaks.

Attribute
auto-destroy-disabled
Default value
false

error

Property
error: any

Error that caused the last track-error event to fire.

Read more...

Attribute
error
Default value
null

geolocationOptions

Property
geolocationOptions: any

An object used for setting optional position parameters.

Read more...

Attribute
geolocation-options
Default value
null

goToLocationDisabled

reflected

Attribute changes are reflected on the DOM.

Property
goToLocationDisabled: boolean

Indicates whether to navigate the view to the position and scale of the geolocated result.

Read more...

Attribute
go-to-location-disabled
Default value
false

goToOverride

Property
goToOverride: (((view: MapView | SceneView, goToParameters: GoToParameters) => void))

This function provides the ability to override either the MapView goTo() or SceneView goTo() methods.

Read more...

graphic

Property
graphic: Graphic

The graphic used to show the user's location on the map.

Read more...

icon

reflected

Attribute changes are reflected on the DOM.

Property
icon: string
Attribute
icon
Default value
"compass-north-circle"

label

Property
label: string

The component's default label.

Attribute
label

messageOverrides

Property
messageOverrides: { componentLabel?: string | undefined; startTracking?: string | undefined; stopTracking?: string | undefined; permissionError?: string | undefined; timeoutError?: string | undefined; positionUnavailable?: string | undefined; }

Replace localized message strings with your own strings.

position

reflected

Attribute changes are reflected on the DOM.

Property
position: "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"
Attribute
position
Default value
"top-left"

positionFilterFunction

Property
positionFilterFunction: Function

A function that is used as an expression to evaluate geolocation points, and returns a boolean value.

Read more...

Default value
null

referenceElement

Property
referenceElement: ArcgisLinkChart | ArcgisMap | ArcgisScene | string
Attribute
reference-element

scale

Property
scale: number

Indicates the scale to set on the view when navigating to the position of the geolocated result, after a location is returned from the track event.

Read more...

Attribute
scale
Default value
null

state

readonlyProperty
state: "disabled" | "error" | "feature-unsupported" | "ready" | "tracking" | "waiting"

The current state of the component.

Default value
"disabled"

tracking

readonlyProperty
tracking: boolean

Indicates whether new positions are being watched.

Read more...

Default value
false

Methods

MethodSignature
componentOnReady(): Promise<void>
destroy(): Promise<void>
start(): Promise<void>
stop(): Promise<void>

componentOnReady

Method
componentOnReady(): Promise<void>

Create a promise that resolves once component is fully loaded.

Returns
Promise<void>

destroy

Method
destroy(): Promise<void>

Permanently destroy the component

Returns
Promise<void>

start

Method
start(): Promise<void>
Returns
Promise<void>

stop

Method
stop(): Promise<void>
Returns
Promise<void>

Events

EventType
TrackViewModelTrackEvent
TrackViewModelTrackErrorEvent
{ name: "state"; }
undefined

arcgisComplete

Event
arcgisComplete: TrackViewModelTrackEvent
bubbles

Events triggered on this element will be propagated to their outermost elements.

composed

The event is composable and will propagate across the shadow DOM into the standard DOM.

cancelable

The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.

arcgisError

Event
arcgisError: TrackViewModelTrackErrorEvent
bubbles

Events triggered on this element will be propagated to their outermost elements.

composed

The event is composable and will propagate across the shadow DOM into the standard DOM.

cancelable

The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.

arcgisPropertyChange

Event
arcgisPropertyChange: { name: "state"; }

Fired when the value of a property is changed. Use this to listen to changes to properties.

bubbles

Events triggered on this element will be propagated to their outermost elements.

composed

The event is composable and will propagate across the shadow DOM into the standard DOM.

cancelable

The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.

arcgisReady

Event
arcgisReady: undefined
bubbles

Events triggered on this element will be propagated to their outermost elements.

composed

The event is composable and will propagate across the shadow DOM into the standard DOM.

cancelable

The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.

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