ESRI.ArcGIS.ADF.IMS
Geocoder Class
Members  Example  See Also 
ESRI.ArcGIS.ADF.IMS.Geocode Namespace : Geocoder Class




An object used for geocoding on a FeatureLayer.

Object Model



Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class Geocoder 
Visual Basic (Usage)Copy Code
Dim instance As Geocoder
C# 
[SerializableAttribute()]
public class Geocoder 

Example

The following example display the properties of the Geocoder, and also presents a form for user input of geocoding values. For each geocoding InputField, the geocoding field label is displayed in a Label control, and the input field ID is assigned to the Id of a TextBox control. These controls are added dynamically to the page within a Panel control. When the user submits the form, the TextBox values could be used to geocode the address values.

For an example of performing geocoding with the Geocode method, see AddressValueCollection .

C#Copy Code
ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer streetLayer = 

    (ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer) mapView.Layers["2"]; 

  

// Get the Geocoder from the FeatureLayer 

ESRI.ArcGIS.ADF.IMS.Geocode.Geocoder streetGeocoder = streetLayer.Geocoder; 

  

System.Text.StringBuilder sbResults = new System.Text.StringBuilder(); 

  

if (streetGeocoder != null) 



    // Set mininum score and maximum candidates 

    streetGeocoder.MinScore = 30; 

    streetGeocoder.MaxCandidates = 5; 

  

    // Get properties of geocoding to display to user 

    sbResults.Append("Properties of geocoding are:<br/>"); 

    sbResults.AppendFormat("- geocoding style: {0}<br/>", streetGeocoder.Style); 

    sbResults.AppendFormat("- minimum score: {0}<br/>", streetGeocoder.MinScore); 

    sbResults.AppendFormat("- maximum number of candidates: {0}<br/>", streetGeocoder.MaxCandidates); 

    sbResults.AppendFormat("- spelling sensitivity: {0}<br/>", streetGeocoder.SpellingSensitivity); 

    sbResults.AppendFormat("- side offset: {0} {1}<br/>", streetGeocoder.SideOffset, streetGeocoder.SideOffsetUnits); 

    sbResults.AppendFormat("- end offset: {0} percent<br/><br/>", streetGeocoder.EndOffset); 

  

    Label1.Text = sbResults.ToString(); 

  

    TextBox inputBox; 

    Label inputLabel; 

    Panel1.Controls.Add(new LiteralControl("Enter address to find:<br>")); 

  

    // Display a label and text box for each geocoding input 

    foreach (ESRI.ArcGIS.ADF.IMS.Geocode.InputField field in streetGeocoder.InputFields) 

    { 

        inputLabel = new Label(); 

        inputLabel.Text = field.Label; 

        Panel1.Controls.Add(inputLabel); 

        inputBox = new TextBox(); 

        inputBox.ID = field.ID; 

        Panel1.Controls.Add(inputBox); 

        Panel1.Controls.Add(new LiteralControl("<br>")); 

    } 



    
Visual BasicCopy Code
Dim streetLayer As ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer = _

    CType(mapView.Layers("2"), _

    ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer)



' Get the Geocoder from the FeatureLayer

Dim streetGeocoder As ESRI.ArcGIS.ADF.IMS.Geocode.Geocoder = streetLayer.Geocoder



Dim sbResults As Nw System.Text.StringBuilder()



If Not IsNothing(streetGeocoder)



    ' Set mininum score and maximum candidates

    streetGeocoder.MinScore = 30

    streetGeocoder.MaxCandidates = 5



    ' Get properties of geocoding to display to user

    sbResults.Append("Properties of geocoding are:<br/>")

    sbResults.AppendFormat("- geocoding style: {0}<br/>", streetGeocoder.Style)

    sbResults.AppendFormat("- minimum score: {0}<br/>", streetGeocoder.MinScore)

    sbResults.AppendFormat("- maximum number of candidates: {0}<br/>", streetGeocoder.MaxCandidates)

    sbResults.AppendFormat("- spelling sensitivity: {0}<br/>", streetGeocoder.SpellingSensitivity)

    sbResults.AppendFormat("- side offset: {0} {1}<br/>", streetGeocoder.SideOffset, streetGeocoder.SideOffsetUnits)

    sbResults.AppendFormat("- end offset: {0} percent<br/><br/>", streetGeocoder.EndOffset)



    Label1.Text = sbResults.ToString()



    Dim inputBox As TextBox

    Dim inputLabel As Label

    Panel1.Controls.Add(New LiteralControl("Enter address to find:<br>"))



    ' Display a label and text box for each geocoding input

    For Each field As ESRI.ArcGIS.ADF.IMS.Geocode.InputField In streetGeocoder.InputFields



        inputLabel = New Label()

        inputLabel.Text = field.Label

        Panel1.Controls.Add(inputLabel)

        inputBox = New TextBox()

        inputBox.ID = field.ID

        Panel1.Controls.Add(inputBox)

        Panel1.Controls.Add(New LiteralControl("<br>"))

    Next field

End If

Remarks

If geocoding has been set up in the map service for the layer, Geocoder allows geocoding on features of the layer. Obtain a reference to the Geocoder from the Geocoder property of FeatureLayer.

Geocoding is the process of finding map coordinates for non-coordinate data, such as an address, a place name, or a land parcel identification number. To enable geocoding on a layer, the map service creator must add geocoding to the layer's properties during service authoring. For details, see ArcIMS Help.

Geocoding is not supported for ArcMap Server image services. A workaround is to create a standard image service with the geocodable data and use it in parallel with the ArcMap service.

Inheritance Hierarchy

System.Object
   ESRI.ArcGIS.ADF.IMS.Geocode.Geocoder

See Also

© 2010 All Rights Reserved.