ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Scratch GDB

  • Usage notes
  • Dialog syntax
  • Scripting syntax

The scratch GDB is the location of a file geodatabase you can use to write temporary data.

The scratch GDB environment complements the Scratch Workspace environment. Its primary purpose is for use by scripts and models as geoprocessing services, with the added focus of only pointing to a known geodatabase. When ArcGIS for Server executes a geoprocessing task, the scratch GDB is always available to write output to. This environment is also useful in authoring scripts and models for use on the desktop. Writing output to the scratch GDB will make your tool portable because this location will always be available or created at execution time. Learn more about the Scratch Workspace environment

Usage notes

  • The scratch GDB is guaranteed to exist when your script or model runs, and you will have write access to this geodatabase.
  • The scratch GDB environment is read-only; you cannot set the location directly. The location is derived; the following points explain how.
    • If you have set the scratch workspace, or the map document has a scratch workspace set, the scratch GDB will reflect this value first.
      • If your scratch workspace references a geodatabase, the scratch GDB environment and scratch workspace will point to the same paths.
      • If your scratch workspace points to a folder, the scratch GDB environment will look for a geodatabase inside the folder named scratch.
    • If the scratch workspace has not been set, the scratch GDB defaults to the current user's Documents directory. On Windows 7 and 8, this directory is C:\Users\<user>\Documents\ArcGIS. Inside this directory, scratch.gdb will be created.
  • Data written to the scratch GDB is not automatically deleted. You need to do your own cleanup.
  • The Scratch GDB can be used inside your Python scripts. Make sure to set your Scratch Workspace variable prior to using it; this way, you know where the output will be generated.

Dialog syntax

Note:

The scratch GDB environment is only available in Python and models.

Scripting syntax

arcpy.env.scratchGDB

Script example

import arcpy
arcpy.env.scratchWorkspace = "c:/LandUse/ForestCover"

# c:\LandUse\ForestCover\scratch.gdb
print(arcpy.env.scratchGDB)

Related Topics

  • Scratch Folder
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal