Skip To Content

Geocode Locations From Table

Summary

Geocodes hosted tables using locators hosted on an ArcGIS Enterprise portal, which creates a hosted feature layer containing the geocoded results. This tool is designed to automate the process of geocoding tables published to the portal and saving the output to the portal. If you are not interested in saving the geocode results to the portal, use the Geocode Table pane or the Geocode Addresses tool.

Usage

  • You can geocode addresses that are stored in a single field or multiple fields. 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 split into multiple fields such as Address, City, State, and ZIP for a general United States address.

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

  • When using the ArcGIS World Geocoding Service as a proxy on the ArcGIS Enterprise portal, this operation may consume ArcGIS Online credits.

  • The tool requires that a table that is hosted or has been published on an ArcGIS Enterprise portal be used as the input table. 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. Changing the spatial reference of the output feature layer is possible 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 any values in the original table will not update the results in the output feature service. The tool will need to be rerun to create a new output feature service that contains these changes.

    Learn more about rematching geocoding results

  • An ArcGIS Online for organizations subscription is required to geocode a table of addresses using the ArcGIS World Geocoding Service as a proxy on the ArcGIS Enterprise portal. See Use the ArcGIS Online World Geocoding Service for more information.

Syntax

GeocodeLocationsFromTable_geocoding (in_table, in_address_locator, address_fields, output_name, {country}, {location_type}, {category})
ParameterExplanationData Type
in_table

The table on the portal that contains 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.

A populated list of locators on the active portal. You can select a locator from this list or browse the active portal for other available locators or locator views. Locators that have been set as utility services in 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.

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 where 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 one 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 split into multiple fields such as Address, City, State, and ZIP for a general United States address.

If you choose not to 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 by 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 to search for the geocoded addresses. This parameter is available for locators that support a country parameter and will limit geocoding to the selected countries. Making a country selection will improve the accuracy of geocoding in most cases. If a field representing countries in the Input Table is mapped to the Country Input Address Field, the country value from the Input Table will override the Country parameter.

If no country is specified, geocoding is performed against all supported countries of the locator. The input value should be specified as ISO 3166-1 3-character country codes.

Country is not supported for all locators.

String
location_type
(Optional)

Specifies the preferred output geometry for POINT_ADDRESS matches. The options for this parameter are ROUTING_LOCATION, the side of street location that can be used for routing, or ADDRESS_LOCATION, 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 instead. For geocode results with Addr_type=PointAddress, the x,y attribute values describe the coordinates of the address along the street, while the DisplayX and DisplayY values describe the rooftop or building centroid coordinates. See the REST API web help for details about the locationType parameter for reverseGeocode.

This parameter is not supported for all locators.

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

Limits the types of places the locator searches, thus eliminating false positive matches and potentially speeding up the search process. When no category is used, geocoding is performed against all supported categories. Not all category values are supported for all locations and countries. In general, the Category 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 REST API web help for details about category filtering.

String

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.

import arcpy

table_url = "https://myportal.domain.com/portal/rest/services/Hosted/customers/FeatureServer/0"
locator_url = "http://myportal.domain.com/portal/rest/services/Altanta/GeocodeServer"
field_mapping = "'Street or Intersection' <None> VISIBLE NONE;'City or Placename' City VISIBLE NONE;State State VISIBLE NONE;'ZIP Code' ZIP VISIBLE NONE"
output_name_on_portal = "customers_geocoded"
country = None
preferred_location_type = "ROUTING_LOCATION"

arcpy.geocoding.GeocodeLocationsFromTable(table_url, locator_url, field_mapping, 
                                          output_name_on_portal, country, 
                                          preferred_location_type)

Licensing information

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

Related topics