Create Space Time Cube

Create Space Time Cube

Create Space Time Cube works with a layer of point features that are time enabled. It aggregates the data into a three-dimensional cube of space-time bins. When determining the point in a space-time bin relationship, statistics about all points in the space-time bins are calculated and assigned to the bins. The most basic statistic is the number of points within the bins, but you can calculate other statistics as well.

For example, suppose you have point features of crimes in a city, and you want to summarize the number of crimes in both space and time. You can calculate the space-time cube for the dataset, and use the cube to further analyze trends such as emerging hot and cold spots.

Request URL

http://<analysis url>/CreateSpaceTimeCube/submitJob

Request parameters

Parameter

Description

pointLayer

(Required)

The point features that will be aggregated into the bins specified in geographical size by the binSize and binSizeUnit parameters and temporal size by the timeStepInterval and timeStepIntervalUnit parameters.

Syntax: As described in detail in the Feature input topic, this parameter can be one of the following:

  • A URL to a feature service layer with an optional filter to select specific features
  • A URL to a big data catalog service layer with an optional filter to select specific features
  • A feature collection

Examples:

  • {"url": <feature service layer url>, "filter": <where clause>}
  • {"layerDefinition": {}, "featureSet": {}, "filter": <where clause>}

Analysis using bins requires a projected coordinate system. When aggregating layers into bins, it is required that the input layer or processing extent (processSR) has a projected coordinate system. At 10.5.1, if a projected coordinate system is not specified when running analysis the World Cylindrical Equal Area (wkid 54034) projection will be used.

binSize

(Required)

The distance for the bins into which pointLayer will be aggregated.

Example: "binSize": 100

binSizeUnit

(Required)

The distance unit for the bins into which pointLayer will be aggregated.

Values: Milliseconds | Seconds | Minutes | Hours | Days | Weeks| Months | Years

Example: "binSizeUnit": "Meters"

timeStepInterval

(Required)

A numeric value that specifies the duration of the time bin.

Example: "timeStepInterval": 20

timeStepIntervalUnit

(Required)

A numeric value that specifies the duration unit of the time bin.

Values: Milliseconds | Seconds | Minutes | Hours | Days | Weeks| Months | Years

Example: "timeStepIntervalUnit": "Years"

timeStepAlignment

(Required)

Defines how aggregation will occur based on a given timeInterval. Options are as follows:

  • StartTime—Time is aligned to the first feature in time
  • EndTime—Time is aligned to the last feature in time
  • ReferenceTime—Time is aligned a specified time

Example: "timeStepAlignment" : "StartTime"

timeStepReference

(Required if timeStepAlignment is ReferenceTime)

A date that specifies the reference time to align the time bins to if ReferenceTime is specified in timeIntervalAlignment. This time is given in milliseconds from epoch.

Example: "timeStepReference": 946684800000

summaryFields

A list of field names, statistical summary types, and the fill option for empty values that you want to calculate for all points within each space-time bin. Note that the count of points within each bin is always returned. By default, all statistics are returned.

Syntax: [{"statisticType": "<statistic type>", "onStatisticField" : "<field name>", "fillType" : "<fill type>" }, ...]

fieldName is the name of the fields found in the input point layer.

statististicType is one of the following for numeric fields:

  • Sum—Adds the total value of all the points in each polygon.
  • Mean—Calculates the average of all the points in each polygon.
  • Min—Finds the smallest value of all the points in each polygon.
  • Max—Finds the largest value of all the points in each polygon.
  • Std—Finds the standard deviation of all the points in each polygon.

statisticType is the following for string fields:

  • Count—Totals the number of string for all the points in each polygon.

fillType is one of the following:

  • zeros—Fills missing values with zeros. This is most appropriate for fields representing counts.
  • spatialNeighbors—Fills missing values by averaging the spatial neighbors. Neighbors are determined by a second degree queens contiguity.
  • spaceTimeNeighbors—Fills missing values by averaging the space-time neighbors. Neighbors are determined by a second degree queens contiguity in both space and time.
  • temporalTrend—Interpolates values using a univariate spline.

Example: "summaryFields": [{"statisticType": "Count", "onStatisticField": "newEmployees", "fillType" : "zeros" },{"statisticType": "Sum", "onStatisticField": "Annual_Sales", "fillType" : "temporalTrend"}]

outputName

(Required)

The task will create a space time cube (netCDF) of the results. You define the name of the space time cube.

Example: "outputName" : "myOutputName"

context

Context contains additional settings that affect task execution. For this task, there are three settings:

  • Extent (extent)—A bounding box that defines the analysis area. Only those features that intersect the bounding box will be analyzed.
  • Processing spatial reference (processSR)—The features will be projected into this coordinate system for analysis.

Syntax:
{
"extent" : {extent},
"processSR" : {spatial reference}
}

f

The response format. The default response format is html.

Values: html | json

Response

When you submit a request, the service assigns a unique job ID for the transaction.

Syntax:
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}

After the initial request is submitted, you can use jobId to periodically check the status of the job and messages as described in Checking job status. Once the job has successfully completed, use the jobId to retrieve the results. To track the status, you can make a request of the following form:

http://<analysis url>/CreateSpaceTimeCube/jobs/<jobId>

Accessing results

When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:

http://<analysis url>/CreateSpaceTimeCube/jobs/<jobId>/results/outputCube?token=<your token>&f=json

Parameter

Description

outputCube

outputCube will always contain a netCDF cube. The number of resulting bins in the cube is dependent on the location of inputPoints and the bin size settings.

If a summaryFields parameter is specified in the task request, the layer will compute the count statistic, as well as anything specified in summaryFields.

Request example:
{"url": 
"http://<analysis url>/CreateSpaceTimeCube/jobs/<jobId>/results/outputCube"}

The result has properties for parameter name, data type, and value. The contents of value depend on the outputName parameter provided in the initial request. The value parameter contains the URL of the output cube.

{
"paramName":"outputCube", 
"dataType":"GPDataFile",
"value":{"url":"<hosted feature service layer url>"}
}
When you browse to the output URL, your netCDF will automatically download to your local machine.

10/6/2017