/analyze: Analyze

URL:
https://[root]/content/features/analyze
Methods:
GET

Example usage

Use dark colors for code blocksCopy
1
2
3
https://www.arcgis.com/sharing/rest/content/features/analyze
itemid=a48f99193139447ba64b721450fb00bd
filetype=excel

Description

The Analyze call helps a client analyze a CSV, Excel file (.xlsx,.xls), Shapefile, or GeoPackage prior to publishing or generating features using the Publish or Generate operation, respectively.

Analyze returns information about the file including the fields present as well as sample records. Analyze attempts to detect the presence of location fields that may be present as either x,y fields or address fields.

Analyze packages its result so that publishParameters within the JSON response contains information that can be passed back to the server in a subsequent call to Publish or Generate. The publishParameters subobject contains properties that describe the resulting layer after publishing, including its fields, the desired renderer, and so on. Analyze will suggest defaults for the renderer.

In a typical workflow, the client will present portions of the Analyze results to the user for editing before making the call to Publish or Generate.

If the file to be analyzed currently exists in the portal as an item, callers can pass in its itemId. Callers can also directly post the file. In this case, the request must be a multipart post request pursuant to IETF RFC1867. The third option for text files is to pass the text in as the value of the text parameter.

Request parameters

ParameterDetails

id

The ID of the item to be analyzed.

Example: id=345313e619df46f387f9ededbe15ac56

file

The file to be analyzed.

Example: file=mystreets.csv

text

The text in the file to be analyzed.

Example: text=<text_in_file>

filetype

The type of input file.

Values: shapefile | csv | excel | geoPackage

Example: filetype=csv

analyzeParameters

A JSON object that provides geocoding information.

Example: analyzeParameters:{"sourceLocale":"en"}

Analyze Parameters JSON object

The analyzeParameters JSON object s used to analyze a CSV or Excel file are described below.

ParameterDetails

sourcelocale

The locale used for the geocoding service source.

geocodeServiceUrl

The URL of the geocoding service that supports batch geocoding.

locationType

Indicates the type of spatial information stored in the dataset.

Values for CSV: coordinates | address | lookup | none

Values for Excel: coordinates | address | none

sourcecountry

The two-character country code associated with the geocoding service. The default is "world".

sourcecountryhint

If the first time analyzing, the hint is used. If the source country is already specified,sourcecountry is used.

A sample analyzeParameters JSON object for a CSV or Excel file is as follows:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
{
   "enableGlobalGeocoding": true,
   "sourceLocale":"en",
   "geocodeServiceUrl": "https://<server>/sharing/rest/services/World/GeocodeServer",
   "locationType": "address",
   "sourceCountry":"",
   "sourceCountryHint":"world"
}

Example usage for CSV

Use dark colors for code blocksCopy
1
2
3
https://www.arcgis.com/sharing/rest/content/features/analyze
itemid=345313e619df46f387f9ededbe15ac56
filetype=csv

JSON Response example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
   "fileSize": 921,
   "fileUrl": "https://www.arcgis.com/sharing/rest/content/items/345313e619df46f387f9ededbe15ac56/data?token=",
   "publishParameters":{
		"type": "csv",
		"name": "data",
		"sourceUrl": "",
		"locationType": "address",
		"maxRecordCount": 1000,
		"geocodeServiceUrl": "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",
		"sourceCountry": "us",
		"sourceLocale": "en",
		"addressFields": {
			"Address": "Street",
			"City": "City",
			"Region": "State",
			"Postal": "Zip"
			},
		"standardizedFieldNames": {
			"Address": "Street",
			"City": "City",
			"Region": "State",
			"Postal": "ZIP",
			"PostalExt": "ZIP4",
			"CountryCode": "Country"
		},
		"columnDelimiter": ",",
      ....
   },
   "records":[
      {
        "attributes": {
			"Name": "ESRI-California",
			"Street": "380 New York Street",
			"City": "Redlands",
			"State": "CA",
			"Zip": "92373-8100"
		       }
     	}, {
		"attributes": {
			"Name": "ESRI-Denver",
			"Street": "One International Court",
			"City": "Broomfield",
			"State": "CO",
			"Zip": "80021-3200"
			}
	    },
     ...
    ]
  }

Example usage for Excel

Use dark colors for code blocksCopy
1
2
3
https://www.arcgis.com/sharing/rest/content/features/analyze
itemid=a48f99193139447ba64b721450fb00bd
filetype=excel

JSON Response example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
   "fileUrl": "https://www.arcgis.com/sharing/rest/content/items/a48f99193139447ba64b721450fb00bd/data?token=",
   "publishParameters":{
		"type": "excel",
		"name": "data",
		"sourceUrl": "",
		"maxRecordCount": 2000,
		"sourceSR": {
			"wkid": 4326,
			"latestWkid": 4326
			},
		"targetSR": {
			"wkid": 102100,
			"latestWkid": 3857
			},
		"editorTrackingInfo": {
			"enableEditorTracking": false,
			"enableOwnershipAccessControl": false,
			"allowOthersToQuery": true,
			"allowOthersToUpdate": true,
			"allowOthersToDelete": false,
			"allowAnonymousToUpdate": true,
			"allowAnonymousToDelete": true
			},
		"hasAttachments": false,
		"capabilities": "Create,Delete,Query,Update,Editing",
      ....
   },
   "records": null,
  }

For a complete description of publishParameters, see Publish Item.

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