ArcGIS Explorer Component Help |
DataDirectory..::.OpenRaster Method |
DataDirectory Class Example See Also |
Returns a Raster object which represents a raster file stored 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 Raster OpenRaster( string name ) |
Visual Basic (Declaration) |
---|
Public Function OpenRaster ( _ name As String _ ) As Raster |
Parameters
- name
- Type: System..::.String
The name of the raster to open, including the file extension.
Return Value
A Raster object which represents a file-based raster consisting of a rectangular grid of cells arranged into rows and columns.Examples
The code below creates a DataDirectory object which is then used to open a number of data types
including raster data in the third example.
CopyC#
//Create a DataDirectory object for the specified file path DataDirectory dir = new DataDirectory(@"C:\Data"); //Print the path to the data System.Diagnostics.Debug.Print(dir.Path); //Prints "C:\Data" //Example 1 - open the mountains shapefile then print the name and whether it can store vector data. Table mtnsTable = dir.OpenTable("mountains"); System.Diagnostics.Debug.Print(mtnsTable.Name); //Prints "mountains" System.Diagnostics.Debug.Print(mtnsTable.IsSpatial.ToString()); //Prints "True" //Example 2 - open the mtn_ratings dBase file then print out the name and whether it can store vector data. Table ratingsTable = dir.OpenTable("mtn_ratings"); System.Diagnostics.Debug.Print(ratingsTable.Name); //Prints "mtn_ratings" System.Diagnostics.Debug.Print(ratingsTable.IsSpatial.ToString()); //Prints "False" //Example 3 - open the southgorms.jpg raster file and print the name Raster gormsRaster = dir.OpenRaster("northgorms.jpg"); System.Diagnostics.Debug.Print(gormsRaster.Name); //Prints "northgorms.jpg""
CopyVB.NET
'Create a DataDirectory object for the specified file path Dim dir As DataDirectory = New DataDirectory("C:\Data") 'Print the path to the data System.Diagnostics.Debug.Print(dir.Path) 'Prints "C:\Data" 'Example 1 - open the mountains shapefile then print the name and whether it can store vector data. Dim mtnsTable As Table = dir.OpenTable("mountains") System.Diagnostics.Debug.Print(mtnsTable.Name) 'Prints "mountains" System.Diagnostics.Debug.Print(mtnsTable.IsSpatial.ToString()) 'Prints "True" 'Example 2 - open the mtn_ratings dBase file then print out the name and whether it can store vector data. Dim ratingsTable As Table = dir.OpenTable("mtn_ratings") System.Diagnostics.Debug.Print(ratingsTable.Name) 'Prints "mtn_ratings" System.Diagnostics.Debug.Print(ratingsTable.IsSpatial.ToString()) 'Prints "False" 'Example 3 - open the southgorms.jpg raster file and print the name Dim gormsRaster As Raster = dir.OpenRaster("northgorms.jpg") System.Diagnostics.Debug.Print(gormsRaster.Name) 'Prints "northgorms.jpg"