Question

I have been using the Google geocoding API for returning the coordinates of a place using the URL: http://maps.googleapis.com/maps/api/geocode/json?address=Saints%20Peter%20&%20Paul%20Parish%204070%20Central%20Parkway%20East,%20Mississauga,%20L4Z%201T6,+CA&sensor=false

The Address of the place is:

Saints Peter & Paul Parish, 4070, Central Parkway East, Mississauga, L4Z 1T6.

When searching in Google maps it returns the correct position, but when using the above URL to get Coordinates in JSON format, it returns some coordinates in Miami, USA, whereas my address is in Mississauga, Canada.

This is the actual location when searching the same adderss in Google Maps: https://www.google.co.in/maps/preview#!q=Saints+Peter+%24+Paul+Parish%2C+204070%2C+Central+Parkway+East%2C+Mississauga%2C+L4Z+1T6&data=!4m10!1m9!4m8!1m3!1d126887!2d76.3082933!3d9.9822827!3m2!1i1600!2i775!4f13.1

but the coordinates returned are 25.7598220, -80.2133820, which is in Maimi

Was it helpful?

Solution

The returned result is equal to http://maps.googleapis.com/maps/api/geocode/json?address=Saints%20Peter%20&sensor=false

you need to encode the ampersand too (with %26) , otherwise everything that follows the ampersand will be taken as a new parameter and not as part of address

correct result: http://maps.googleapis.com/maps/api/geocode/json?address=Saints%20Peter%20%26%20Paul%20Parish%204070%20Central%20Parkway%20East,%20Mississauga,%20L4Z%201T6,%20CA&sensor=false

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top