ESRI.ArcGIS.ADF.IMS
ShapeWorkspace Class
Members  Example  See Also 
ESRI.ArcGIS.ADF.IMS.Data Namespace : ShapeWorkspace Class




A Workspace object that points to a shapefile data source.

Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class ShapeWorkspace 
   Inherits Workspace
Visual Basic (Usage)Copy Code
Dim instance As ShapeWorkspace
C# 
[SerializableAttribute()]
public class ShapeWorkspace : Workspace 

Example

The following example creates a new ShapeWorkspace, and uses it to create a new dynamic layer to add to an existing MapView.
C#Copy Code
string shapeDirectory = @"D:\Data\"; 

ESRI.ArcGIS.ADF.IMS.Data.ShapeWorkspace newShapeWS; 

newShapeWS = new ESRI.ArcGIS.ADF.IMS.Data.ShapeWorkspace("dynamicShapeWorkspace", shapeDirectory); 

  

ESRI.ArcGIS.ADF.IMS.Data.FeatureDataset citiesDataset; 

citiesDataset = new ESRI.ArcGIS.ADF.IMS.Data.FeatureDataset("Cities", newShapeWS); 

  

ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer newCitiesLayer; 

newCitiesLayer = new ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer("DynamicCitiesLayer", citiesDataset); 

  

mapView.Layers.Add(newCitiesLayer); 

    
Visual BasicCopy Code
Dim shapeDirectory As String = "D:\Data\"

Dim newShapeWS As New _

    ESRI.ArcGIS.ADF.IMS.Data.ShapeWorkspace("dynamicShapeWorkspace", shapeDirectory)



Dim citiesDataset As New _

    ESRI.ArcGIS.ADF.IMS.Data.FeatureDataset("Cities", newShapeWS)



Dim newCitiesLayer As New _

    ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer("DynamicCitiesLayer", citiesDataset)



mapView.Layers.Add(newCitiesLayer)

Remarks

The ShapeWorkspace class enables adding layers dynamically to the map for display or query. Shapefiles are a common file-based data source, containing point, line or polygon data. A shapefile consists of three or more files on disk (.shp, .shx, .dbf, etc.).

A single workspace object can be used to add multiple layers. For example, if you have two shapefiles within a directory, the same ShapeWorkspace can be used to add both layers to the map.

Since dynamic layers are not supported with ArcMap Server image service, this class is not available for use with ArcMap Server.

Inheritance Hierarchy

System.Object
   ESRI.ArcGIS.ADF.IMS.Data.Workspace
      ESRI.ArcGIS.ADF.IMS.Data.ShapeWorkspace

See Also

© 2010 All Rights Reserved.