Geocode services


Local (DCOM) connections are only supported for ArcGIS Server versions prior to 10.1.

About geocoding

Geocoding is the process of finding a geographic location based on an address. This is done by assigning a location, usually in the form of a coordinate, to an address by comparing the descriptive location elements in the address to those present in the reference data.  Geocoding is often integrated into server applications as a means of finding a location by a street address to display in a map, use as a stop in a network analysis, or as a location in a variety of geographic information system (GIS) analysis operations. These locations can be found by geocoding a single address or by geocoding a collection of addresses in batch.
Addresses come in many forms, ranging from the common address format of a house number followed by the street name, and succeeding information to other location descriptions, such as postal zone or census tract. Basically, an address includes any type of information that distinguishes a place. Geocoding rules are captured by creating an address locator based on a reference dataset (for example, a feature class representing a street network) and an address style. Elements of the address style (such as the street name, zone, and so on) are associated with fields in the reference data. The address locator uses this information to generate an index that is used to locate addresses.
Geocoding is the process of finding a location based on an address as shown in the following illustration:

 

Address locators

Address locators can be stored in a geodatabase or a file system. They are created and managed using the ArcCatalog desktop application. To exploit address locators and their geocoding capabilities through ArcGIS for Server applications, ArcGIS for Server includes a GeocodeServer server object. The GeocodeServer object is a coarse-grained server object that provides access to an address locator and methods for performing single address and batch geocoding. The GeocodeServer object is shown in the following illustration:
The Server software development kit (SDK) includes Web controls for embedding geocoding functionality into your Web application. To create a server application or Web service that includes geocoding functionality using ArcGIS for Desktop, perform the following steps:
  1. Create an address locator based on your reference data using ArcCatalog.
  2. Create a GeocodeServer object in ArcCatalog based on the address locator you created in Step 1.
  3. Using your integrated development environment (IDE), use GeocodeServer and Web controls to create your application or Web service.
The application you create can be built from scratch, or it can be based on extending one of the geocoding-oriented application templates. The template applications included with the ArcGIS for Server SDK that have geocoding functionality include the following Web application templates:
  • Geocode template—Provides an interface for finding map locations using an address.
  • Simple routing template—Allows you to find a route and driving directions between two addresses.
  • Closest facility template—Allows you to find the closest facilities (for example, hospitals) to an address.
The geocoding objects are located in the esriLocation library. Typically, a geocoding application includes the use of objects in a variety of libraries. When working with address locators in ArcGIS for Server applications, all interaction is through GeocodeServer. GeocodeServer is a server object that is served by an ArcGIS Server that can be used to geocode addresses. Internally, GeocodeServer uses an address locator to geocode and exposes the high-level functionality of the address locator using the IGeocodeServer interface.
All of the coarse-grained functionality of GeocodeServer can be accessed through the IGeocodeServer interface. Using this interface, you can geocode single addresses or tables of addresses, find the address closest to a point, and access the support functionality required to accomplish these tasks.
To access the fine-grained ArcObjects that support the geocoding functionality of GeocodeServer, use IGeocodeServerObjects to obtain a reference to the address locator on which the GeocodeServer is based. From this address locator, you can access the fine-grained ArcObjects associated with the address locator, such as the reference data used by the address locator.
The fine-grained objects that support GeocodeServer are stateful, so you should only use a non-pooled GeocodeServer when modifying these objects.
The following code example shows how to use GeocodeServer to locate an address:
[C#]
IServerContext pServerContext = pSOM.CreateServerContext("RedlandsGeocode", 
    "GeocodeServer");

IGeocodeServer pGCServer = pServerContext.ServerObject as IGeocodeServer;
IPropertySet pPropertySet = pServerContext.CreateObject("esriSystem.PropertySet")as
    IPropertySet;
pPropertySet.SetProperty("Street", "380 New York St");

IPropertySet pResults = pGCServer.GeocodeAddress(pPropertySet, null);

IPoint pPoint = pResults.GetProperty("Shape")as IPoint;

Console.WriteLine(pPoint.X + ", " + pPoint.Y);

pServerContext.ReleaseContext();
[VB.NET]
Dim pServerContext As IServerContext = pSOM.CreateServerContext("RedlandsGeocode", "GeocodeServer")

Dim pGCServer As IGeocodeServer = pServerContext.ServerObject
Dim pPropertySet As IPropertySet = pServerContext.CreateObject("esriSystem.PropertySet")
pPropertySet.SetProperty ("Street", "380 New York St")

Dim pResults As IPropertySet = pGCServer.GeocodeAddress(pPropertySet, Nothing)

Dim pPoint As IPoint = pResults.GetProperty("Shape")

Debug.WriteLine (pPoint.X & ", " & pPoint.Y)

pServerContext.ReleaseContext()