Hi Vinay,
I tried the code below, which works well except when I include the
'request.setUnitSystem("METRIC");' line which results in an error:
com.google.gwt.core.client.JavaScriptException: (Error): Invalid value
for property <unitSystem>: METRIC
Also can you please tell me when might this project be merged into gwt-
google-apis?
Thanks
stephen
private void getDuration() {
DirectionsRequest request = new DirectionsRequest();
request.setDestinationString("penn station, new york, ny");
request.setOriginString("grand central station, new york, ny");
request.setTravelMode("DRIVING");
request.setUnitSystem("METRIC");
DirectionsService dirService = new DirectionsService();
dirService.route(request, new DirectionsCallback() {
@Override
public void callback(HasDirectionsResult response, String status) {
if (status.equals("OK")) {
DirectionsLeg dl = (DirectionsLeg) response.getRoutes()
.get(0).getLegs().get(0);
System.out.println("Distance: "
+ dl.getDistance().getText() + "; Duration: "
+ dl.getDuration().getText());
}
}
});