use of com.google.maps.errors.ApiException in project amos-ss17-alexa by c-i-ber.
the class GeoCoder method getLatLng.
/**
* converts address to geo code to perform place search
* @param address device address
* @return LatLng of device
*/
public static LatLng getLatLng(Address address) {
GeoApiContext context = new GeoApiContext().setApiKey(GOOGLE_MAP_API_KEY);
GeocodingResult[] results = null;
try {
//log.info("Address: " + encoded);
results = GeocodingApi.geocode(context, "Nürnberg 90459 Bulmannstraße 44").await();
} catch (ApiException | InterruptedException | IOException e) {
e.printStackTrace();
}
assert results != null : "GeoCoder could not convert address to lat lang!";
return results[0].geometry.location;
}
Aggregations