I’m building a web app that uses the Google Maps Directions API to calculate routes between multiple addresses. The app works fine for most addresses, but for some inputs like:
Dolores 33, Buenos Aires, Argentina
or
Portela 61, C1406FDA Cdad. Autónoma de Buenos Aires, Argentina
…the API does not return an error, but it returns a generic or imprecise result, such as just: Buenos Aires, Argentina
This causes issues when trying to map precise routes — the origin or destination ends up being too vague or completely incorrect.
What I’m doing
- Users can enter addresses manually or import them from Excel.
- I use the Geocoder API to validate addresses before routing.
- Then I pass them to
DirectionsService.route().
Here’s how I validate the address first (simplified):
const geocoder = new google.maps.Geocoder();
geocoder.geocode(
{
address: "Dolores 33, Buenos Aires, Argentina",
componentRestrictions: { country: "ar" }
},
(results, status) => {
if (status === google.maps.GeocoderStatus.OK && results.length > 0) {
console.log("VALID:", results[0].formatted_address);
} else {
console.warn("INVALID:", status);
}
}
);
Then I use Directions API like this (simplified):
const directionsService = new google.maps.DirectionsService();
directionsService.route(
{
origin: "Dolores 33, Buenos Aires, Argentina",
destination: "Some other address...",
travelMode: google.maps.TravelMode.DRIVING
},
(response, status) => {
if (status === google.maps.DirectionsStatus.OK) {
// Success
} else {
console.error("Directions error:", status);
}
}
);
What I expected
I expected the Directions API to either:
use the full, specific address if it exists, or
return a clear error if it can’t find a match.
What happens instead
It returns an imprecise or vague result, often just “Buenos Aires, Argentina”.
This leads to incorrect routes or routes starting/ending in the wrong place.
My questions
Is this behavior expected?
Why would the Directions API ignore a more specific address and resolve to something vague?
Is there any reliable workaround (e.g., forcing coordinates, refining geocoding before routing, etc.)?
Any help is appreciated — especially from others working with addresses in Argentina or Latin America in general. Thanks!