ArcGIS Explorer Component Help |
Table..::.OpenShapefile Method |
Table Class Example See Also |
Returns a Table object which represents a dBase file or a shapefile 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 static Table OpenShapefile( string pathToShapefile ) |
Visual Basic (Declaration) |
---|
Public Shared Function OpenShapefile ( _ pathToShapefile As String _ ) As Table |
Parameters
- pathToShapefile
- Type: System..::.String
The path to the file, including file extension (".shp" or ".dbf").
Return Value
A Table object which represents either a dBase table (non-spatial) or a shapefile (spatial, vector format).Remarks
This is a convenience method which is useful for opening a small number of tables. Consider using
the DataDirectory.OpenTable method instead when opening many tables.
Examples
The code below opens a shapefile and a dBase file using the OpenShapefile method, then print out the Name property for each Table.
CopyC#
//Open the mountains shapefile. Table mtnsSHP = Table.OpenShapefile(@"C:\Data\mountains.shp"); System.Diagnostics.Debug.Print(mtnsSHP.Name); //Prints "mountains" //Open the mtn_ratings dBase table. Table mtnratingsDBF = Table.OpenShapefile(@"C:\Data\mtn_ratings.dbf"); System.Diagnostics.Debug.Print(mtnratingsDBF.Name); //Prints "mtn_ratings"
CopyVB.NET
'Open the mountains shapefile. Dim mtnsSHP As Table = Table.OpenShapefile("C:\Data\mountains.shp") System.Diagnostics.Debug.Print(mtnsSHP.Name) 'Prints "mountains" 'Open the mtn_ratings dBase table. Dim mtnratingsDBF As Table = Table.OpenShapefile("C:\Data\mtn_ratings.dbf") System.Diagnostics.Debug.Print(mtnratingsDBF.Name) 'Prints "mtn_ratings"