ListRasters

摘要

ListRasters 函数用于返回当前工作空间中的栅格列表。

说明

必须先设置工作空间环境,然后才能使用多个列表函数,包括 ListDatasetsListFeatureClassesListFilesListRastersListTablesListWorkspaces

语法

ListRasters ({wild_card}, {raster_type})
参数说明数据类型
wild_card

限制返回的结果。如果未指定某一值,则返回所有值。通配符不区分大小写。

符号说明示例

*

表示零个或多个字符。

Te* 可找到田纳西州和德克萨斯州。

String
raster_type

Specifies the raster type that will be used to limit the results. The following are valid raster types:

  • BMPBitmap graphic raster dataset format will be used.
  • GIFGraphic Interchange Format for raster datasets will be used.
  • IMG ERDAS IMAGINE raster data format will be used.
  • JP2JPEG 2000 raster dataset format will be used.
  • JPGJoint Photographics Experts Group raster dataset format will be used.
  • PNG Portable Network Graphics raster dataset format will be used.
  • TIFTagged Image File for raster datasets will be used.
  • GRID Grid data format will be used.
  • AllAll supported raster types will be used. This is the default.

(默认值为 All)

String
返回值
数据类型说明
String

该函数返回的列表包含工作空间中的栅格名称,可以选择使用 wild_cardraster_type 参数进行限制。

代码示例

ListRasters 示例

列出工作空间中的 Grid 栅格名称。

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)

相关主题