Geocoder anomaly

3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 25, 2019   (RSS)

By CommonSenseDesign - June 21, 2019

Hi, there.

My client's site uses the Geocoder plugin, which seems to be delivering an inaccurate response, and I can't figure out why. If you go to http://mountainoakcheese.ca/retailers-search.php and type in "stratford", you'll get results for Kingston, which is over 435 km away and is incorrect. However, if you type "stratford, on", the results are much closer.

I've checked the listings for Kingston, and none of them include the word "stratford", so I don't know why the results are coming back with way off listings.

Can anyone think of a reason why this is happening?

By daniel - June 24, 2019

Hello,

It looks like what is happening here is when searching for only "Stratford," you are getting results for Stratford, Connecticut. Which - coincidentally - is a similar distance away from Kingston as Stratford, ON. 

You can bias your Geocoder results to a specific region using the GEOCODER_REGION option in the plugin, which you can find near the top of geocoder.php. To enable bias for Canadian addresses, you can uncomment the option (Line 21 in the latest versions of the plugin) and use the "ca" region code to look like this:

$GLOBALS['GEOCODER_REGION'] = 'ca';

Give that a shot and let me know if it helps with your issue, or if you have any other questions.

Thanks!

Daniel
Technical Lead
interactivetools.com

By CommonSenseDesign - June 25, 2019

That worked! Thanks for the suggestion and advice.