Returns a Raster object which represents a raster dataset stored in a directory.

Namespace:  ESRI.ArcGISExplorer.Data

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public static Raster OpenRasterFile(
	string pathToRaster
)
Visual Basic (Declaration)
Public Shared Function OpenRasterFile ( _
	pathToRaster As String _
) As Raster

Parameters

pathToRaster
Type: System..::.String

The path to the file, including file extension (e.g. ".jpg", ".tif").

Return Value

A Raster object which represents any supported, file-based, raster format.

Remarks

This is a convenience method which is useful for opening a small number of rasters. Consider using the DataDirectory.OpenRaster method instead when opening many rasters.

Examples

The code below opens a file-based raster using the OpenRasterFile method then prints out its dimensions.
CopyC#
{
  //Open a file-based (Mr. Sid) raster
  Raster demRaster = Raster.OpenRasterFile(@"\\leven\Data\Yellowstone\dem.sid");

  //Print out the dimensions of the Raster
  System.Drawing.Size cellSize = demRaster.CellSize;
  System.Diagnostics.Debug.Print(string.Format("Cell Size: {0}x{1}",cellSize.Height.ToString(), cellSize.Width.ToString()));
  System.Diagnostics.Debug.Print("Rows:" + demRaster.RowCount.ToString());
  System.Diagnostics.Debug.Print("Columns:" + demRaster.ColumnCount.ToString());
}
CopyVB.NET
'Open a file-based (Mr. Sid) raster
Dim demRaster As Raster = Raster.OpenRasterFile("\\leven\Data\Yellowstone\dem.sid")

'Print out the dimensions of the Raster
Dim cellSize As System.Drawing.Size = demRaster.CellSize
System.Diagnostics.Debug.Print(String.Format("Cell Size: {0}x{1}", cellSize.Height.ToString(), cellSize.Width.ToString()))
System.Diagnostics.Debug.Print("Rows:" + demRaster.RowCount.ToString())
System.Diagnostics.Debug.Print("Columns:" + demRaster.ColumnCount.ToString())

See Also