In this topic
Local (DCOM) connections are only supported for ArcGIS for Server versions prior to 10.1.
About geocode resources
Geocode resources provide access to address matching capabilities of a data source, including geocoding and reverse geocoding. The IGeocodeResource interface defines the generic properties used to define matching characteristics—such as minimum and maximum score—and the number of match candidates to return. Geocode resources are available in a Web Application Developer Framework (ADF) application via a GeocodeResourceManager control.
Geocode resources are implemented by the following:
- ArcGIS for Server local
- ArcGIS for Server Internet
- ArcIMS
IGeocodeFunctionality is the functionality type created by geocode resources.
Data sources expose geocode resources in various ways. ArcGIS for Server publishes geocode services and ArcIMS exposes geocode capabilities in an image service. In most cases, you will interact with a geocode resource via a geocode functionality.
GeocodeFunctionality and IGeocodeFunctionality
GeocodeFunctionality is implemented for data sources that perform geocoding and reverse geocoding. You can explicitly create a GeocodeFunctionality using the GeocodeResource.CreateFunctionality() method. In most cases, you can work with the Common Data Source application programming interface (Common API) reference, IGeocodeFunctionality, instead of explicitly casting to a data source implementation type.
The following table lists properties and methods of IGeocodeFunctionality:
Property or method
|
Description
|
FindAddressCandidates() method
|
Returns a DataTable. Each row contains a Web ADF point of an address match and the attributes of the feature matched in the geocode reference layer.
|
GeocodeAddress() method
|
Returns a Web ADF point of the match with the highest score.
|
GetAddressFields() method
|
Returns a list of Field objects. Each field is an input for the geocode resource.
|
GetLocatorProperties() method
|
Returns a dictionary of string-object pairs. Each pair is a property setting for the geocode resource (locator).
|
MinCandidateScore property
|
An integer value between 0–100. Determines how closely an address must match attributes in a geocode reference layer. Used by FindAddressCandidates().
|
MinMatchScore property
|
An integer value between 0–100. Determines how closely an address must match attributes in a geocode reference layer. Used by GeocodeAddress() and FindAddressCandidates().
|
ReverseGeocode() method
|
Returns a list of AddressValue objects. Each has a Value property to store the address string.
|
ShowAllCandidates property
|
A Boolean. If false, FindAddressCandidates() returns only matches; if true, it returns matches and candidates.
|
GeocodeFunctionality is created by GeocodeResource. GeocodeResource is managed by GeocodeResourceManager. The following code example returns GeocodeResource from GeocodeResourceManager, explicitly initializes it, then creates and works with GeocodeFunctionality:
[C#]
ESRI.ArcGIS.ADF.Web.DataSources.IGISResource gisresource =
GeocodeResourceManager1.GetResource(0);
gisresource.Initialize();
ESRI.ArcGIS.ADF.Web.DataSources.IGeocodeFunctionality igf =
(ESRI.ArcGIS.ADF.Web.DataSources.IGeocodeFunctionality)
(gisresource.CreateFunctionality(typeof
(ESRI.ArcGIS.ADF.Web.DataSources.IGeocodeFunctionality), null));
A geocode resource must be initialized before a geocode functionality is created.
The following code example shows how to get the input address fields and address locator properties that the geocode functionality uses. The input address fields are used to submit an address for matching. The locator properties provide default settings for the geocode process.
[C#]
System.Collections.Generic.List < Field > addressfields = igf.GetAddressFields();
foreach (Field f in addressfields)
{
System.Diagnostics.Debug.WriteLine((f.Name));
}
System.Collections.Generic.Dictionary < string, object > dict =
igf.GetLocatorProperties();
foreach (System.Collections.Generic.KeyValuePair < string, object > pair in dict)
{
System.Diagnostics.Debug.WriteLine((pair.Key + ": " + pair.Value.ToString()));
}
To submit an address for geocoding, create a generic list containing an AddressValue object for each input address field as shown in the following code example:
[C#]
System.Collections.Generic.List < AddressValue > avc = new
System.Collections.Generic.List < AddressValue > ();
AddressValue av1 = new AddressValue("STREET", "380 New York St");
AddressValue av2 = new AddressValue("ZONE", "92373");
avc.Add(av1);
avc.Add(av2);
The input address field name is the first parameter in the AddressValue constructor. The second parameter is the input value to geocode.
See Also:
Resources and functionalities in the Web ADFData source-specific APIs
Map resources
Geoprocessing resources