Extract Data

Extract Data

The Extract Data task is used to extract data from one or more layers within a given extent. The extracted data format can be CSV, KML, a file geodatabase, or a shapefile. File geodatabases and shapefiles are added to a .zip file that can be downloaded.

Request URL

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

Request parameters

ParameterDescription

inputLayers

(Required)

A list of input layers to be extracted.

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

  • A list of URLs to a feature service layer with an optional filter to select specific features
  • A list of feature collections.

Examples:

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

extent

The area of interest used to extract the input features.

Note:

The extent can also be set using the extent option for the context parameter. The default processing extent is the full extent of the dataset.

If an extent layer is used, the features that are extracted must be within the extent of both the extent layer and the processing extent. If no extent layer is selected, the extent will be based solely on the processing extent.

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 feature collection

clip

A Boolean value that specifies whether the features in the input layer are clipped within the extent parameter. By default, features are not clipped and all features intersecting the extent are returned. The default is false.

Values: true | false

dataFormat

A keyword defining the output data format for the extracted data.

Values: FILEGEODATABASE | SHAPEFILE | KML | CSV

The default is CSV.

If FILEGEODATABASE is specified, and the input layer has attachments, the attachments are extracted to the output file geodatabase if clip is false. If clip is true, attachments are not extracted.

outputName

The name of the item on your My contents page. For more information on these item properties, see the Item resource page in the ArcGIS REST API.

Syntax:
{
"itemProperties":{
    "title": "<title>",
    "tags": "<tags>",
    "snippet": "<snippet>",
    "description": "<description>"
}

context

The Context parameter contains the following additional settings that affect task operation:

  • Extent (extent)—A bounding box that defines the analysis area. Only input features that intersect the bounding box will be analyzed.
  • Output spatial reference (outSR)—The output features will be projected into the output spatial reference.

Syntax:

{
"extent" : {extent},
"outSR" : {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>"
}

Checking job status

After the initial request is submitted you can use the 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>/ExtractData/jobs/<jobId>

Analysis results

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

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

ParameterDescription

contentID

The result has properties for parameter name, data type, and value. The value property contains the item ID and a URL to the item.

{
"paramName": "contentID",
"dataType": "GPString",
"value": {
  "itemId": "<item ID>",
  "url": "<url to item>"
}

Consider the following about the item contents:

  • If the value of the dataFormat parameter is FILEGEODATABASE or SHAPEFILE, the contents of the item is a .zip file containing the file geodatabase or shapefile.
  • If dataFormat is CSV, the contents of the item is a .csv file. If more than one input layer is supplied, the contents of the item is a .zip file containing multiple .csv files.
  • If dataFormat is KML, the contents of the item is a .kml file. If more than one input layer is supplied, the contents is a .kmz file.

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