Devo cercare Goolge Places Pages per long/lat per qualsiasi banca nell'area di 20m. Questo Google Places Doc descrive come farlo con JavaScript. Stanno usando un oggetto google.maps.LatLng
che non ho in Java.Come inviare una richiesta di ricerca di Google Places con Java
Qualcuno ora come chiamare il servizio?
Forse c'è anche un'API Java per Goolge Places?
Cordiali saluti, Cristiano.
Edit 1:
ho trovato someone costruzione del URL come questo:
String url = baseUrl + "location=" + lat + "," + lon + "&" +
"radius=" + searchRadius + "&" + types + "&" + "sensor=true" +
"&" + "key=" + googleAPIKey;
Risposta: Edit 2:
io a causa del post di cui sopra ho trovato il modo di farlo. Questo è un esempio di come inviare la richiesta:
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);
}
}
Grazie per avermi salvato la vita :) – Kunal
Grazie mille !!! –