Geocode Locations From Table (Geocoding)

Summary

Geocodes hosted tables using locators hosted on an ArcGIS Enterprise portal, which creates a hosted feature layer containing the geocoded results.

This tool automates the process of geocoding tables published to the portal and saves the output to the portal. If you do not need to save the geocode results to the portal, use the Geocode Table pane or the Geocode Addresses tool.

Note:

You must have publisher or administrator privileges on the portal to run this tool. If you are a member of a custom role, ensure that the portal administrator has granted you the Publish hosted web layers privilege.

Usage

  • You can geocode addresses that are stored in a single field, divided into multiple fields, or stored in a single field and a country field. A single input field stores the complete address, for example, 303 Peachtree St NE, Atlanta, GA 30308. Multiple fields are supported if the input addresses are divided into multiple fields such as Address, City, State, and ZIP for a general United States address. A single input field that stores the complete address, for example, 303 Peachtree St NE, Atlanta, GA 30308, and a field that stores the country associated with the address, for example, USA, is also supported.

  • Some locators support multiple input address fields, such as Address, Address2, and Address3. In this case, the address component can be separated into multiple fields, and the address fields will be concatenated at the time of geocoding. For example, 100, Main st, and Apt 140 across three fields or 100 Main st and Apt 140 across two fields, both become 100 Main st Apt 140 when geocoding.

  • ArcGIS Enterprise 10.6 or later is required to use the tool.

  • Use a locator on the ArcGIS Enterprise portal that has been configured to use multiple threads to improve geocoding performance.

  • The input table must be a table that is hosted or has been published on an ArcGIS Enterprise portal. Hosted tables are considered part of hosted feature layers and must be created as an item in the portal before they can be used in the tool. For details, see Publish hosted feature layers.

  • The output hosted feature layer is saved in the same spatial reference as the address locator. You can change the spatial reference of the output feature layer by setting a different output coordinate system in the tool's environment settings.

  • The output hosted feature layer will contain all relevant geocoding information, such as score, status, and the matched address of each record, as well as the values from the original input table. The addresses can be rematched using the Rematch Addresses tool or the Rematch Addresses option that opens the Rematch Addresses pane. The geocoding results from this tool contain a static snapshot of the original input table, so adding or updating values in the original table will not update the results in the output feature service. Rerun the tool to create an output feature service that contains these changes.

    Learn more about rematching geocoding results

  • When using an input locator built with z-aware data, the tool will return output that is not z-aware. Only 2D output is supported in this tool.

  • The tool does not apply configurations from a locator view created in ArcGIS Pro 3.2 when using it as the Address Locator parameter value.

Parameters

LabelExplanationData Type
Input Table

The table on the portal that contains the addresses or places to geocode.

Record Set
Address Locator

The portal locator that will be used to geocode the input table from the portal.

You can choose a locator from the populated list of locators on the active portal or browse the active portal for other available locators. Locators that have been set as utility services on the active portal will be available by default. If the portal locator you want to use is not in the populated list, ask your portal administrator to add the locator as a portal utility service, and configure the locator for batch geocoding.

Note:

The ArcGIS World Geocoding Service is disabled for this tool. Use the Geocode Addresses tool if you want to use the ArcGIS World Geocoding Service.

Address Locator
Address Field Mapping

The address fields used by the locator are mapped to fields in the input table of addresses. Specify Single Field if the complete address is stored in one field in the input table, for example, 303 Peachtree St NE, Atlanta, GA 30308. Specify Multiple Fields if the input addresses are divided into multiple fields such as Address, City, State, and ZIP for a general United States address. Specify Single Field and Country Field if the complete address, for example, 303 Peachtree St NE, Atlanta, GA 30308, and the country, for example, USA, are divided into separate fields such as Address and Country.

Some locators support multiple input address fields, such as Address, Address2, and Address3. In this case, the address component can be separated into multiple fields, and the address fields will be concatenated at the time of geocoding. For example, 100, Main St, and Apt 140 across three fields or 100 Main St and Apt 140 across two fields, both become 100 Main St Apt 140 when geocoding.

If you do not map an optional input address field used by the locator to a field in the input table of addresses, specify that there is no mapping using <None> in place of a field name.

Field Info
Output Feature Layer Name

The name of the output geocoded feature layer that will be created on the portal.

String
Country
(Optional)

The country or countries that will be searched for the geocoded addresses.

This parameter is available for locators that support a country parameter and will limit geocoding to the specified countries. Specifying a country will improve the accuracy of geocoding in most cases. When you specify Single Field and Country Field for the Address Field Mapping parameter and map a field representing countries in the Input Table parameter value to the Country field for the Address Field Mapping parameter, the country value from the Input Table parameter will override the Country parameter.

