Reputation: 1
I am working on a java program where I use text search and directions api, but somehow api's are not working correctly in some cases.
For example: I have to search "restaurants" near Hyundai Car Center,Sector 63, Noida
.
For this I have used the text search api to get the formatted address of the required restaurant. Now when I used direction api to calculate the shortest time and distance between the locations, I did not find any result.
String addressFrom = "Mother Dairy, Bhim Nagri, Hauz Khas, New Delhi, India";
String addressTo = "Hyundai Car Center,Sector 63,Noida";
String urlString = "http://maps.googleapis.com/maps/api/directions/xml?sensor=true&origin="
+ addressFrom + "&destination=" + addressTo;
System.out.println(urlString);
I am getting the following output:
http://maps.googleapis.com/maps/api/directions/xml?sensor=true&origin=Mother+Dairy%2C+Bhim+Nagri%2C+Hauz+Khas%2C+New+Delhi%2C+India&destination=Hyundai+Car+Center%2CSector+63%2CNoida
<?xml version="1.0" encoding="UTF-8"?>
<DirectionsResponse>
<status>NOT_FOUND</status>
</DirectionsResponse>
Upvotes: 0
Views: 594
Reputation: 12973
The problem is that "Mother Dairy, Bhim Nagri, Hauz Khas, New Delhi, India" cannot be found. You can test whether the endpoints can be found by entering them (one at a time) in the Google Geocoder Sample page.
However, "Bhim Nagri, Hauz Khas, New Delhi, India" can be found, and is fairly close to where "Mother Dairy" is marked on the map.
Upvotes: 1