サマリー
Returns a list of the rasters in the current workspace.
説明
The workspace environment must be set before using several of the list functions, including ListDatasets, ListFeatureClasses, ListFiles, ListRasters, ListTables, and ListWorkspaces.
構文
ListRasters ({wild_card}, {raster_type})
パラメーター | 説明 | データ タイプ | ||||||
wild_card | Limits the results returned. If a value is not specified, all values are returned. The wildcard is not case sensitive.
| String | ||||||
raster_type | The raster type that will limit the results. The following are valid raster types:
(デフォルト値は次のとおりです All) | String |
データ タイプ | 説明 |
String | The list returned from the function containing raster names in the workspace, limited by the optional wild_card and raster_type arguments. |
コードのサンプル
List Grid raster names in the workspace.
import arcpy
# Set the current workspace
arcpy.env.workspace = "c:/data/DEMS"
# Get and print a list of GRIDs from the workspace
rasters = arcpy.ListRasters("*", "GRID")
for raster in rasters:
print(raster)