- URL:
- https://[root]/content/features/analyze
- Methods:
GET
Example usage
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 publish
within the JSON response contains information that can be passed back to the server in a subsequent call to Publish
or Generate
. The publish
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
Parameter | Details |
---|---|
| The ID of the item to be analyzed. Example:
|
| The file to be analyzed. Example:
|
| The text in the file to be analyzed. Example:
|
| The type of input file. Values: Example:
|
| A JSON object that provides geocoding information. Example:
|
Analyze Parameters JSON object
The analyze
JSON object s used to analyze a CSV or Excel file are described below.
Parameter | Details |
---|---|
| The locale used for the geocoding service source. |
| The URL of the geocoding service that supports batch geocoding. |
| Indicates the type of spatial information stored in the dataset. Values for CSV: Values for Excel: |
| The two-character country code associated with the geocoding service. The default is "world". |
| If the first time analyzing, the hint is used. If the source country is already specified, |
A sample analyze
JSON object for a CSV or Excel file is as follows:
{
"enableGlobalGeocoding": true,
"sourceLocale":"en",
"geocodeServiceUrl": "https://<server>/sharing/rest/services/World/GeocodeServer",
"locationType": "address",
"sourceCountry":"",
"sourceCountryHint":"world"
}
Example usage for CSV
https://www.arcgis.com/sharing/rest/content/features/analyze
itemid=345313e619df46f387f9ededbe15ac56
filetype=csv
JSON Response example
{
"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
https://www.arcgis.com/sharing/rest/content/features/analyze
itemid=a48f99193139447ba64b721450fb00bd
filetype=excel
JSON Response example
{
"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 publish
, see Publish Item.