Supported with: ArcGIS Desktop
Library dependencies: System, SystemUI, Geometry, Display, Server, Output, GeoDatabase, GISClient, DataSourcesFile, DataSourcesGDB, DataSourcesOleDB, DataSourcesRaster, GeoDatabaseDistributed, Carto, NetworkAnalyst, Schematic, Location, NetworkAnalysis, Controls, GeoAnalyst, 3DAnalyst, GlobeCore, SpatialAnalyst, Framework, GeoDatabaseUI, DisplayUI, OutputUI, Catalog, CatalogUI, CartoUI, DataSourcesRasterUI, ArcCatalogUI, ArcCatalog, ArcMapUI, Editor
The LocationUI library provides user interface objects to support objects contained in the Location library. This library also contains objects that extend other core libraries of the ArcGIS system, such as Catalog, CatalogUI, and CartoUI.
The LocationUI objects can be logically grouped as follows:
The Locator User Interface objects provide user interfaces for using locators in ArcGIS.
A LocatorUI object provides the basic user interface functionality for working with a locator in ArcGIS. It opens the user interfaces for creating a locator, modifying the properties of a locator, and geocoding a table of addresses. An ESRILocatorUI object provides additional user interfaces to expose to users all of the functionality of address locators that use the ESRI geocoding engine. There are two types of ESRILocatorUI objects: AddressLocatorUI objects provide user interfaces for ESRIAddressLocator objects; and CompositeLocatorUI objects provide user interfaces for composite address locators.
The following example illustrates how to use the AddressLocatorUI associated with a locator to open the user interface for geocoding one of the set of tables in an ArcMap document:
Dim pUID As New esriSystem.UID
Dim pApplication As esriFramework.IApplication
Dim pLocatorExtension As esriLocationUI.ILocatorExtension
Dim pLocator As esriGeoDatabase.ILocator
Dim pAddressUI As esriLocationUI.IAddressUI
Dim pMxDocument As esriArcMapUI.IMxDocument
Dim pTableCollection As esriCarto.ITableCollection
Dim pTableSet As esriSystem.ISet
Dim lngTableIndex As Long
Dim pTable As esriGeoDatabase.ITable
Dim pName As esriSystem.IName
'+++ get a reference to the LocatorExtension
pUID.Value = "esriLocationUI.LocatorExtension"
Set pApplication = ThisDocument.Parent
Set pLocatorExtension = pApplication.FindExtensionByCLSID(pUID)
'+++ get the current AddressLocator from the LocatorExtension
Set pLocator = pLocatorExtension.Locator("Address", pLocatorExtension.CurrentLocator("Address"))
'+++ get the set of Tables from the current ArcMap document
Set pMxDocument = ThisDocument
Set pTableCollection = pMxDocument.FocusMap
Set pTableSet = New esriSystem.Set
For lngTableIndex = 0 To pTableCollection.TableCount - 1
If lngTableIndex = 0 Then
Set pTable = pTableCollection.Table(lngTableIndex)
End If
pTableSet.Add pTableCollection.Table(lngTableIndex)
Next lngTableIndex
'+++ get the user interface for the AddressLocator, and open a dialog to geocode from the set of
'+++ tables in the ArcMap document
Set pAddressUI = pLocator.UserInterface
Set pName = _
pAddressUI.MatchTableFromSet(ThisDocument.Parent.hWnd, pTableSet, pTable, True, pLocator, "")
The ArcMap extension objects extend the ArcMap user interface to provide geocoding functionality to ArcMap users.
The LocatorExtension object is an ArcMap application extension that manages the set of locators in an ArcMap document. The LocatorExtension object also responds to events that occur in the set of locators, such as the addition or removal of a locator from the ArcMap document.
The following example illustrates how to use the LocatorExtension to add a locator to an ArcMap document:
Dim pConnectionProperties As esriSystem.IPropertySet
Dim pWorkspaceFactory As esriGeoDatabase.IWorkspaceFactory
Dim pWorkspace As esriGeoDatabase.IWorkspace
Dim pLocatorManager As esriLocation.ILocatorManager
Dim pLocatorWorkspace As esriGeoDatabase.ILocatorWorkspace
Dim pLocator As esriGeoDatabase.ILocator
Dim pUID As New esriSystem.UID
Dim pApplication As esriFramework.IApplication
Dim pLocatorExtension As esriLocationUI.ILocatorExtension
Dim lngLocatorIndex As Long
'+++ open an ArcSDE Workspace
Set pConnectionProperties = New esriSystem.PropertySet
With pConnectionProperties
.SetProperty "server", "napanee"
.SetProperty "instance", "sde90_arcobjects"
.SetProperty "database", "arcobjects"
.SetProperty "user", "sde"
.SetProperty "password", "sde"
.SetProperty "version", "SDE.Default"
End With
Set pWorkspaceFactory = New esriDataSourcesGDB.SdeWorkspaceFactory
Set pWorkspace = pWorkspaceFactory.Open(pConnectionProperties, 0)
'+++ get a reference to the Locator to add to the ArcMap document
Set pLocatorManager = New esriLocation.LocatorManager
Set pLocatorWorkspace = pLocatorManager.GetLocatorWorkspace(pWorkspace)
Set pLocator = pLocatorWorkspace.GetLocator("SDE.Redlands Streets")
'+++ get a reference to the LocatorExtension
pUID.Value = "esriLocationUI.LocatorExtension"
Set pApplication = ThisDocument.Parent
Set pLocatorExtension = pApplication.FindExtensionByCLSID(pUID)
'+++ add the Locator to the LocatorExtension and set it to be the current locator
lngLocatorIndex = pLocatorExtension.AddLocator(pLocator)
pLocatorExtension.CurrentLocator("Address") = lngLocatorIndex
The AddressFindData object represents a candidate returned by an address locator when the address locator is used in the Find dialog in ArcMap. The AddressFindData object has properties that completely describe the candidate found by the address locator.
The ArcCatalog extension objects extend the ArcCatalog user interface to allow users to manage address locators in ArcCatalog.
A GxLocatorFolder is a folder in ArcCatalog that contains address locators. A GxLocatorFolder can represent the default LocalLocatorWorkspace, or a DatabaseLocatorWorkspace in an ArcSDE database. GxLocatorFolders contain GxLocators, which represent address locators. In addition to being contained in a GxLocatorFolder, GxLocators can be found within any file system folder in ArcCatalog, or within an ArcGIS Server connection in ArcCatalog.
The GxFilterAddressLocators object is a GxFilter object that can be used with the GxDialog to allow users to browse for GxLocator objects.
The following example illustrates how to browse for an address locator using a GxDialog:
Dim pGxDialog As esriCatalogUI.IGxDialog Dim pEnumGxObject As esriCatalog.IEnumGxObject Dim pGxLocator As esriCatalog.IGxLocator Dim pLocator As esriGeoDatabase.ILocator '+++ create a new GxDialog, and set its properties to browse for a Locator Set pGxDialog = New esriCatalogUI.GxDialog With pGxDialog .AllowMultiSelect = False .ButtonCaption = "Open" Set .ObjectFilter = New esriLocationUI.GxFilterAddressLocators .Title = "Choose an address locator:" End With '+++ open the GxDialog to browse for a Locator If pGxDialog.DoModalOpen(ThisDocument.Parent.hWnd, pEnumGxObject) Then pEnumGxObject.Reset Set pGxLocator = pEnumGxObject.Next Set pLocator = pGxLocator.Locator End If