Represents a directory on disk and specifically one which stores shapefiles, dBase files or any supported raster files.

Namespace:  ESRI.ArcGISExplorer.Data

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

Syntax

C#
public sealed class DataDirectory
Visual Basic (Declaration)
Public NotInheritable Class DataDirectory

Remarks

It is common to organize file-based data into directories and this class represents a single directory for a given Path. Creating a new instance of this class allows you to explore the contents of the specified directory or open data stored within it.

You can find shapefiles or dBase tables in a folder using the GetTables method or all the supported raster files using the GetRasters method.

The following data types can be opened using the appropriate method: shapefiles/dBase tables (OpenTable), and rasters (OpenRaster).

Examples

The code below creates a DataDirectory object which is used to open a shapefile and a raster (jpg) file. A FeatureLayer and Raster layer are created, connected to the underlying data then added to the Map.
CopyC#
//Connect to a directory containing shapefiles and raster format files.
DataDirectory dir = new DataDirectory(@"C:\Data");

//Open a shapefile
Table mountainsTable = dir.OpenTable("mountains");
//Create a FeatureLayer and connect it to the shapefile
FeatureLayer featureLyr = FeatureLayer.OpenFromTable(mountainsTable);

//Open a raster file
Raster cairngormsRaster = dir.OpenRaster("NORTHGORMS.jpg");
//Create a RasterLayer and connect it to the raster file
RasterLayer rasterLyr = RasterLayer.OpenFromRaster(cairngormsRaster);

//add the layers to the map
Map theMap = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map;
theMap.ChildItems.Add(featureLyr);
theMap.ChildItems.Add(rasterLyr);
CopyVB.NET
'Connect to a file geodatabase
Dim dir As DataDirectory = New DataDirectory("C:\Data")

'Open a shapefile
Dim mountainsTable As Table = dir.OpenTable("mountains")
'Create a FeatureLayer and connect it to the shapefile
Dim featureLyr As FeatureLayer = FeatureLayer.OpenFromTable(mountainsTable)

'Open a raster file
Dim cairngormsRaster As Raster = dir.OpenRaster("NORTHGORMS.jpg")
'Create a RasterLayer and connect it to the raster file
Dim rasterLyr As RasterLayer = RasterLayer.OpenFromRaster(cairngormsRaster)

'add the layers to the map
Dim theMap As Map = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map
theMap.ChildItems.Add(featureLyr)
theMap.ChildItems.Add(rasterLyr)

Inheritance Hierarchy

System..::.Object

  ESRI.ArcGISExplorer.Data..::.DataDirectory

See Also