ArcGIS Explorer Component Help |
DataDirectory..::.GetRasters Method |
DataDirectory Class Example See Also |
Returns a collection of Raster objects which represents all the supported raster files in a directory.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public ReadOnlyCollection<Raster> GetRasters() |
Visual Basic (Declaration) |
---|
Public Function GetRasters As ReadOnlyCollection(Of Raster) |
Return Value
A ReadOnlyCollection object consisting of Raster objects each of which represents a file-based raster consisting of a rectangular grid of cells arranged into rows and columns.Examples
The code below explores the contents of a directory. Example 3 illustrates how to iterate over a collection of all rasters in the specified directory.
CopyC#
//The "C:\Data" directory contains the following: //mountains shapefile //mtn_ratings dBase file //northgorms.jpg //southgorms.jpg //Create a DataDirectory object for the specified file path DataDirectory dir = new DataDirectory(@"C:\Data"); //Example 1 - print out the names of all dBase files and shapefiles foreach (Table table in dir.GetTables()) { System.Diagnostics.Debug.Print(table.Name); } //Output prints: // mountains // mtn_ratings //Example 2 - print out the names of all shapefiles foreach (Table shapefile in dir.GetTables(TableDiscoveryOptions.Spatial)) { System.Diagnostics.Debug.Print(shapefile.Name); } //Output prints: // mountains //Example 3 - print out the names of all raster files foreach (Raster raster in dir.GetRasters()) { System.Diagnostics.Debug.Print(raster.Name); } //Output prints: // northgorms.jpg // southgorms.jpg
CopyVB.NET
'The "C:\Data" directory contains the following: 'mountains shapefile 'mtn_ratings dBase file 'northgorms.jpg 'southgorms.jpg 'Create a DataDirectory object for the specified file path Dim dir As DataDirectory = New DataDirectory("C:\Data") 'Example 1 - print out the names of all dBase files and shapefiles For Each t As Table In dir.GetTables() System.Diagnostics.Debug.Print(t.Name) Next 'Output prints: ' mountains ' mtn_ratings 'Example 2 - print out the names of all shapefiles For Each shapefile As Table In dir.GetTables(TableDiscoveryOptions.Spatial) System.Diagnostics.Debug.Print(shapefile.Name) Next 'Output prints: ' mountains 'Example 3 - print out the names of all raster files For Each raster As Raster In dir.GetRasters() System.Diagnostics.Debug.Print(raster.Name) Next 'Output prints: ' northgorms.jpg ' southgorms.jpg