English

How To: Dynamically change rendering using aims.ValueMapRender

Summary

Instructions provided describe how to dynamically change the rendering of a layer using ArcIMS ActiveX connector API.

Procedure

This is a very basic sample to implement aims.ValueMapRender against an ArcSDE layer to use one of the fields to render the feature dynamically.

  1. Create a MapService using this AXL that uses the SanFrancisco sample data.

    Code:

    <?xml version="1.0" encoding="UTF-8"?>

    <ARCXML version="1.1">
    <CONFIG>
    <ENVIRONMENT>
    <LOCALE country="US" language="en" variant="" />
    <UIFONT color="0,0,0" name="SansSerif" size="12" style="regular" />
    <SCREEN dpi="96" />
    </ENVIRONMENT>
    <MAP>
    <PROPERTIES>
    <ENVELOPE minx="-122.51504799996037" miny="37.69922974000138" maxx="-122.36432173346783" maxy="37.8223821849985" name="Initial_Extent" />
    <MAPUNITS units="decimal_degrees" />
    </PROPERTIES>
    <WORKSPACES>
    <SDEWORKSPACE name="sde_ws-20" server="himalaya" instance="port:5151" database="" user="gisdba" encrypted="true" password="JIDXSPPZEXER" />
    </WORKSPACES>
    <LAYER type="featureclass" name="DATA.GISDBA.BLOCKGROUPS" visible="true" id="0">
    <DATASET name="DATA.GISDBA.BLOCKGROUPS" type="polygon" workspace="sde_ws-20" />
    <SIMPLERENDERER>
    <SIMPLEPOLYGONSYMBOL boundarytransparency="1.0" filltransparency="1.0" fillcolor="192,192,192" boundarycaptype="round" />
    </SIMPLERENDERER>
    </LAYER>
    </MAP>
    </CONFIG>
    </ARCXML>



  2. The following ASP code dynamically renders the blockgroups using the value in the pop1990 field.

    Code:

    <%@ Language=VBScript %>
    <!-- METADATA TYPE="TypeLib"
    FILE="C:\Program Files\ArcGIS\ArcIMS\Connectors\ActiveX\aims_ActiveX.dll"
    -->
    <%
    Option Explicit

    Const SERVER_NAME = "localhost"
    Const SERVICE = "425892"

    Dim Cn,Map
    Set Cn = Server.CreateObject("aims.ArcIMSConnector")
    Set Map = Server.CreateObject("aims.Map")
    Cn.ServerName = SERVER_NAME
    Cn.ServerPort = 5300

    Map.Height = 300
    Map.Width = 400
    Map.InitMap Cn, SERVICE

    'Dynamically change the render for blockgroups.
    Dim mValueMapRenderer
    Dim mResult
    Dim mSimplePolygonSymbol
    Set mValueMapRenderer = Server.CreateObject("aims.ValueMapRenderer")
    Set mSimplePolygonSymbol = Server.CreateObject("aims.SimplePolygonSymbol")

    mValueMapRenderer.LookupField = "POP1990"
    mSimplePolygonSymbol.FillColor = imsColor.imsWhite
    mResult = mValueMapRenderer.Add(mSimplePolygonSymbol, imsRange.imsRange,,0, 948,0,0,0)

    mSimplePolygonSymbol.FillColor = imsColor.imsKhaki
    mResult = mValueMapRenderer.Add(mSimplePolygonSymbol, imsRange.imsRange,, 948, 1895,0,0,0)

    mSimplePolygonSymbol.FillColor = imsColor.imsBlue
    mResult = mValueMapRenderer.Add(mSimplePolygonSymbol, imsRange.imsRange,, 1895, 2843,0,0,0)

    mSimplePolygonSymbol.FillColor = imsColor.imsYellow
    mResult = mValueMapRenderer.Add(mSimplePolygonSymbol, imsRange.imsRange, ,2843, 3790,0,0,0)

    mSimplePolygonSymbol.FillColor = imsColor.imsTeal
    mResult = mValueMapRenderer.Add(mSimplePolygonSymbol, imsRange.imsRange, ,3790, 4738,0,0,0)

    dim lyr
    Set lyr = Map.Layers.item(1).Clone
    lyr.renderer = mValueMapRenderer
    lyr.visible = true

    Map.Layers.Add lyr
    'end Dynamically change the render for blockgroups

    Map.Refresh
    Debug Cn.RequestAXL
    Dim imgUrl
    imgUrl = map.GetImageAsUrl()

    Set Map = Nothing
    Set Cn = Nothing
    %>

    <IMG SRC="<%=imgUrl%>">
    <%
    Sub Debug(str)
    Response.Write (Server.HTMLEncode(str)) & "<hr>"
    End Sub
    Function getLayerIndex(map, layerName)
    Dim i, r, idx
    For i = 1 To map.Layers.Count
    If LCase(map.Layers.Item(i).Name) = LCase(layerName) Then
    getLayerIndex = i
    Exit For
    End If
    Next
    End Function

    %>