Geocoding

In Summer '16 Automatic Geocoding of data was released. Cool - but how do we use it, and why. 

Issues

Standard Geocode fields can not be added to page layouts. This is because the Geocode fields are part of the Compound Address Field.

I have never seen an Australian address get more accurate than Block, whereas US addresses get Address level accuracy. Wierd, but not surprising. 

Documentation

Setup

  • Set up the Geocode Clean Rules
    • Leads
    • Accounts x 2 Addresses
    • Contacts x 2 Addresses
  • I would not bother adding the clutter of the Clean results to the Related Lists on the Page Layouts

Formulas

  • Now add a Formula on the following objects to display the Geocode Accuracy as per https://help.salesforce.com/apex/HTViewSolution?id=000231046
    • Leads. Formula: TEXT(GeocodeAccuracy)
    • Accounts - Shipping Address (or Physical Address - whichever you have named it). Formula: TEXT(ShippingGeocodeAccuracy)
    • Contacts - Shipping Address (or Physical Address or Home Address - whichever you have named it). Formula: TEXT(OtherGeocodeAccuracy)

  • You may want to add Lat and Lon also if your users would make use of it. 
  • Add the field below the relevant Address field on each Page Layout - remembering to add it to all Page Layouts if you have more than one for each Object. 
  • You may want to expand your formula to (based on State and Country picklists being enabled). 
IF(NOT(ISBLANK(TEXT(ShippingStateCode))),TEXT(ShippingGeocodeAccuracy),TEXT(BillingGeocodeAccuracy))

Now What

So you want to know what to do with this magical Geocoding now? Well, I'm not even sure myself. I remember way back when maps first came out on Charts on Excel and they were so useless because they only worked for the US and they required too much data for them to work. So I think at that point I gave up on maps as a relevant feature. 

But I have clients now that do work in all countries of the world, and they want to know things about things, so I guess I'd better learn these things. 

So, is it useful to have a Distance from the head office of this country to this location? What would that mean even? If you don't have a tool like http://www.geopointe.com/ what would an as-the-crow-flies distance measurement even do for you? 

Distance

From the documentation. 

DISTANCE formulas are supported in:

  • Entry criteria for workflow rules and approval processes
  • Field update actions in workflow rules and approval processes
  • Custom validation rules
  • Lookup filters (in the Metadata API only)

Ooh this is an interesting one from the Developer docs

The DISTANCE function is fine for calculating the 10 stores closest to a customer’s current location. But don’t fuel your plane for a flight from San Francisco to Sydney based on it.

You can only calculate if a location is further away or closer to another location - not if it's equal to that location - I guess that makes sense because what even does equality mean when they could be in opposite directions away. 

 

So here is a nice post from Gorav Seth on how he added fields onto the User record to set the User's location and then be able to report on Accounts closest to that user's location Geocode all the Records • Gorav Seth