Geocoder: Problem with generated geocode

By gadefgaertgqe - December 9, 2010 - edited: December 9, 2010

Hey there!

Loving the plugin, but one issue is causing a problem.

At first some of the postcodes for the UK would not work, but I recognised the problem from a previous website, and realised that I had to set the geocode region. I was more than happy to see the option coded (and documented!) in the plugin to sort this out, so I changed it to the following:
$GLOBALS['GEOCODER_REGION'] = 'gb';

Now all postcodes are processed by Geocoder, but for some reason they are not processing correctly. The results are close and in the right local area, but are not correct.

It seems to me that the Geocoder plugin is picking up other address details and calculating from there. I want it to only use the postcode field and made the following change to the plugin:
$GLOBALS['GEOCODER_ADDRESS_FIELD_COMBOS'] = array( // values should be ", " separated. alternates should be "/" separated.
'postcode/zipcode/zip',
);


But the problem is still happening. Any ideas?

Kind Regards

Paul

Re: [Pixels & Beats] Geocoder: Problem with generated geocode

By Dave - December 9, 2010

Hi Paul,

Can you let me know what postcode you're using and the results your getting when you use the example lookup form here?

admin.php?_pluginName=geocoder&_pluginAction=examples&filename=sample_form.php

How far off are the results? If you can let me know the postcode I'll try to re-create the issue locally.

Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Geocoder: Problem with generated geocode

By gadefgaertgqe - December 10, 2010 - edited: December 10, 2010

Hi Dave,

Lets use the example in my test environment:

Postcode: LS2 9JT

Geocode from Google Maps site:
http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=LS2+9JT&sll=53.800651,-4.064941&sspn=13.962144,46.538086&ie=UTF8&hq=&hnear=Leeds+LS2+9JT,+United+Kingdom&ll=53.809572,-1.553192&spn=0.217723,0.727158&z=11

Geocode from CMSB Geocoder plugin:
http://www.addresshidden.co.uk/contact.php

I have modified the above page to also display the lat and long but for comparison purposes here are the numbers:

Google:
53.80957154683726, -1.553192138671875

CMSB:
53.821497, -1.65654

Hope this helps and thanks for looking into.

Paul

Re: [Pixels & Beats] Geocoder: Problem with generated geocode

By Chris - December 10, 2010

Hi Paul,

Can you verify that the "Sample Form with Automatic Geocoding" gives you those same numbers? Go to /cmsAdmin/admin.php?_pluginName=geocoder&_pluginAction=examples&filename=sample_form.php and enter "LS2 9JT" in the box. What numbers appear when you click Submit Form?

The numbers I get are (53.809626, -1.5537741), which are really close to your Google numbers. I get the same numbers whether I have no region set, 'uk', or 'gb'.

P.S. Google says you should use 'uk' instead of 'gb' as your region.
All the best,
Chris

Re: [chris] Geocoder: Problem with generated geocode

By gadefgaertgqe - December 10, 2010 - edited: December 10, 2010

Bingo!

Region setting was wrong. What was I thinking putting in GB?

I thought I had read it, but on going back it definatly says UK.

My bad and thanks for helping out :)

Have a great weekend!

Paul

Re: [Pixels & Beats] Geocoder: Problem with generated geocode

By Chris - December 10, 2010

Hi Paul,

I had to read that section a few times myself. :)

Glad to hear that fixed your lats and lngs!
All the best,
Chris