Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for Qt

Time based query

Sample Viewer View Sample on GitHub

Query data using a time extent.

Use case

This workflow can be used to return records that are between a specified start and end date. For example, records of Canada goose sightings over time could be queried to only show sightings during the winter migration time period.

How to use the sample

Run the sample, and a subset of records will be displayed on the map.

How it works

  1. An instance of ServiceFeatureTable is created by passing a URL to the REST endpoint of a time-enabled service. Time-enabled services will have TimeInfo defined in the service description. This information is specified in ArcMap or ArcGIS Pro prior to publishing the service.
  2. The feature request mode of the ServiceFeatureTable is set to Enums.FeatureRequestModeManualCache, so that the developer can control how and when the feature table is populated with data.
  3. A FeatureLayer is created by passing in the instance of the ServiceFeatureTable.
  4. A TimeExtent object is created by specifying start and end date/time objects.
  5. A QueryParmaters object is created with the TimeExtent.
  6. ServiceFeatureTable.populateFromService is executed by passing in the QueryParameters.
  7. The feature table is populated with data that matches the provided query.

Relevant API

  • QueryParameters
  • ServiceFeatureTable.populateFromService
  • TimeExtent

About the data

This sample uses Atlantic hurricane data from the year 2000. The data is from the National Hurricane Center (NOAA / National Weather Service).


query, time, time Extent

Sample Code

import QtQuick 2.6
import Esri.ArcGISRuntime 100.9

Rectangle {
    id: rootRectangle
    clip: true
    width: 800
    height: 600

    MapView {
        id: mapView
        anchors.fill: parent

        Map {
            BasemapOceans {}

            FeatureLayer {
                ServiceFeatureTable {
                    id: hurricaneTable
                    url: ""
                    featureRequestMode: Enums.FeatureRequestModeManualCache // set the cache mode to manual
                    onLoadStatusChanged: {
                        if (loadStatus === Enums.LoadStatusLoaded) {
                            const clearCache = true;
                            const outFields = ["*"];

                            // populate the table with records matching the query
                            hurricaneTable.populateFromService(queryParams, clearCache, outFields);

    // create query parameters with time extent that includes anything before September 16, 2000
    QueryParameters {
        id: queryParams

        TimeExtent {
            startTime: new Date("January 1, 0001")
            endTime: new Date("September 16, 2000")