/// <summary> /// Creates a map with forecast info and suggests whether to drink beer there or not. /// </summary> /// <param name="location">Location query string.</param> /// <param name="blobName">Blob name on Azure blob storage.</param> /// <returns>ImageFile object with blob name.</returns> private async Task <ImageFile> CreateMap(string location, string blobName) { SearchAddressResult result = _mapServices.SearchAddress(location); ImageFile imageFile = _mapServices.GetMapImage(result.Position.Lon, result.Position.Lat, _mapZoom, blobName); // Add the weather report to the map WeatherReport weatherReport = await _openWeatherService.GetWeatherReport(result.Position.Lat, result.Position.Lon); imageFile.Bytes = AddReportToMap(imageFile.Bytes, weatherReport); return(imageFile); }
/// <summary> /// Searches an address for a given location query. /// </summary> /// <param name="location"> Location query input. </param> /// <returns> The first match. In the case of no matches, null. </returns> public SearchAddressResult SearchAddress(string location) { SearchAddressResult result = null; var am = new AzureMapsToolkit.AzureMapsServices(config.Key); var searchAddressRequest = new SearchAddressRequest { Query = location, Limit = 10 }; var resp = am.GetSearchAddress(searchAddressRequest).Result; if (resp.Error == null && resp.Result.Results.Length > 0) { result = resp.Result.Results[0]; } return(result); }