Enable Geocoding¶
Overview¶
Geocoding resolves an address to a point on the map. AddressTools returns the latitude and longitude of a verified address, together with a geocode accuracy value recording how precisely those coordinates pinpoint it. Coordinates on the record let you place it on a map, calculate distances, plan territories, and drive location-based automation.
Geocoding runs as part of address verification, so the location fields populate at the point an address is verified and at no other time. The coordinates do not follow the same rules as the rest of the returned address, though: they are written whenever the service returns a latitude, even where the address itself was not matched closely enough for its other values to be updated. See When Coordinates Are Written.
Note: Geocoding lookups are purchased separately from address verification lookups, so an org that can verify addresses does not necessarily have geocoding. If your org does not hold geocoding lookups, contact sales@provenworks.com.
Compared With Salesforce Geocoding¶
Salesforce's own geocoding runs asynchronously in the background and covers particular standard objects. AddressTools returns coordinates as part of the verification response, on any object where you have configured an address block, so the values are there as soon as the address is verified.
Before You Start¶
The object needs three fields to hold the values. Standard Salesforce address fields already include latitude, longitude and geocode accuracy components. For a custom address you create them yourself. See Create a Geolocation Field and Create a Geocode Accuracy Field.
Verification also has to be working on that address block, since coordinates arrive with the verified address. See Verification.
Step 1: Map the Location Fields¶
There is no separate switch for geocoding. Mapping the fields on the address block enables it.
Note: The address blocks supplied out of the box already have their location fields mapped to the standard latitude, longitude and geocode accuracy components. Confirm the mapping rather than creating it if you are working with those blocks.
- Click the App Launcher to search for and select AddressTools Administration.
- Select Address Blocks from the left menu.
- Open the block for this address by using the dropdown to select Edit.
- In the Location Fields section, set:
- Latitude Field, for example
BillingLatitude - Longitude Field, for example
BillingLongitude - Geocode Accuracy Field, for example
BillingGeocodeAccuracy
- Latitude Field, for example
- Click Save.
Repeat for each address block where you want coordinates stored.
Step 2: Confirm the Configuration¶
Mapping the location fields is not enough on its own: verification must also be enabled for the org and for this address block before anything populates, so complete the steps in Verification first.
- Verify an address, either through PowerSearch or one of the automated options.
- Look at the latitude and longitude fields on the record.
Note: PowerSearch returns Unknown in the geocode accuracy field. The other verification methods return a specific accuracy level, so use a batch or flow run if you want to check that part.
When Coordinates Are Written¶
Coordinates behave differently from the rest of the returned address. They are written whenever verification returns a latitude, whatever the address status, so a record can gain coordinates even where the address itself was not verified well enough for its other values to be updated.
If an address only partially matches, the coordinates point at the closest match found rather than at the address itself. The accuracy value records that difference. It runs from Address at the most precise, through street and postal code levels, down to State, with Unknown where no accuracy was returned. See Create a Geocode Accuracy Field for the full list.
Note: Editing an address resets its status to Not checked on save, and clears the latitude, longitude and geocode accuracy fields at the same time. The coordinates describe the address that was verified, so they do not survive a change to that address. Where a user edited the coordinates directly, those values are kept and the accuracy is set to Unknown. This behaviour requires an address status field mapped on the block.