1

I can access a feature service, and initiate a create replica command - but i am not sure how to digest what is returned.

Example code below:

# Setting up the POST request
create_replica_form_data = {'replicaName':'traggatmot_pull',
                     'layers':0,
                     'layerQueries':'',
                     'geometry':'',
                     'geometryType':'esriGeometryEnvelope',
                     'inSR':'',
                     'replicaSR':'',
                     'transportType':'esriTransportTypeEmbedded',
                     'returnAttachments':'false',
                     'returnAttachmentsDataByUrl':'true',
                     'async':'false',
                     'syncModel':'perLayer',
                     'attachmentsSyncDirection':'none',
                     'replicaOptions':'',
                     'dataFormat':'json',
                     'f':'pjson',
                     'token':token}


r = requests.post("http://services3.arcgis.com/XXXXXXXXXXXXXXX/arcgis/rest/services/XXXXXXXXXXXX/FeatureServer/createReplica", data=create_replica_form_data)

with open("layer_pull.json", 'w') as outfile:
    json.dump(r.json(), outfile)

arcpy.JSONToFeatures_conversion("layer_pull.json", os.path.join("layer_pull.gdb", "layer_pull"))

Error:

arcgisscripting.ExecuteError: ERROR 001558: Error parsing json file 'sades_pull_01_12_2016.json'. 
Failed to execute (JSONToFeatures).

This error seems to suggest that the JSON object returned by the CreateReplica request is not in the format that ArcMap is expect. Here is a snapshot of the beginning:

enter image description here

Is this a GDB in JSON format? How do I get this file into a GDB?

  • I just realized I accidentally posted this on the wrong site - should be on gis.stackexchange. – traggatmot Dec 1 '16 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.