How to add different types of layers to a map

Adding different types of layers to a map

In ArcGIS, layer types often correspond to different geodatabase dataset types. When creating layers from database objects, it is important to create the correct layer type to ensure proper behavior. This document demonstrates how to create a layer and hook it up to the geodatabase dataset using the LayerFactoryHelper class. This class leverages LayerFactory objects registered in the Layer Factory component category to create the proper layer type for the geodatabase Name object. The output layers are then added to the map.
static void createLayerFromGeodatabaseName(IMap map, IName name)throws Exception{
    ILayerFactoryHelper helper = new LayerFactoryHelper();
    IEnumLayer enumLayer;
    //Layer Factory Helper creates the correct type of layer from the Name object
    //and returns the layer in an enumeration.
    enumLayer = helper.createLayersFromName(name);
    ILayer layer;
    layer =;

    // Loop through the enum and add each layer.
    while (layer != null){
        layer =;

Development licensingDeployment licensing
ArcGIS for Desktop BasicArcGIS for Desktop Basic
ArcGIS for Desktop StandardArcGIS for Desktop Standard
ArcGIS for Desktop AdvancedArcGIS for Desktop Advanced
Engine Developer KitEngine