Example usage for com.google.gwt.maps.client.services ElevationStatus UNKNOWN_ERROR

List of usage examples for com.google.gwt.maps.client.services ElevationStatus UNKNOWN_ERROR

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.services ElevationStatus UNKNOWN_ERROR.

Prototype

ElevationStatus UNKNOWN_ERROR

To view the source code for com.google.gwt.maps.client.services ElevationStatus UNKNOWN_ERROR.

Click Source Link

Document

A geocoding, directions or elevation request could not be successfully processed, yet the exact reason for the failure is not known.

Usage

From source file:com.google.gwt.maps.testing.client.maps.ElevationMapWidget.java

License:Apache License

private void findElevation(LatLng point) {

    LatLng[] a = new LatLng[] { point };

    JsArray<LatLng> locations = ArrayHelper.toJsArray(a);

    LocationElevationRequest request = LocationElevationRequest.newInstance();
    request.setLocations(locations);// w ww .  ja v  a2  s.  c om

    ElevationService o = ElevationService.newInstance();
    o.getElevationForLocations(request, new ElevationServiceHandler() {
        @Override
        public void onCallback(JsArray<ElevationResult> result, ElevationStatus status) {

            if (status == ElevationStatus.INVALID_REQUEST) {

            } else if (status == ElevationStatus.OK) {
                ElevationResult e = result.get(0);
                double elevation = e.getElevation();
                LatLng location = e.getLocation();
                @SuppressWarnings("unused")
                double res = e.getResolution();

                GWT.log("worked elevation=" + elevation);
                drawInfoWindow(location, elevation);

            } else if (status == ElevationStatus.OVER_QUERY_LIMIT) {

            } else if (status == ElevationStatus.REQUEST_DENIED) {

            } else if (status == ElevationStatus.UNKNOWN_ERROR) {

            }

            GWT.log("elevation request finished");
        }
    });
}