Skip to content

Instantly share code, notes, and snippets.

@danmaps
Last active April 4, 2016 14:46
Show Gist options
  • Save danmaps/e9a13330a59d3e45d4df7d49d49be131 to your computer and use it in GitHub Desktop.
Save danmaps/e9a13330a59d3e45d4df7d49d49be131 to your computer and use it in GitHub Desktop.
Python temp
license: gpl-3.0

Alternative to Scratch Folder to help with memory usage.

import arcpy
import os
import shutil
import tempfile

GDB_NAME = 'test.gdb'

#Create a file geodatabase.
workspace = tempfile.mkdtemp()
gdb_path = os.path.join(workspace, GDB_NAME)
arcpy.CreateFileGDB_management(workspace, GDB_NAME)

#Create a feature class, and add fields.
#Populate the feature class with features.
#Perform the test queries, and report the number of results.

#Clean up.
shutil.rmtree(workspace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment