Run Geocoder on update profile

3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: May 15, 2017   (RSS)

By ross - May 15, 2017

Hi Tim

Thanks for posting.

The Geocode plugin has a function called "geocodeAddress($address)".

You could pass the submitted address on your profile page to that function and get back an array of (lat, long) and add them to the database.

The code would look something like this:

list($lat, $lng) = geocodeAddress(@$_REQUEST['address']);

You'll also want to review the notes from the plugin about this function:

// list($lat, $lng) = geocodeAddress($address);
// Address can be zipcode or more formal address should be in the format.  See: http://code.google.com/apis/maps/faq.html#geocoder_queryformat
// Note: Usage subject to Google Maps API Terms here: http://code.google.com/apis/maps/terms.html#section_10_12
// Note: You must be using google maps on your site to use their API, but caching results is allowed for performance, etc
// Note: Daily rate limits and throttling rules may apply.  See: http://code.google.com/apis/maps/faq.html#geocoder_limit
// Note: More details API docs can be found here: http://code.google.com/apis/maps/documentation/geocoding/
// Note: Example code for delaying requests after being throttled: http://code.google.com/apis/maps/articles/phpsqlgeocode.html

We can help with getting this setup in consulting if you like. Just email me via consulting@interactivetools.com

Let me know any questions.

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Toledoh - May 15, 2017

Thanks Ross!

Cheers,

Tim (toledoh.com.au)