CreateScratchName
Краткая информация
Создает уникальное имя пути scratch (временной рабочей области) для указанного типа данных. Если рабочая область не указана, используется текущая рабочая область.
Синтаксис
CreateScratchName({prefix}, {suffix}, {data_type}, {workspace})
| Параметр | Объяснение | Тип данных |
|---|---|---|
|
prefix |
The prefix that is added to the scratchname. By default, a prefix of xx is used. (Значение по умолчанию — xx) |
String |
|
suffix |
The suffix added to the scratchname. This can be an empty double-quoted string. |
String |
|
data_type |
The data type which will be used to create the scratchname. Valid datatypes are:
|
String |
|
workspace |
The workspace used to determine the scratch name to be created. If not specified, the current workspace is used. |
String |
Возвращаемое значение
| Тип данных | Объяснение |
|---|---|
|
String |
Уникальное имя пути scratch. |
Пример кода
Создайте уникальное имя scratch для полученных выходных данных инструмента Буфер. Это имя scratch затем используется в качестве входных данных для инструмента Вырезание.
import arcpy
# Set workspace
arcpy.env.workspace = "C:/Data/Municipal.gdb"
# Create a scratch name for the Buffer tool output.
# The scratch name created will be include 'temp0.shp',
# If temp0.shp already exists, the number will be incremented
# until the name is unique in the workspace.
scratch_name = arcpy.CreateScratchName("temp",
data_type="Shapefile",
workspace=arcpy.env.scratchFolder)
# Run Buffer tool, using scratch name for output
arcpy.analysis.Buffer("Roads", scratch_name, "1000 feet")
# Run Clip tool, using scratch name for input
arcpy.analysis.Clip(scratch_name, "CityBoundary", "CityRoads")
# Delete scratch dataset
arcpy.management.Delete(scratch_name)