This is limited to the specified country or countries. When no country is specified, geocoding is performed using all supported countries of the locator.

The Country parameter is not supported for all locators.

String
Preferred Location Type
(Optional)

Specifies the preferred output geometry that will be returned for Point Address matches. The options for this parameter are Routing location, which is the side of street location that can be used for routing and Address location, which is the location that represents the rooftop or parcel centroid for the address. If the preferred location does not exist in the data, the default location will be returned. For geocode results with Addr_type=PointAddress, the x,y attribute values describe the coordinates of the address along the street, and the DisplayX and DisplayY values describe the rooftop or building centroid coordinates.

This parameter is not supported for all locators.

  • Address locationGeometry for geocode results that represent an address location such as a rooftop location, parcel centroid, or front door will be returned.
  • Routing locationGeometry for geocode results that represent a location close to the side of the street that can be used for vehicle routing will be returned. This is the default.
String
Category
(Optional)

Limits the types of places the locator searches, eliminating false positive matches and potentially speeding up the search process. When no category is used, geocoding is performed using all supported categories. Not all category values are supported for all locations and countries. In general, this parameter can be used for the following:

  • Limit matches to specific place types or address levels
  • Avoid fallback matches to unwanted address levels
  • Disambiguate coordinate searches

This parameter is not supported for all locators.

String
Output Fields
(Optional)

Specifies the locator output fields that will be returned in the geocode results.

  • All Includes all available locator output fields in the geocode results. This is the default.
  • Location OnlyStores the Shape field in the geocode results. The original field names from the Input Table parameter value will be maintained with their original field names.
  • MinimalAdds the following fields that describe the location and how well it matches information in the locator in the geocode results: Shape, Status, Score, Match_type, Match_addr, and Addr_type. The original field names from the Input Table parameter value will be maintained.
  • Minimal and User FieldsAdds the following fields that describe the location and how well it matches information in the locator, as well as any user-defined custom output fields in the geocode results: Shape, Status, Score, Match_type, Match_addr, and Addr_type. The original field names from the Input Table parameter value will be maintained.
Note:

This parameter can be used with input locators created with the Create Locator or Create Feature Locator tool published to Enterprise 10.9 or later. Composite locators that contain at least one locator created with the Create Address Locator tool do not support this parameter.

String

Derived Output

LabelExplanationData Type
Output Layer

A hyperlink to the output geocoded results feature layer in the portal. The name of the feature layer is derived from the Output Feature Layer Name value.

Feature Set

arcpy.geocoding.GeocodeLocationsFromTable(in_table, in_address_locator, address_fields, output_name, {country}, {location_type}, {category}, {output_fields})
NameExplanationData Type
in_table

The table on the portal that contains the addresses or places to geocode.

Record Set
in_address_locator

The portal locator that will be used to geocode the input table from the portal.

You can choose a locator from the populated list of locators on the active portal or browse the active portal for other available locators. Locators that have been set as utility services on the active portal will be available by default. If the portal locator you want to use is not in the populated list, ask your portal administrator to add the locator as a portal utility service, and configure the locator for batch geocoding.

Note:

The ArcGIS World Geocoding Service is disabled for this tool. Use the Geocode Addresses tool if you want to use the ArcGIS World Geocoding Service.

Address Locator
address_fields
[input_locator_field, table_field_name]

Each field mapping in this parameter is in the format input_locator_field, table_field_name in which input_locator_field is the name of the input address field specified by the locator, and table_field_name is the name of the corresponding field in the table of addresses you want to geocode.

You can specify a single input field that stores the complete address, for example, 303 Peachtree St NE, Atlanta, GA 30308. Alternatively, you can specify multiple fields if the input addresses are divided into multiple fields such as Address, City, State, and ZIP for a general United States address. You can also specify a single input field that stores the complete address, for example, 303 Peachtree St NE, Atlanta, GA 30308, and a field that stores the country associated with the address, for example, USA.

Some locators support multiple input address fields, such as Address, Address2, and Address3. In this case, the address component can be separated into multiple fields, and the address fields will be concatenated at the time of geocoding. For example, 100, Main St, and Apt 140 across three fields or 100 Main St and Apt 140 across two fields, both become 100 Main St Apt 140 when geocoding.

If you do not map an optional input address field used by the locator to a field in the input table of addresses, specify that there is no mapping using <None> in place of a field name.

Field Info
output_name

The name of the output geocoded feature layer that will be created on the portal.

String
country
[country,...]
(Optional)

The country or countries that will be searched for the geocoded addresses.

This parameter is available for locators that support a country parameter and will limit geocoding to the specified countries. Specifying a country will improve the accuracy of geocoding in most cases. If a field representing countries in the in_table parameter is mapped to the Country field in address_fields, the country value from the in_table parameter will override the country parameter.

