How to reverse geocode point features in a feature class


Summary
This topic discusses creating addresses from point locations in a feature class.


Reversing geocode point features in a feature class

Complete the following steps to reverse geocode point features:
  1. Build an address locator from your reference data.
  2. Obtain a feature class that contains point features that need to have address information associated with them.
  3. Determine what type of address the reverse geocode tool should return, that is, an address or intersection.
  4. Determine the distance from the point that the locator should search to find the address.

Using the geoprocessing tool

Use the Reverse Geocode geoprocessing tool to reverse geocode point locations in a feature class. The output feature class contains the closest address or intersection (if specified) to the associated point. See the following code example:
[C#]
public void ReverseGeocodeTool_Test()
{
    Geoprocessor GP = new Geoprocessor();
    ReverseGeocode reverseGeocode = new ReverseGeocode();
    reverseGeocode.in_features = "C:\\UnitedStates.gdb\\US_Locations";
    reverseGeocode.in_address_locator = "C:\\UnitedStates.gdb\\US_Locator";
    reverseGeocode.out_feature_class = "C:\\UnitedStates.gdb\\ReverseGeocoded_Table";
    reverseGeocode.address_type = "ADDRESS";
    reverseGeocode.search_distance = "100 Meters";
    try
    {
        IGeoProcessorResult result = GP.Execute(reverseGeocode, null)as
            IGeoProcessorResult;
        if (result != null)
        {
            if (result.Status != esriJobStatus.esriJobSucceeded)
                Console.WriteLine("Failed to reverse geocode the featureClass: ");
            else
                Console.WriteLine("Reverse Geocode completed successfully. ");
        }
        else
        {
            if (GP.MessageCount != 0)
            {
                for (int i = 0; i < GP.MessageCount; i++)
                {
                    Console.WriteLine("GP Message " + i + " " + GP.GetMessage(i));
                }
            }
            else
                Console.WriteLine("Execution failed with no status. ");
        }
    }
    catch (Exception e)
    {
        Console.WriteLine(
            "An Exception occured while executing the ReverseGeocode Tool:  " + e);
    }
}
[VB.NET]
Public Sub ReverseGeocodeTool_Test()
    Dim GP As ESRI.ArcGIS.Geoprocessor.Geoprocessor = New ESRI.ArcGIS.Geoprocessor.Geoprocessor
    
    Dim reverseGeocode As ReverseGeocode = New ReverseGeocode()
    reverseGeocode.in_features = "C:\UnitedStates.gdb\US_Locations"
    reverseGeocode.in_address_locator = "C:\UnitedStates.gdb\US_Locator"
    reverseGeocode.out_feature_class = "C:\UnitedStates.gdb\ReverseGeocoded_Table"
    reverseGeocode.address_type = "ADDRESS"
    reverseGeocode.search_distance = "100 Meters"
    
    Try
    Dim result As IGeoProcessorResult = GP.Execute(reverseGeocode, Nothing)
    If (Not result Is Nothing) Then
        If (Not result.Status = esriJobStatus.esriJobSucceeded) Then
            Console.WriteLine("Failed to reverse geocode the featureClass: ")
        Else
            Console.WriteLine("Reverse Geocode completed successfully. ")
        End If
    Else
        If (Not GP.MessageCount = 0) Then
            For i As Integer = 0 To GP.MessageCount - 1
                Console.WriteLine("GP Message " & i & " " + GP.GetMessage(i))
            Next
        Else
            Console.WriteLine("Execution failed with no status. ")
        End If
    End If
    Catch ex As Exception
    Console.WriteLine("An Exception occured while executing the ReverseGeocode Tool:  " & ex.ToString())
    End Try
End Sub


See Also:

How to find the address closest to a point using reverse geocoding
Creating an address locator




To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced
Engine Developer Kit Engine