Example usage for com.google.gwt.maps.client.geocode Geocoder getLatLng

List of usage examples for com.google.gwt.maps.client.geocode Geocoder getLatLng

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.geocode Geocoder getLatLng.

Prototype



public void getLatLng(String address, final LatLngCallback callback) 

Source Link

Document

Sends a request to Google servers to geocode the specified address.

Usage

From source file:com.apress.progwt.client.util.BulkGeoCoder.java

License:Apache License

@Override
public void run() {

    final HasAddress school = schools.remove(0);
    if (school == null) {
        Log.debug("Finished");
        cancel();/* w  w  w  . j a v a 2 s .co  m*/
        return;
    }
    final String full = school.getFullAddress();
    Geocoder geocoder = new Geocoder();
    geocoder.getLatLng("1600 pennsylvania avenue, washington dc", new LatLngCallback() {
        public void onFailure() {
        }

        public void onSuccess(LatLng point) {
        }
    });

    geocoder.getLatLng(full, new LatLngCallback() {
        public void onFailure() {
            Log.debug("UPDATE " + tablename + " SET latitude = '-1',longitude  = '-1' WHERE id ="
                    + school.getId() + " LIMIT 1 ;");
            run();
        }

        public void onSuccess(LatLng point) {

            Log.debug("UPDATE " + tablename + " SET latitude = '" + point.getLatitude() + "',longitude  = '"
                    + point.getLongitude() + "' WHERE id =" + school.getId() + " LIMIT 1 ;");
            run();
        }
    });
}