IMapServerDataAccess Interface

Provides access to the data source behind the MapServer.

Members

Name Description
Method GetDataSource Get Data Source
Method GetDisplayDataSource Get Display Data Source

IMapServerDataAccess.GetDataSource Method

Get Data Source

Public Function GetDataSource ( _
    ByVal MapName As String, _
    ByVal LayerID As Integer _
) As Object
public object GetDataSource (
    string MapName,
    int LayerID
);

Remarks

This function allows fine-grained object access to a FeatureLayer, a RasterLayer or a StandaloneTable by returning IFeatureClass, IRaster or ITable respectively. If the layer or standalone table has any joins, the returned object will not contain the joined portion. In addition any field visibility or field alias set to the layer in the source map document will be ignored as it returns the underlying data source.

// Retrieve feature class workspace from a mapserver layer

private void AccessWrokspaceFromMapServiceLayer(IServerObject serverObject)

{

  IMapServer mapService = (MapServer)serverObject;

  IMapServerDataAccess mapServerDataAccess = (IMapServerDataAccess)serverObject;



  // Get feature class from any layer

  IFeatureClass featureClass = (IFeatureClass)mapServerDataAccess.GetDataSource(mapService.DefaultMapName, 0);



  // Get the container feature dataset

  IFeatureDataset featureDataset = featureClass.FeatureDataset; 

  // Get worksapces

  IWorkspace workspace = featureDataset.Workspace;

  IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;

}

IMapServerDataAccess.GetDisplayDataSource Method

Get Display Data Source

Public Function GetDisplayDataSource ( _
    ByVal MapName As String, _
    ByVal LayerOrTableID As Integer _
) As Object
public object GetDisplayDataSource (
    string MapName,
    int LayerOrTableID
);

Remarks

This function allows fine-grained object access to a FeatureLayer, a RasterLayer or a StandaloneTable by returning IFeatureClass, IRaster or ITable respectively, or IRelQueryTable when it is joined. In addition any field visibility or field alias set to the layer in the source map document will be ignored as it returns the underlying data source.

The main difference between GetDisplayDataSource and GetDataSouce functions is that the former one honors joins and returns IRelQueryTable when join exists. This IRelQueryTable interface gives you access to the source or destination table, or the relationship class. When the layer or standalone table is not participating in any join, the behavior of GetDisplayDataSource and GetDataSouce functions are identical.

Classes that implement IMapServerDataAccess

Classes Description
MapServer The MapServer component provides programmatic access to the contents of a map document on disk, and creates images of the map contents based on user requests. Designed for use in building map-based web services and web applications.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.