- URL:https://[root]/content/features/analyze
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 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.
Nota:
The Analyze call will fail if your portal does not have a hosting server registered with it.
Request parameters
Parameter | Details |
---|---|
f | The output format is JSON. |
itemid | 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
Nota:Shapefile format is limited to a maximum of 4,000 records. The maximum upload size is 2MB for a shapefile and 10MB for all other supported file types. |
analyzeParameters | A JSON object that provides geocoding information. Example: analyzeParameters:{"sourceLocale":"en"} |
Analyze Parameters JSON object
The analyzeParameters JSON objects used to analyze a CSV or Excel file are described below.
Parameter | Details |
---|---|
sourcelocale | The locale used for the geocoding service source. |
geocodeServiceUrl | The URL of the geocoding service that supports batch geocoding. Nota:Portal for ArcGIS 10.3 supports configuring multiple geocoding services. If the client application requires a specific locator, the URL of this service should be specified in this parameter. |
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:
{
"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 publishParameters, see Publish Item.