Geocoding is the process of assigning a location, usually in the form of coordinate values, to an address by comparing the descriptive location elements in the address to those present in the reference material. Addresses come in many forms, ranging from the common address format of house number followed by the street name and succeeding information to other location descriptions such as postal zone or census tract. An address includes any type of information that distinguishes a place.
You can perform geocoding-related operations in GeoAnalytics Engine using the Geocode or Reverse Geocode tools which are detailed below.
Geocoding with GeoAnalytics Engine requires the geoanalytics-natives
jar. See the Install and set up documentation for more information on how to install this jar to your environment.
Locators
Geocoding requires a locator. A locator contains a snapshot of the reference data that is used in geocoding operations. The results of geocoding can be used to perform spatial and tabular analysis to help you make specific decisions based on your needs.
Locators in GeoAnalytics Engine
A locator is required to run the Geocode and Reverse Geocode tools. You can load a locator in the Geocode or Reverse Geocode tools with either of the following options:
- Specify the file path of the locator (
.loc
) data in.set
. TheLocator() .loz
file needs to be in the same directory as the.loc
file. - Specify the file path of a mobile map package (
.mmpk
) in.set
. The locator data stored in the mobile map package is automatically detected and used in geocoding operations.Locator()
The locator must be locally accessible to all nodes in your Spark cluster.
For more information, see Locator and network dataset setup.You can build your own locator if you want to collect and manage your own assets and address data. This is a flexible option to set up geocoding in a way that aligns with your search patterns and needs. You can build your own locator using an application like ArcGIS Pro, to learn more see Introduction to custom locators. You can also license commercially available locator files, for instance, Esri’s ArcGIS StreetMap Premium.
Describe locators in GeoAnalytics Engine
You will need to view the properties of a locator in order to perform geocoding operations with it. Some information is essential for the analysis, such as supported country code, user-defined output fields, etc. The information will help you decide how to configure the parameters of the Geocode and Reverse Geocode tools and better understand the results.
You can use the describe
utility function to view all properties stored in the locator.
The function returns a dictionary with the following properties of your locator:
-
all
—All output fields available in this locator that can be returned in the Geocode or Reverse Geocode tool output.Available Output Fields -
country
—A list of three-character country codes associated with countries that the locator supports.Codes -
default
—The output fields in this locator that will be returned in the Geocode or Reverse Geocode tool outputs as default.Output Fields -
input
—A list of input fields that are used in address matching.Fields -
max
—Maximum number of candidates that can be returned in the Geocode tool output.Number Of Candidates -
min
—Minimum score to be considered as a match candidate in the Geocode tool output.Candidate Score -
spatial
—The well-known ID (WKID) of the spatial reference the locator data is stored in.Reference -
supported
—A list of supported address types in this locator. For example, Point Address, Street Address, POI, etc.Roles -
supports
—A Boolean value indicating if the locator supports geocoding of addresses.Addresses -
supports
—A Boolean value indicating if the locator supports geocoding of intersections.Intersections -
supports
—A Boolean value indicating if the locator supports geocoding of Points Of Interest.POI -
user
—A list of user-defined output fields available to be returned in the Geocode or Reverse Geocode tool outputs.Defined Output Fields -
version
—The version of the locator.
The following code sample shows an example of describing a locator:
import geoanalytics
import json
locator_info = geoanalytics.util.describe_locator(r"/data/example.loc")
print(json.dumps(locator_info, sort_keys=True, indent=4))
{
"allAvailableOutputFields": [
"Status",
"Score",
"Match_addr",
"LongLabel",
"ShortLabel",
"Addr_type",
"Type",
"PlaceName",
"Place_addr",
"Phone",
"URL",
"Rank",
"AddBldg",
"AddNum",
"AddNumFrom",
"AddNumTo",
"AddRange",
"Side",
"StPreDir",
"StPreType",
"StName",
"StType",
"StDir",
"StPreDir1",
"StPreType1",
"StName1",
"StType1",
"StDir1",
"StPreDir2",
"StPreType2",
"StName2",
"StType2",
"StDir2",
"BldgType",
"BldgName",
"LevelType",
"LevelName",
"UnitType",
"UnitName",
"SubAddr",
"StAddr",
"Address",
"Block",
"Sector",
"Nbrhd",
"Neighborhood",
"District",
"City",
"MetroArea",
"Subregion",
"Region",
"RegionAbbr",
"Territory",
"Zone",
"Postal",
"PostalExt",
"Country",
"CntryName",
"CountryCode",
"LangCode",
"Distance",
"X",
"Y",
"DisplayX",
"DisplayY",
"Xmin",
"Xmax",
"Ymin",
"Ymax",
"ExInfo",
"Provider"
],
"countryCodes": [
"PRI",
"SPM",
"MNP",
"GUM",
"ASM",
"CAN",
"VIR",
"UMI",
"MEX",
"USA"
],
"defaultOutputFields": [
"Status",
"Score",
"Match_addr",
"Addr_type"
],
"inputFields": [
"Address",
"Address2",
"Address3",
"Neighborhood",
"City",
"Subregion",
"Region",
"Postal",
"PostalExt",
"CountryCode"
],
"maxNumberOfCandidates": 50,
"minCandidateScore": 70,
"path": "C:\\data\\example.loc",
"spatialReference": {
"wkid": 4326
},
"supportedRoles": [
"Subaddress",
"PointAddress",
"StreetAddress",
"DistanceMarker",
"StreetName",
"StreetInt",
"Postal",
"Locality",
"POI"
],
"supportsAddresses": True,
"supportsIntersections": True,
"supportsPOI": True,
"userDefinedOutputFields": [],
"version": "903619 [GDM2023Q1SMP, 2023-04-09_04-42-50] (10)"
}
For more details, go to the GeoAnalytics Engine API reference for describe locator.
How Geocode works
Geocoding is the process of converting addresses into geographic coordinates that you can use to perform further analysis. The Geocode tool in GeoAnalytics Engine geocodes string values of addresses in a Spark DataFrame. This DataFrame can be created from a table (stored in a data format that is supported by Spark) that contains one or more fields specifying the address you want to geocode. The tool also requires an address locator. This tool matches the stored addresses against the locator and saves the result of each input record in an output DataFrame which contains the result columns and the input columns. The geocode process is distributed across the nodes in your Spark cluster and will be more performant with more cores.
Use cases
The following examples describe how the Geocode tool can be used for various goals:
- As a retail lead, you can geocode consumer addresses in transaction data to identify trends and propose new store locations.
- As an insurance analyst, you can detect fraudulent insurance claims by looking at the spatial relationship of geocoded property addresses and disaster footprints.
- As a property specialist, you can geocode addresses of unclaimed or abandoned houses.
For more information about how to use Geocode, see the tool documentation.
How Reverse Geocode works
Reverse geocoding is the process of converting a location as described by geographic coordinates to a readable address. The Reverse Geocode tool in GeoAnalytics Engine creates addresses from point geometries in a Spark DataFrame and returns them as string values.
The reverse geocode process is distributed across the nodes in your Spark cluster and will be more performant with more cores.
Use cases
- In the delivery tracking field, truck coordinates can be translated into addresses and matched with an expected delivery address to confirm arrival.
- The coordinates of city buses, trains, or other public transportation vehicles can be turned into addresses in order to communicate a vehicle's location quickly to riders, employees, and emergency services.
- In online retail, reverse geocoding the coordinates of a customer's location can allow you to automatically display the local currency and make location-based recommendations.
For more information about how to use Reverse Geocode, see the tool documentation.