This is limited to the specified country or countries. If no country is specified, geocoding is performed on all supported countries of the locator.

Specify the value as either two-character or three-character country codes in a comma-separated list. See the Supported Country Codes column for the input value to use.

The country parameter is not supported for all locators.

String
location_type
(Optional)

Specifies the preferred output geometry that will be returned for POINT_ADDRESS matches. The options for this parameter are ROUTING_LOCATION, which is the side of street location that can be used for routing and ADDRESS_LOCATION, which is the location that represents the rooftop, parcel centroid for the address, or front door. If the preferred location does not exist in the data, the default location of ROUTING_LOCATION will be returned. For geocode results with Addr_type=PointAddress, the x,y attribute values describe the coordinates of the address along the street, and the DisplayX and DisplayY values describe the rooftop or building centroid coordinates. See the ArcGIS REST API web help for details about the locationType parameter for geocodeAddresses.

This parameter is not supported for all locators.

  • ADDRESS_LOCATIONGeometry for geocode results that represent an address location such as a rooftop location, parcel centroid, or front door will be returned.
  • ROUTING_LOCATIONGeometry for geocode results that represent a location close to the side of the street that can be used for vehicle routing will be returned. This is the default.
String
category
[category,...]
(Optional)

Limits the types of places the locator searches, eliminating false positive matches and potentially speeding up the search process. When no category is used, geocoding is performed using all supported categories. Not all category values are supported for all locations and countries. In general, this parameter can be used for the following:

  • Limit matches to specific place types or address levels
  • Avoid fallback matches to unwanted address levels
  • Disambiguate coordinate searches

This parameter is not supported for all locators.

See the ArcGIS REST API web help for details about category filtering.

String
output_fields
(Optional)

Specifies the locator output fields that will be returned in the geocode results.

Note:

This parameter can be used with input locators created with the Create Locator or Create Feature Locator tool published to Enterprise 10.9 or later. Composite locators that contain at least one locator created with the Create Address Locator tool do not support this parameter.

  • ALL Includes all available locator output fields in the geocode results. This is the default.
  • LOCATION_ONLYStores the Shape field in the geocode results. The original field names from the in_table parameter value will be maintained with their original field names.
  • MINIMALAdds the following fields that describe the location and how well it matches information in the locator in the geocode results: Shape, Status, Score, Match_type, Match_addr, and Addr_type. The original field names from the in_table parameter value will be maintained.
  • MINIMAL_AND_USERAdds the following fields that describe the location and how well it matches information in the locator in the geocode results, as well as any user-defined custom output fields: Shape, Status, Score, Match_type, Match_addr, and Addr_type. The original field names from the in_table parameter value will be maintained.
String

Derived Output

NameExplanationData Type
output_layer

A hyperlink to the output geocoded results feature layer in the portal. The name of the feature layer is derived from the Output Feature Layer Name value.

Feature Set

Code sample

GeocodeLocationsFromTable example (stand-alone script)

The following stand-alone script demonstrates how to use the GeocodeLocationsFromTable function to geocode a hosted table layer.

Note:
If you are working with locators on your portal, ensure that you are signed in and set it as the active portal in ArcGIS Pro. To access a locator that is on a portal other than the active portal, authenticate using the SignInToPortal function.

import arcpy

# Input is a hosted table
input_table = "https://<machine_name>/server/rest/services/Hosted/<item_name>/FeatureServer/<table_number>"

# This tool works with locators on your portal
in_locator = "https://<machine_name>/server/rest/services/<locator_name>/GeocodeServer/<locator_name>"

# The easiest way to generate a field mapping is to run the tool in ArcGIS 
# Pro and right-click the green success ribbon and click "Copy Python command"
field_mapping =  "'Street or Intersection' address VISIBLE NONE;'City or Placename' <None> VISIBLE NONE;State <None> VISIBLE NONE;'ZIP Code' zip VISIBLE NONE"
output_name = "geocoding_output"

# Optional geocoding parameters. Only some are supported depending on the 
# in_locator that you use.
country = None
location_type = None
category = None

# The output is a hosted feature layer on your portal. To retrieve the
# output, go to your portal and look for a new item with the output_name that 
# you entered.
arcpy.geocoding.GeocodeLocationsFromTable(input_table, in_locator, 
                                          field_mapping, output_name, country, 
                                          location_type, category)

Licensing information

  • Basic: Requires your account in ArcGIS Enterprise to have the Perform Analysis privilege
  • Standard: Requires your account in ArcGIS Enterprise to have the Perform Analysis privilege
  • Advanced: Requires your account in ArcGIS Enterprise to have the Perform Analysis privilege

Related topics