Part 4 - Visualizing time enabled data on the map widget¶
Time-enabled data¶
ArcGIS API for Python also supports visualizing time-enabled data on the map widget by setting the time_slider
property and calling the set_time_extent
method to initialize the start_time
, end_time
, interval
, and unit
arguments of the time filter.
time_slider
is a property that determines whether a time slider exists for a map widget. If set to True
, the property will display a time slider in the widget that will allow you to visualize temporal data for an applicable layer added to the map. Its default value is False
.
The set_time_extent
is called when time_slider = True
and is the time extent that will display on the time slider. In order to properly call the method set_time_extent(start_time, end_time, interval=1, unit='milliseconds')
, we need to specify the following arguments:
start_time
: Requireddatetime.datetime
. The lower bound of the time extent to display on the time slider.end_time
: Requireddatetime.datetime
. The upper bound of the time extent to display on the time slider.interval
: Optional number with a default of 1. The numerical value of the time extent.unit
: Optional string that defaults to milliseconds. Temporal units. Possible values can be seen in: “milliseconds”, “seconds”, “minutes”, “hours”, “days”, “weeks”, “months”, “years”, “decades”, “centuries”.
import arcgis
from arcgis.gis import GIS
# Create a GIS object, as an anonymous user for this example
gis = GIS()
# Create a map widget
map8 = gis.map('California') # Passing a place name to the constructor
# will initialize the extent of the map.
map8