Geolocation searching

I’m researching location search (ultimately on a site). For example’s sake, the problem is to dynamically show a user what stores are w/in a certain distance (say miles) of a postal code that they enter. I’d probably have a few fixed options: 5, 10, 15, 25, 50, 50+ miles.

I’m wondering if the Geolocation pilot feature would be useful. I can’t get access to the pilot and I don’t see public API docs. The blog post shows the Geolocation object taking longitude and latitude parameters. Is there a Constructor that takes postal codes? Or, a recommended way of getting longitude and latitude from postal code?

I’m curious how other people solve this within Salesforce with or without the Geolocation object. Also, are there limitations and/or governor limits that people have hit and/or worry about in their solutions?


I’ve used Google Maps API to GeoCode data into Latitude and Longitude fields in SFDC. You then have to use a Google Maps Mashup to display the SFDC records based on SOQL queries. This was before SFDC offered Lat/Lon fields and SOQL calls for distance. Back then you had to use a bounding box algorithm with SOQL to find the records.

I have opensource code here:
You can look at my Dreamforce 2011 Presentation here which has details:

Note: Minutes 9:30 – about 14 detail how to use GeoCoding Service and LAt/lon fields on your Object.

Also you can take a look at FindNearby on the AppExchange from Labs.

You’ll have to use a GeoCoding service obviously as everyone else said above, either Google Maps which is free but limited to 2500 GeoCoded Records per Day as well as T&C that requires you to display in Google Map Mashup. My source code and video show you how to get started with GeoCoding. Or you could go and purchase a product like ArrowPointe or a few others on the AppExchange that do just GeoCoding.

Finally, here are the Google GeoCoding Docs:

Good Luck!

Source : Link , Question Author : Peter Knolle , Answer Author : CoryCowgill

Leave a Comment