English

How To: Specify a configuration keyword for an ArcSDE address locator

Summary

When an address locator is copied from a Desktop workspace to an ArcSDE workspace, there is no user interface to specify a configuration keyword.

The instructions provided describe how to add a configuration keyword to the locator using a VBA script.

Procedure

  1. Start ArcCatalog.
  2. Click the Tools > Macros > Visual Basic Editor.
  3. Add the following VBA script to specify a configuration keyword for an ArcSDE address locator. Modify the script parameters to match your situation.
    Code:
    Private Sub CopyLocator()
    ' change MyKeyword to the keyword you would like to use
    CopyLocatorToSDEWorkspace "c:\MyLocators", "MyLocator1", "myconn.sde", "MyKeyword"
    End Sub

    Private Sub CopyLocatorToSDEWorkspace(localWksDir As String, locatorName As String, sdeConnFile As String, configKeyword as String)

    Dim locMgr As ILocatorManager2
    Set locMgr = New LocatorManager

    ' get the full name of the ArcSDE connection file
    Dim fullConnFileName As String
    fullConnFileName = Environ("USERPROFILE") + "\Application Data\ESRI\ArcCatalog\" + sdeConnFile

    ' open ArcSde connection
    Dim sdeLocWks As ILocatorWorkspace
    Set sdeLocWks = locMgr.GetLocatorWorkspaceFromPath(fullConnFileName)

    ' get locator from a local folder
    Dim localLocWks As ILocatorWorkspace
    Set localLocWks = locMgr.GetLocatorWorkspaceFromPath(localWksDir)
    Dim loc As ILocator
    Set loc = localLocWks.GetLocator(locatorName)

    ' copy the locator to ArcSDE workspace
    sdeLocWks.AddLocator locatorName, loc, configKeyword, Nothing

    End Sub

  4. Run the script to specify the keyword for the address locator.