LocationUI


Supported with:
Library dependencies: System, SystemUI, Geometry, Display, Server, Output, Geodatabase, GISClient, ArcWeb, DataSourcesFile, DataSourcesGDB, DataSourcesOleDB, DataSourcesRaster, DataSourcesNetCDF, GeoDatabaseDistributed, GeoDatabaseExtensions, Carto, NetworkAnalysis, Location, GeoAnalyst, Animation, Maplex, Geoprocessing, NetworkAnalyst, Schematic, SpatialAnalyst, 3DAnalyst, GlobeCore, Publisher, TrackingAnalyst, Framework, GeoDatabaseUI, DisplayUI, OutputUI, Catalog, CatalogUI, CartoUI, DataSourcesRasterUI, ArcCatalogUI, ArcCatalog, ArcMapUI, ArcMap, AnimationUI, Editor, GeoReferenceUI, EditorExt

Additional library information: Contents, Object Model Diagram

The LocationUI library provides user interface objects to support objects contained in the Location library. The LocationUI library also contains objects that extend other core libraries of the ArcGIS system, such as Catalog, CatalogUI, and CartoUI.

The objects that implement this functionality are grouped into a number of library subsystems. These library subsystems are:

Locator user interfaces

The locator user interface (UI) objects provide UIs for locators in ArcGIS.
 
A LocatorUI object provides the basic UI functionality for working with a locator in ArcGIS. It opens the UI for creating a locator, modifying the properties of a locator, and geocoding a table of addresses. An ESRILocatorUI object provides additional UIs to expose all the functionality of address locators that use the ESRI geocoding engine. There are two types of ESRILocatorUI objects: AddressLocatorUI objects that provide UIs for ESRIAddressLocator objects and CompositeLocatorUI objects that provide UIs for composite address locators.
 
The following code example illustrates how to use the AddressLocatorUI associated with a locator to open the UI for geocoding one set of tables in an ArcMap document.

[VB.NET]
Dim pUID As New ESRI.ArcGIS.esriSystem.UID
Dim pApplication As ESRI.ArcGIS.Framework.IApplication
Dim pLocatorExtension As ESRI.ArcGIS.LocationUI.ILocatorExtension
Dim pLocator As ESRI.ArcGIS.Geodatabase.ILocator
Dim pAddressUI As ESRI.ArcGIS.LocationUI.IAddressUI
Dim pMxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument
Dim pTableCollection As ESRI.ArcGIS.Carto.ITableCollection
Dim pTableSet As ESRI.ArcGIS.esriSystem.ISet
Dim lngTableIndex As Long
Dim pTable As ESRI.ArcGIS.Geodatabase.ITable
Dim pName As ESRI.ArcGIS.esriSystem.IName

'+++ Get a reference to the LocatorExtension.
pUID.Value = "esriLocationUI.LocatorExtension"
pApplication = New ESRI.ArcGIS.Framework.AppRefClass
pLocatorExtension = pApplication.FindExtensionByCLSID(pUID)

'+++ Get the current AddressLocator from the LocatorExtension.
pLocator = pLocatorExtension.Locator("Address", pLocatorExtension.CurrentLocator("Address"))

'+++ Get the set of tables from the current ArcMap document.
pMxDocument = pApplication.Document
pTableCollection = pMxDocument.FocusMap
pTableSet = New ESRI.ArcGIS.esriSystem.SetClass
For lngTableIndex = 0 To pTableCollection.TableCount - 1
If lngTableIndex = 0 Then
   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.
pAddressUI = pLocator.UserInterface
pName = _
pAddressUI.MatchTableFromSet(pApplication.hWnd, pTableSet, pTable, True, pLocator, "")

ArcMap extensions

The ArcMap extension objects extend the ArcMap UI 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 code example illustrates how to use LocatorExtension to add a locator to an ArcMap document.

[VB.NET]
Dim pConnectionProperties As ESRI.ArcGIS.esriSystem.IPropertySet
Dim pWorkspaceFactory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory
Dim pWorkspace As ESRI.ArcGIS.Geodatabase.IWorkspace
Dim pLocatorManager As ESRI.ArcGIS.Location.ILocatorManager
Dim pLocatorWorkspace As ESRI.ArcGIS.Geodatabase.ILocatorWorkspace
Dim pLocator As ESRI.ArcGIS.Geodatabase.ILocator
Dim pUID As New ESRI.ArcGIS.esriSystem.UID
Dim pApplication As ESRI.ArcGIS.Framework.IApplication
Dim pLocatorExtension As ESRI.ArcGIS.LocationUI.ILocatorExtension
Dim lngLocatorIndex As Long

'+++ Open an ArcSDE workspace.
pConnectionProperties = New ESRI.ArcGIS.esriSystem.PropertySetClass
With pConnectionProperties
.SetProperty("server", "mendota")
.SetProperty("instance", "esri_sde")
.SetProperty("database", "arcobjects")
.SetProperty("user", "sde")
.SetProperty("password", "sde")
.SetProperty("version", "SDE.Default")
End With
pWorkspaceFactory = New ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass
pWorkspace = pWorkspaceFactory.Open(pConnectionProperties, 0)

'+++ Get a reference to the locator to add to the ArcMap document.
pLocatorManager = New ESRI.ArcGIS.Location.LocatorManagerClass
pLocatorWorkspace = pLocatorManager.GetLocatorWorkspace(pWorkspace)
pLocator = pLocatorWorkspace.GetLocator("SDE.Redlands Streets")

'+++ Get a reference to the LocatorExtension.
pUID.Value = "esriLocationUI.LocatorExtension"
pApplication = New ESRI.ArcGIS.Framework.AppRefClass
pLocatorExtension = pApplication.FindExtensionByCLSID(pUID)

'+++ Add the locator to the LocatorExtension and set as 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 box in ArcMap. The AddressFindData object has properties that completely describe the candidate found by the address locator.

ArcCatalog extensions

The ArcCatalog extension objects extend the ArcCatalog UI to allow you 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 in any file system folder in ArcCatalog or in an ArcGIS Server connection in ArcCatalog.
 
The GxFilterAddressLocators object is a GxFilter object that can be used with GxDialog to browse for GxLocator objects.
 
The following code example illustrates how to browse for an address locator using GxDialog.

[VB.NET]
Dim pGxDialog As ESRI.ArcGIS.CatalogUI.IGxDialog
Dim pEnumGxObject As ESRI.ArcGIS.CatalogUI.IEnumGxView
Dim pGxLocator As ESRI.ArcGIS.Catalog.IGxLocator
Dim pLocator As ESRI.ArcGIS.Geodatabase.ILocator
Dim pApplication As ESRI.ArcGIS.Framework.IApplication

'+++ Create a new GxDialog, and set its properties to browse for a locator.
pGxDialog = New ESRI.ArcGIS.CatalogUI.GxDialogClass
With pGxDialog
  .AllowMultiSelect = False
  .ButtonCaption = "Open"
  .ObjectFilter = New ESRI.ArcGIS.LocationUI.GxFilterAddressLocatorsClass
  .Title = "Choose an address locator:"
End With

'+++ Open GxDialog to browse for a locator.
pApplication = New ESRI.ArcGIS.Framework.AppRefClass
If pGxDialog.DoModalOpen(pApplication.hWnd, pEnumGxObject) Then
  pEnumGxObject.Reset()
  pGxLocator = pEnumGxObject.Next
  pLocator = pGxLocator.Locator
End If