Skip To Content
ArcGIS Developer
Dashboard

/generate: Generate

  • URL:https://[root]/content/features/generate

Example usage

URL for Generate

https://www.arcgis.com/sharing/rest/content/features/generate
item id=345313e619df46f387f9ededbe15ac56
type=csv
publishParameters=<publish parameters>

For a complete description of publishParameters, see Publish.

Description

The Generate call helps a client generate features from a CSV file, Shapefile, GPX, or GeoJSON file.

CSV files that contain location fields (either address fields or x,y fields) are spatially enabled by the Generate operation.

The result of Generate is a JSON feature collection.

If the file to be analyzed already 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.

Generate requires that the caller pass in publish parameters that describe the layers in the feature collection to be generated.

Callers can use the Analyze operation to generate the default publishing parameters for the source input.

Note:

The Generate call will fail if your portal does not have a hosting server registered with it.

Request parameters

ParameterDetails
[Common Parameters]

For a complete listing, see Common Parameters.

f

The output format is JSON.

itemId

The ID of the source item.

Example: id=345313e619df46f387f9ededbe15ac56

file

The source file.

Example: file=mystreets.zip

text

The source text.

Example: text=<text file data>

filetype

File type.

Values: shapefile | csv | gpx | geojson

Example: filetype=shapefile

Note:

Shapefile and GeoJSON 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.

publishParameters

A JSON object describing the layer and service to be created as part of the Publish operation​. The appropriate value for publish parameters depends on the file type being published. For a complete description, see Publish.

Example: publishParameters={"name":"Streets"}

JSON Response example


            {
   "featureCollection":{
      "layers":[
         {
            "layerDefinition":{
               "currentVersion":10.1,
               "id":0,
               "name":"",
               "type":"Feature Layer",
               "displayField":"",
               "description":"",
               "copyrightText":"",
               "defaultVisibility":true,
               "editFieldsInfo":{
                  "creationDateField":"",
                  "creatorField":"",
                  "editDateField":"",
                  "editorField":""
               },
               "relationships":[

               ],
               "isDataVersioned":false,
               "supportsRollbackOnFailureParameter":true,
               "supportsAdvancedQueries":true,
               "geometryType":"esriGeometryPoint",
               "minScale":0,
               "maxScale":0,
               "extent":{
                  "xmin":-13138866.901578393,
                  "ymin":4036479.8868969772,
                  "xmax":-13046159.729973687,
                  "ymax":4044266.7022668216,
                  "spatialReference":{
                     "wkid":102100,
                     "latestWkid":3857
                  }
               },
               "drawingInfo":{
                  "renderer":{
                     "type":"simple",
                     "symbol":{
                        "type":"esriPMS",
                        "url":"RedSphere.png",
                        "imageData":"iVBORw...K5CYII=",
                        "contentType":"image/png",
                        "color":null,
                        "width":15,
                        "height":15,
                        "angle":0,
                        "xoffset":0,
                        "yoffset":0
                     },
                     "label":"",
                     "description":""
                  },
                  "labelingInfo":null
               },
               "allowGeometryUpdates":true,
               "hasAttachments":false,
               "htmlPopupType":"esriServerHTMLPopupTypeNone",
               "hasM":false,
               "hasZ":false,
               "objectIdField":"FID",
               "globalIdField":"",
               "typeIdField":"",
               "fields":[
                  {
                     "name":"Address",
                     "type":"esriFieldTypeString",
                     "alias":"Address",
                     "sqlType":"sqlTypeNVarchar",
                     "length":256,
                     "nullable":true,
                     "editable":true,
                     "domain":null,
                     "defaultValue":null
                  },
                  {
                     "name":"City",
                     "type":"esriFieldTypeString",
                     "alias":"City",
                     "sqlType":"sqlTypeNVarchar",
                     "length":256,
                     "nullable":true,
                     "editable":true,
                     "domain":null,
                     "defaultValue":null
                  },
                  {
                     "name":"State",
                     "type":"esriFieldTypeString",
                     "alias":"State",
                     "sqlType":"sqlTypeNVarchar",
                     "length":256,
                     "nullable":true,
                     "editable":true,
                     "domain":null,
                     "defaultValue":null
                  },
                  {
                     "name":"Zip",
                     "type":"esriFieldTypeString",
                     "alias":"Zip",
                     "sqlType":"sqlTypeNVarchar",
                     "length":16,
                     "nullable":true,
                     "editable":true,
                     "domain":null,
                     "defaultValue":null
                  },
                  {
                     "name":"Value",
                     "type":"esriFieldTypeInteger",
                     "alias":"Value",
                     "sqlType":"sqlTypeInteger",
                     "nullable":true,
                     "editable":true,
                     "domain":null,
                     "defaultValue":null
                  },
                  {
                     "name":"FID",
                     "type":"esriFieldTypeInteger",
                     "alias":"FID",
                     "sqlType":"sqlTypeInteger",
                     "nullable":false,
                     "editable":false,
                     "domain":null,
                     "defaultValue":null
                  }
               ],
               "indexes":[

               ],
               "types":[

               ],
               "templates":[

               ],
               "supportedQueryFormats":"JSON",
               "hasStaticData":false,
               "maxRecordCount":-1,
               "capabilities":"Create,Delete,Query,Update,Editing"
            },
            "featureSet":{
               "features":[
                  {
                     "attributes":{
                        "Address":"56 E Arthur Ave",
                        "City":"Arcadia",
                        "State":"CA",
                        "Zip":"91006",
                        "Value":1000,
                        "FID":1
                     },
                     "geometry":{
                        "x":-13138866.901578393,
                        "y":4044266.7022668216,
                        "spatialReference":{
                           "wkid":102100,
                           "latestWkid":3857
                        }
                     }
                  },
                  {
                     "attributes":{
                        "Address":"380 New York Street",
                        "City":"Redlands",
                        "State":"CA",
                        "Zip":"92373",
                        "Value":2000,
                        "FID":2
                     },
                     "geometry":{
                        "x":-13046159.729973687,
                        "y":4036479.8868969772,
                        "spatialReference":{
                           "wkid":102100,
                           "latestWkid":3857
                        }
                     }
                  }
               ],
               "geometryType":"esriGeometryPoint"
            }
         }
      ]
   },
   "geocodeResults":{
      "accepted":2,
      "rejected":0
   }
}