English

How To: Download a large hosted feature service with attachments from a REST endpoint

Summary

In some cases, downloading a hosted feature service with attachments by exporting to file geodatabase fails because the file size is too big. However, when downloading from the REST endpoint, the file is merely too big to be downloaded at once. In this case, it is possible to split the features and download the features by batch. For example, if the file contains 10,000 features, split the file by creating a replica with the first 5000 Object ID as the first batch, and the next 5000 Object ID as the second batch.

The instructions provided describe how to download a large hosted feature service with attachments from a REST endpoint.

Procedure

  1. Navigate to the ArcGIS REST Services Directory page of the hosted feature service, scroll to the bottom of the page, and click Create replica.
    Operation Create Replica
  2. Set the following options for the replica:
    1. Under LayerQueries:
    {"0":{"where":"OBJECTID<=5000"}}
    Note:
    This creates a replica with the first 5000 Object IDs from LayerID 0. The value of OBJECTID may vary depending on the user's data.
  1. Return Attachments: True
  2. Create Replica Asynchronously: True
  3. Sync Model: None
  4. Attachments Sync Direction: bidirectional
  5. Data Format: FILEGDB.
Create Replica
  1. Keep the rest of the settings to default and, click Create Replica. A 'statusURL' displays at the bottom of the screen. Click the URL.
User-added image
  1. Click the Result URL to download the zip file.
User-added image
Note:
Repeat the process for all the subsequent records, only the OBJECTID keeps changing. For example, the following query creates a replica with the Object ID from 5001 to 10,000.

{"0":{"where":"OBJECTID>5000 AND OBJECTID<=10000"}}

ObjectID fields are sequential and start with the number 1 for geodatabase data. If there is any discrepancy in the hosted feature service data, the number of features downloaded may be less than the number of Object IDs set in the query. For example, if there is no feature with the Object ID 1000 in the feature service, the total feature downloaded is 4999 instead of 5000.
For more information on how to create a replica in ArcGIS REST API, refer to the following ArcGIS Web Help page: Create replica.

Related Information