Dynamically change a layer's rendering using the ActiveX Connector

Last Published: April 25, 2020


The ActiveX Connector allows a layer's rendering to override the map configuration file (*.axl) rendering.Instructions provided explain how to re-render a layer using the ActiveX Connector.


Follow the steps below. Code samples are given for an ASP page using Visual Basic Script.

  1. Set the connection information using the ActiveX Connector's aims.ArcIMSConnector object.
    dim oConn
    set oConn = Server.CreateObject("aims.ArcIMSConnector")
    oConn.ServerName = "localhost"
    oConn.ServerPort = 5300

  2. Create the Map object and call its InitMap function.
    dim oMap
    set oMap = Server.CreateObject("aims.Map")
    oMap.InitMap oConn, "MyService"

  3. Specify the map output parameters, such as the height and width of the map.

  4. Instantiate the renderer object appropriate for the layer and set its properties.

    With the SimpleRenderer, SimpleLabelRenderer, ValueMapRenderer, and ValueMapLabelRenderer, instantiate a symbol object and specify its properties.

    With the GroupRenderer, instantiate other renderers. Set their properties and use the GroupRenderers Add method.

    With the ScaleDependentRenderer, create another renderer and set its properties.

    Set the ScaleDependentRenderer's renderer property to the other renderer. Specify the scale.
    dim oGroupRenderer, oLabelRenderer, oSimpleRenderer
    set oGroupRenderer = Server.CreateObject("aims.GroupRenderer")
    set oLabelRenderer = Server.CreateObject("aims.SimpleLabelRenderer")
    set oSimpleRenderer = Server.CreateObject("aims.SimpleRenderer")

    ' Create Label Symbol

    dim oTextSymbol
    set oTextSymbol = Server.CreateObject("aims.TextSymbol")

    ' Set the properties for the label renderer
    oLabelRenderer.Symbol = oTextSymbol
    oLabelRenderer.Field = "NAME"

    ' Create symbol for point layer, set properties
    dim oPtSymbol
    set oPtSymbol = Server.CreateObject("aims.SimpleMarkerSymbol")
    oPtSymbol.Color = RGB(255,0,0) ' red
    oPtSymbol.MarkerType = 1 ' triangle
    oPtSymbol.Width = 10

    ' Set properties for simple renderer
    oSimpleRenderer.Symbol = oPtSymbol

    ' Add the two new renderers to the group renderer
    oGroupRenderer.Add oLabelRenderer
    oGroupRenderer.Add oSimpleRenderer

  5. Find the layer being rendered in the map's layers collection. It should be a FeatureLayer. Set its renderer property to the newly created renderer.
    dim oLayer, i
    for i = 1 to oMap.Layers.Count
    if oMap.Layers.Item(i).Id = "Cities" then
    set oLayer = oMap.Layers.Item(i)
    end if

    oLayer.Renderer = oGroupRenderer

  6. Perform other required operations such as zooming, panning, and so on.
    oMap.DoZoomToFeatures oLayer, "NAME", "'Los Angeles','New York'"

  7. Refresh the Map object and use the URL to display the new map.
    response.write "<img url='" & oMap.GetImageURL() & "'>"

Article ID:000002363

  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic