My Location widget

The My Location widget allows you to view and record your location and movement. The widget can retrieve your device's location and create individual points, known as locations, or record points continuously and create lines, known as paths. In addition to latitude and longitude, the widget records time, altitude, speed, orientation, and accuracy. Locations and paths become output data sources, meaning you can use data you create with the My Location widget with other widgets, such as the Table widget and List widget.

Experience Builder stores data retrieved with the My Location widget in your device's browser. If you refresh the page or close the browser window, the data is lost. To save data permanently, you can turn on the Export data action in the widget's Action settings and export to JSON, CSV, GeoJSON, or ArcGIS item.

Examples

Use this widget to support app design requirements such as the following:

  • You want emergency response crews to mark the locations of fallen power lines after a storm.
  • You want to create line features by walking along a new trail and continuously recording your location.
  • You want to track a truck through its delivery route.

Usage notes

This widget requires connection to a Map widget.

When you include this widget in an app with the Panel arrangement, the panel provides users with the following options:

  • Get location—Retrieve a new point. This button appears if Watch location is turned off in the widget settings.
  • Start watching—Start continuously retrieving locations. This button appears if Watch location is turned on in the widget settings.
  • End watching—Finish retrieving locations. This generates a path.
  • Trace a path—Manually create a path. You can do this while watching is running.
  • Show from the Map or Hide from the Map—Show or hide symbols for locations on the map.
    Tip:

    Layer visibility settings sync between the My Location widget and the Swipe, Map Layers, and Map widgets. If you hide a layer with one widget, it is also hidden for the other widgets.

  • You can delete individual records with the Delete the record button or delete all records with the Clear results button.
    Note:

    Deleting locations may cause associated paths to regenerate. Deleting paths may result in associated locations being deleted.

When you include this widget in an app with the Bar arrangement, the toolbar provides users with all of the same options, except data actions are unavailable.

The following table lists the attribute fields that the My Location widget can record for locations and paths:

FieldTypeDescription

ObjectID

Number

The system-managed ID field.

Timestamp

Date

The date and time when the point was recorded.

Longitude

Number

Longitude of the recorded point.

Latitude

Number

Latitude of the recorded point.

LineID

Number

Identifier that indicates the line to which the point belongs.

Altitude

Number

The altitude of the recording device measured in meters above mean sea level (MSL)

Orientation

Number

The orientation of the recording device.

Speed

Number

The speed of the recording device in meters per second.

Accuracy

Number

The accuracy of the recorded location measured in meters.

The My Location widget generates output data sources that other widgets can use. For example, you can view locations in a Table widget. To do this, add a Table widget to the app and click New sheet in the widget's settings. Click Outputs, and select Locations output view or Paths output view.

Settings

The My Location widget includes the following settings:

  • Select a Map widget—Select a Map widget.
  • Arrangement—Choose a user interface style for the widget, either Panel or Bar.
  • General settings—Configure general settings.
    • Highlight location—Display retrieved locations and the user's current location on the connected map.
      • Symbol color—Change the color of the location symbols on the map.
      • Show compass orientation—Add a triangle symbol to the user's current location that shows device orientation.
      • Show location accuracy—Add a buffer to the users current location that shows location accuracy.
    • Zoom scale—Specify a zoom scale for when the user retrieves or selects a record and the map zooms to that record.
    • Timeout (second)—The maximum time limit for retrieving a point location. If the widget takes longer than this amount of time to retrieve a point, it displays the message The location cannot be retrieved.
    • Select fields—Check the box next to each field to include it in the generated data.
      Note:

      ObjectID and Timestamp are required fields.

    • Watch location—Automatically and continuously retrieve locations. Turning on this option generates paths.
      • Streaming—Choose how often the widget retrieves a new point, either in time or distance.
        Note:

        The interval you set is the minimum possible interval between retrieving points. However, actual performance may vary depending on the browser and other parts of your web environment.

      • Manual path tracing—Include the Trace a path button in the widget panel at run time. This button allows the user to manually generate a path at any time during the watching process.
    • Show runtime layers in layer lists—Show Locations and Paths layers created by the My Location widget in the layer lists of other widgets, such as the Map Layers widget, the Legend widget, and the Map widget Layers tool.
    • Default activation—If you turn on this setting, the widget starts retrieving points as soon as the app loads at run time. If you turn off this setting, the widget starts retrieving points only when the user clicks the Start watching button.

Interaction options

This widget supports actions, which you can configure on the Action tab of the widget's settings.

Turn on data actions to add buttons to the widget's user interface for performing data processing tasks, such as exporting, zooming to locations, and viewing records in a table. To use data actions at run time, click Actions Actions and choose a data action from the drop-down menu that appears.