Find your content:

Search form

You are here

Geolocation searching

 
Share

I'm researching location search (ultimately on a Force.com 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?


Attribution to: Peter Knolle

Possible Suggestion/Solution #1

I've heard some rather credible rumors that this might be a public beta (or even a GA if we're really lucky) in the next release of salesforce. I'd advise signing up for a prerelease sandbox and crossing your fingers for the moment.

As far as I know it won't support postal codes out of the box, you'd probably need a 3rd party service to resolve them into lat/long.


Attribution to: ca_peterson

Possible Suggestion/Solution #2

I've messed with the pilot. It's just a field type for lat/lon. Salesforce does not supply any data to you or turn an address into a lat/lon (geocoding). If you are able to populate the data, then you can use SOQL to do things like find records within X miles of another.

Our app, Geopointe, can help with this kind of thing right now and includes geocoding.


Attribution to: hemmeter

Possible Suggestion/Solution #3

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: https://github.com/corycowgill/sfbusradar You can look at my Dreamforce 2011 Presentation here which has details: http://www.youtube.com/watch?v=wwTdGqOygBQ

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 Force.com 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: https://developers.google.com/maps/documentation/geocoding/

Good Luck!


Attribution to: CoryCowgill
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/388

My Block Status

My Block Content