Adds a layer to the Map control. When you add a layer to a Map you're adding it to the top of the Map layers collection; consequently its index is 0.


Namespace: AspMap.Web
Assembly: AspMapNET (in AspMapNET.dll)

Syntax

Visual Basic (Declaration)
Public Function AddLayer( _ 
   ByVal layerSource As Object _ 
) As Layer
C#
public Layer AddLayer(
   object layerSource
)
C++
public:
 Layer AddLayer(
   Object layerSource
) sealed 
J#
public Layer AddLayer(
   object layerSource
)
JScript
public  function AddLayer(
   layerSource : Object
) : Layer

Parameters

layerSource
An object expression representing the full file name of the map file or can be one of DynamicPoints, DynamicLayer, WmsLayer, TileLayer or SpatialDatabaseLayer object.

Return Value

The method returns a Layer object.

Exceptions

Exception TypeCondition
ExceptionThrown if an error occurs.

Example

 Copy Code
void Page_Load(object sender, EventArgs e)
{
        map.AddLayer(MapPath("/maps/countries.shp"));
}

See Also