0

How can I find the coordinates of a pharmacy by it name and location?

I'm trying to search with the Google geocode API like this:

var pharmacyName = "Farmácia Ereirense";
var address = "Cartaxo, Santarém";

var url = "http://maps.googleapis.com/maps/api/geocode/xml?address=" + pharmacyName + ", " + address + "&sensor=false";

but I only got ZERO_RESULTS on the GeoResponse Status, and if I google "Farmácia Ereirense, Cartaxo, Santarém" it found the right location...

I already tried to do:

var pharmacyName = "Farmácia Ereirense";
var address = "Cartaxo, Santarém";

var url = "https://maps.googleapis.com/maps/api/place/nearbysearch/xml?name=" + pharmacyName + ", " + address + "&key=" + apiKey;

but I got the INVALID_REQUEST result.

Documentation I based on

1

Finally I found the solution! We can do a Text Search request like this:

var pharmacyName = "Farmácia Ereirense";
var address = "Cartaxo, Santarém";

var url = "https://maps.googleapis.com/maps/api/place/textsearch/xml?query=" + pharmacyName + ", " + address + "&key=" + apiKey;

And it works just fine, like Google's search.

Documentation

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.