3
votes

i am using a php script (followed this tutorial http://www.bitconsultants.net/2010/geocoding-with-google-maps-and-the-zend-framework/) to get the latitude and longitude of different adresses,

the problem is that if i manually search an address in google maps it gives me the right location, while using the php script, the json response from google is even 500meters away from the manual search result, which makes it kind of pointless for my needs...

i am passing the address in this format

$address = "{$data['street']}, {$data['postcode']}, {$data['city']}, {$data['province']}";

and i am passing google a key

thank you

2

2 Answers

1
votes

Are your addresses really well formed? Could you please give a concrete example?

Such difference could occur if the postal address is not found at given city or town and Google tries to partially match the given address. See *partial_match* on API documentation.

Also: unfortunately the link you gave above does not work here ("Forbidden" error).

1
votes

i found out why, don't use php urlencode() on the $address, it does something strange with "," and maybe other stuff, so google doesn't understands well your url