An object used for geocoding on a FeatureLayer.
Object Model
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As 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 Basic | Copy 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
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also