Wie Sie ein Google Places-Search-Request mit Java

Ich Suche Goolge Places-Seiten durch die long/lat für alle Banken in der Gegend von 20m.
Diese Google Places-Doc beschreibt, wie es zu tun mit JavaScript. Sie werden mit einem google.maps.LatLng Objekt, dass ich nicht in Java.

Hat jemand nun, wie nennen die Service?

Vielleicht gibt es auch eine Java-API für Google Places?

Beste Grüße,
Christian.

Edit 1:

Fand ich jemand Bau der url wie diese:

String url = baseUrl + "location=" + lat + "," + lon + "&" +
                 "radius=" + searchRadius + "&" + types + "&" + "sensor=true" +
                 "&" + "key=" + googleAPIKey;

Antwort: Edit 2:

Ich, weil der Beitrag oben fand ich heraus, wie es zu tun. Dies ist ein Beispiel, wie um die Anfrage zu senden:

public class GooglePlacesClient
{
    private static final String GOOGLE_API_KEY  = "***";

    private final HttpClient    client          = new DefaultHttpClient();

    public static void main(final String[] args) throws ParseException, IOException, URISyntaxException
    {
        new GooglePlacesClient().performSearch("establishment", 8.6668310, 50.1093060);
    }

    public void performSearch(final String types, final double lon, final double lat) throws ParseException, IOException, URISyntaxException
    {
        final URIBuilder builder = new URIBuilder().setScheme("https").setHost("maps.googleapis.com").setPath("/maps/api/place/search/json");

        builder.addParameter("location", lat + "," + lon);
        builder.addParameter("radius", "5");
        builder.addParameter("types", types);
        builder.addParameter("sensor", "true");
        builder.addParameter("key", GooglePlacesClient.GOOGLE_API_KEY);

        final HttpUriRequest request = new HttpGet(builder.build());

        final HttpResponse execute = this.client.execute(request);

        final String response = EntityUtils.toString(execute.getEntity());

        System.out.println(response);
    }

}

InformationsquelleAutor d0x | 2012-09-17

Schreibe einen Kommentar