In the notebook editor, you can work with content in a workspace in your ArcGIS Online organization to add files to your notebook or download them to your machine. Click the Files button to open the Files pane.
Browse content in the workspace
The Files pane provides a browser for the files in your workspace. The default folders are home and samplesdata (the latter for the data used in the sample notebooks).
Upload content to the workspace
To work with content and resources from your machine, you must first upload your file to your notebook's workspace. Once your files are uploaded, you can reference their file path in your open notebook and any other notebooks you own with filepath = /arcgis/home/folder/filename.
To upload files, complete the following steps:
- In the Files pane, browse to the /arcgis/home folder.
Note:/arcgis/home is the workspace directory and is different from the root directory home/arcgis.
- Optionally, click New folder to create a folder in the /arcgis/home workspace where you will upload your content.
- Click Choose file and browse to the file.
- Select the file.
- Click Upload.
The file is uploaded to the workspace.
Files that are uploaded to the notebook workspace are not stored as items in your organization and are not deleted when the notebook is deleted. To delete files, select the file in the Files pane and click Delete. If you are removed from your organization, all content in your notebook workspace is permanently deleted.
Download content from the workspace
To save a file from the workspace to your local machine, in the Files pane, browse to the file and select it. The file is automatically downloaded to your machine.
Set up a scratch workspace environment for use with ArcPy
The scratch workspace is intended for output data you do not intend to maintain.
To create and use a scratch workspace environment, follow these steps:
- Use the code below to create a scratch file geodatabase in the user workspace directory, if it does not already exist, and set the scratch geodatabase as the scratch workspace.
import arcpy if not arcpy.Exists('/arcgis/home/scratch.gdb'): arcpy.management.CreateFileGDB('/arcgis/home','scratch.gdb') arcpy.env.scratchWorkspace = '/arcgis/home/scratch.gdb'
- Use the code below to verify that the geodatabase is set as the scratch geodatabase environment.
Create a folder to use as a scratch workspace
Follow these steps to create a folder to use as a scratch workspace:
- Use the code below to create a folder in the user workspace, if one does not already exist, and set that folder as the user workspace.
import arcpy if not arcpy.Exists('/arcgis/home/scratch'): arcpy.management.CreateFolder('/arcgis/home', 'scratch') arcpy.env.scratchWorkspace = '/arcgis/home/scratch'
- Use the code below to verify that the folder is set as the scratch folder environment.