public async Task <Address> ReverseGeocodingFromPlaceId(string placeId) { if (string.IsNullOrEmpty(placeId)) { return(null); } var request = new GeocodingRequest { Address = new PlaceIdLocation(placeId) }; var response = await _geocodingService.GetResponseAsync(request); if (response.Status != ServiceResponseStatus.Ok) { return(null); } var address = response.Results.FirstOrDefault(); if (address == null) { return(null); } var location = address.Geometry.Location; return(new Address { FormattedAddress = address.FormattedAddress, Location = new Location(location.Latitude, location.Longitude) }); }
private void CenterOnPosition(string addressText) { try { if (addressText.Count() > 5) { var request = new GeocodingRequest { Key = MiscStuff.googleApiKey, Address = addressText }; var result = GoogleMaps.Geocode.Query(request); if (result.Status == Status.Ok) { var geocodeResult = result.Results.FirstOrDefault(); if (geocodeResult != null) { textBoxAddress.Text = addressText; gmap.Position = new PointLatLng(geocodeResult.Geometry.Location.Latitude, geocodeResult.Geometry.Location.Longitude); } } } else { gmap.Position = new PointLatLng(perthLatitude, perthLongitude); } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } }
protected void btnTestar_Click(Object sender, EventArgs e) { var geocodingRequest = new GeocodingRequest { Location = new Location(-19.904356, -43.925691) }; GeocodingResponse geocodingResponse = GoogleMaps.Geocode.Query(geocodingRequest); if (geocodingResponse != null && geocodingResponse.Status == Status.OK) { var drivingDirectionRequest = new DirectionsRequest { Origin = ObterEndereco(geocodingResponse), Destination = "Avenida Amazonas 7000, Belo Horizonte, MG, Brazil", Sensor = false, Alternatives = false }; DirectionsResponse drivingDirections = GoogleMaps.Directions.Query(drivingDirectionRequest); if (drivingDirections != null && drivingDirections.Status == DirectionsStatusCodes.OK) { lblDistancia.Text = string.Format("Distância Total: {0} m.", ObterDistanciaTotal(drivingDirections).ToString()); } } }
// the private function that does all the 'hard work' for querying address private string getAddressPartByType(string i_Address, AddressType i_AddressType) { string addressPart = string.Empty; var request = new GeocodingRequest(); request.Address = i_Address; request.Sensor = "false"; var response = GeocodingService.GetResponse(request); if (response.Status == ServiceResponseStatus.Ok) { var components = response.Results[0].Components; foreach (AddressComponent addressComponent in components) { foreach (AddressType addressType in addressComponent.Types) { if (addressType == i_AddressType) { addressPart = addressComponent.LongName; } } } } return(addressPart); }
public void MakeRequest(string text, Action complete) { if (IsInProgress) { return; } IsInProgress = true; Task.Run(delegate { var request = new GeocodingRequest(Projection, text); GeocodingResultVector results = Service.CalculateAddresses(request); int count = results.Count; Addresses.Clear(); for (int i = 0; i < count; i++) { GeocodingResult result = results[i]; Addresses.Add(result); } IsInProgress = false; complete(); }); }
public IEnumerable <string> asearch_test(double lon, double lan) { var address = "منطقة اللاذقية" + "," + "اللاذقية"; // string s_address = "," + "اللاذقية"; var locationService = new GoogleLocationService(); // GoogleMaps.LocationServices.GoogleLocationService r = locationService.GetRegionFromLatLong(lat, lon); // LocationServices r = new GoogleMaps.LocationServices(); // r= locationService.GetRegionFromLatLong(lat, lon); var g = new GeocodingRequest(); var address_gps = g.Address = address; // g.Region = r.Name; g.Sensor = false; g.Language = "ar"; var response = new GeocodingService().GetResponse(g); var point = locationService.GetLatLongFromAddress(address); AddressData a = locationService.GetAddressFromLatLang(lon, lan); // Directions dir= locationService.GetDirections(point.Latitude, point.Longitude); var s = _ClassifyService.search_test(lon.ToString() + "," + lan.ToString()); //yield return response.Results[0].PlaceId; return(s); // yield return locationService.GetAddressFromLatLang(5 , lon).Address; // return "s"; // return _ClassifyService.search_test(town); }
public ActionResult <ExpandoObject> TestMaps() { //always need to use YOUR_API_KEY for requests. Do this in App_Start. //GoogleSigned.AssignAllServices(new GoogleSigned("AIzaSyBrQ-Pb3As0dKkt1iPsxL9IOr-Nfk3E1Cc")); var request = new GeocodingRequest(); request.Address = "San Isidro de El Guarco, Cartago"; var response = new GeocodingService().GetResponse(request); //The GeocodingService class submits the request to the API web service, and returns the //response strongly typed as a GeocodeResponse object which may contain zero, one or more results. dynamic data = new ExpandoObject(); //Assuming we received at least one result, let's get some of its properties: if (response.Status == ServiceResponseStatus.Ok && response.Results.Count() > 0) { var result = response.Results.First(); //Console.WriteLine("Full Address: " + result.FormattedAddress); // "1600 Pennsylvania Ave NW, Washington, DC 20500, USA" data.fullAddress = result.FormattedAddress; //Console.WriteLine("Latitude: " + result.Geometry.Location.Latitude); // 38.8976633 data.latitude = result.Geometry.Location.Latitude; //Console.WriteLine("Longitude: " + result.Geometry.Location.Longitude); // -77.0365739 data.longitude = result.Geometry.Location.Longitude; //Console.WriteLine(); return(data); } else { return(StatusCode(StatusCodes.Status409Conflict)); //Console.WriteLine("Unable to geocode. Status={0} and ErrorMessage={1}", response.Status, response.ErrorMessage); } }
public Task <FetchResponse <Results <Geocoding> > > Geocoding( GeocodingRequest request, string key) { var @params = new List <(string, object)>(); if (!string.IsNullOrEmpty(request.address)) { @params.Add(("address", request.address)); } if (!string.IsNullOrEmpty(request.components)) { @params.Add(("components", request.components)); } if (!string.IsNullOrEmpty(request.bounds)) { @params.Add(("bounds", request.bounds)); } if (!string.IsNullOrEmpty(request.language)) { @params.Add(("language", request.language)); } if (!string.IsNullOrEmpty(request.region)) { @params.Add(("region", request.region)); } return(this.httpClient.ExecuteGet <Results <Geocoding> >( Utils.GetApiUrl(GECODING_URLS, key, @params))); }
private GeocodingResponse GetGeocodeResponse(ILocation where) { var cacheKey = where.Name.ToString() + "-geocoding"; var cachedVal = FindInCache <GeocodingResponse>(cacheKey); if (cachedVal != null) { return(cachedVal); } GeocodingRequest geocodeRequest = new GeocodingRequest() { Address = where.Name, }; geocodeRequest.ApiKey = this.apikey; var geocodingEngine = GoogleMaps.Geocode; GeocodingResponse geocode = geocodingEngine.Query(geocodeRequest); if (geocode.Status == Status.OK) { return(AddToCache(cacheKey, geocode)); } return(null); }
public static Evenement GetCoordonnees(String adresse) { var request = new GeocodingRequest(); request.Address = adresse; var response = new GeocodingService().GetResponse(request); //The GeocodingService class submits the request to the API web service, and returns the //response strongly typed as a GeocodeResponse object which may contain zero, one or more results. Evenement depart = new Evenement(); depart.EVENT_NAME = "Point de départ"; //Assuming we received at least one result, let's get some of its properties: if (response.Status == ServiceResponseStatus.Ok && response.Results.Count() > 0) { var result = response.Results.First(); depart.LATITUDE = result.Geometry.Location.Latitude; depart.LONGITUDE = result.Geometry.Location.Longitude; depart.ADRESSE = result.FormattedAddress; } else { depart.ADRESSE = String.Format("Unable to geocode. Status={0} and ErrorMessage={1}", response.Status, response.ErrorMessage); } return(depart); }
public string GetCoordinates(ref string longitude, ref string latitude, string addressFrom) { string google_api_key = System.Configuration.ConfigurationManager.AppSettings["google_api_key"]; try { GoogleSigned.AssignAllServices(new GoogleSigned(google_api_key)); var request = new GeocodingRequest(); request.Address = addressFrom; var response = new GeocodingService().GetResponse(request); //Assuming we received at least one result, let's get some of its properties: if (response.Status == ServiceResponseStatus.Ok && response.Results.Count() > 0) { var result = response.Results.First(); longitude = result.Geometry.Location.Longitude.ToString(); latitude = result.Geometry.Location.Latitude.ToString(); return("success"); } else { throw new System.ArgumentException(); } } catch (Exception ex) { string strError = ""; strError = "No Longitude/Latitude Found for " + addressFrom + ". Please enter a valid City, State."; return(strError); } }
public void Issues_Issue11898() { GeocodingRequest request = new GeocodingRequest("4 Cassia Ct, Alice Springs, Northern Territory, 0870, Australia"); GeocodingResponse response = request.GetResponse(); Assert.AreEqual(GeocodingResponseStatus.OK, response.Status); }
public void Issues_Issue13038() { GeocodingRequest request = new GeocodingRequest("Yonge and Finch Toronto Canada Ontario"); GeocodingResponse response = request.GetResponse(); Assert.AreEqual(GeocodingResponseStatus.OK, response.Status); }
public void Issues_Issue14376() { var request = new GeocodingRequest("BH5 1DP"); var response = request.GetResponse(); Assert.AreEqual(GeocodingResponseStatus.OK, response.Status); }
GetCoordinates(string address) { MapsCoordinatesBindingModel result = new MapsCoordinatesBindingModel(); GoogleSigned.AssignAllServices( new GoogleSigned(CommonSecurityConstants .GoogleMapsApiKey)); GeocodingRequest request = new GeocodingRequest(); request.Address = new Location(address); GeocodeResponse response = await Task.Run(() => { return(new GeocodingService() .GetResponseAsync(request).Result); }); if (response.Status == ServiceResponseStatus.Ok && response.Results.Count() > 0) { Result placeResult = response .Results.FirstOrDefault(); result.Lat = placeResult.Geometry .Location.Latitude; result.Lng = placeResult.Geometry .Location.Longitude; } return(result); }
public LocationDto GetLocalization(DataDto dto) { IConfigurationSection googleMapsSection = _configuration.GetSection("Integrations:Google"); var apiKey = googleMapsSection["ApiKey"]; GoogleSigned.AssignAllServices(new GoogleSigned(apiKey)); var request = new GeocodingRequest { Address = dto.Address }; var response = new GeocodingService().GetResponse(request); var result = response.Results.FirstOrDefault(); if (result != null) { return(new LocationDto { Latitude = result.Geometry.Location.Latitude, Longitude = result.Geometry.Location.Longitude }); } return(null); }
public object Post(GeocodingRequest request) { if ((request.Lat.HasValue && request.Lng.HasValue && !request.Name.IsNullOrEmpty()) || (!request.Lat.HasValue && !request.Lng.HasValue && request.Name.IsNullOrEmpty())) { throw new HttpError(HttpStatusCode.BadRequest, "400", "You must specify the name or the coordinate"); } // Get current language var language = CultureInfo.CurrentUICulture.Name; if (this.GetSession() != null && this.GetSession().UserAuthId != null) { var account = _accountDao.FindById(new Guid(this.GetSession().UserAuthId)); if (account != null) { language = account.Language; } } if (request.Name.HasValue()) { return(_geocoding.Search(request.Name, request.Lat, request.Lng, language, request.GeoResult)); } // ReSharper disable PossibleInvalidOperationException return(_geocoding.Search(request.Lat.Value, request.Lng.Value, language, request.GeoResult)); // ReSharper restore PossibleInvalidOperationException }
public PointLatLng?GetPoint(string keywords, out GeoCoderStatusCode status, out float accuracy) { PointLatLng?coordinate = null; accuracy = 0f; var request = new GeocodingRequest { Address = keywords, Sensor = false }; var response = _geocodingService.GetResponse(request); status = GoogleMapWrapper.ToGeoCoderStatusCode(response.Status); if (response.Results.Any()) { var geometry = response.Results[0].Geometry; coordinate = GoogleMapWrapper.ToPointLatLng(geometry.Location); accuracy = GoogleMapWrapper.ToAccuracyValue(geometry.LocationType); } return(coordinate); }
public void GeocodingWhenAddressTest() { var request = new GeocodingRequest { Address = "285 Bedford Ave, Brooklyn, NY 11211, USA" }; var result = GoogleMaps.Geocode.Query(request); Console.WriteLine(result.RawJson); Assert.IsNotNull(result); Assert.AreEqual(Status.Ok, result.Status); var geocodeResult = result.Results.FirstOrDefault(); Assert.IsNotNull(geocodeResult); Assert.AreEqual(40.7140415, geocodeResult.Geometry.Location.Latitude, 0.001); Assert.AreEqual(-73.9613119, geocodeResult.Geometry.Location.Longitude, 0.001); var types = geocodeResult.Types?.ToArray(); Assert.IsNotNull(types); Assert.IsNotEmpty(types); Assert.Contains(PlaceLocationType.Street_Address, types); }
public void GetGeocodingForCoordinates() { // expectations var expectedStatus = ServiceResponseStatus.Ok; var expectedResultCount = 9; var expectedTypes = new AddressType[] { AddressType.StreetAddress, AddressType.Locality, AddressType.PostalCode, AddressType.Sublocality, AddressType.AdministrativeAreaLevel2, AddressType.AdministrativeAreaLevel1, AddressType.Country, AddressType.Political }; var expectedFormattedAddress = "277 Bedford Ave, Brooklyn, NY 11211, USA"; var expectedComponentTypes = new AddressType[] { AddressType.StreetNumber, AddressType.Route, AddressType.Locality, AddressType.AdministrativeAreaLevel1, AddressType.AdministrativeAreaLevel2, AddressType.Sublocality, AddressType.Country, AddressType.PostalCode, AddressType.Political }; var expectedLatitude = 40.7142330m; var expectedLongitude = -73.9612910m; var expectedLocationType = LocationType.Rooftop; var expectedSouthwestLatitude = 40.7110854m; var expectedSouthwestLongitude = -73.9644386m; var expectedNortheastLatitude = 40.7173806m; var expectedNortheastLongitude = -73.9581434m; // test var request = new GeocodingRequest(); request.LatitudeLongitude = "40.714224,-73.961452"; request.Sensor = "false"; var response = GeocodingService.GetResponse(request); // asserts Assert.AreEqual(expectedStatus, response.Status, "Status"); Assert.AreEqual(expectedResultCount, response.Results.Length, "ResultCount"); Assert.IsTrue( expectedTypes.OrderBy(x => x).SequenceEqual( response.Results.SelectMany(y => y.Types).Distinct().OrderBy(z => z))); Assert.AreEqual(expectedFormattedAddress, response.Results.First().FormattedAddress, "FormattedAddress"); Assert.IsTrue( expectedComponentTypes.OrderBy(x => x).SequenceEqual( response.Results.First().Components.SelectMany(y => y.Types).Distinct().OrderBy(z => z)), "Types"); Assert.AreEqual(expectedLatitude, response.Results.First().Geometry.Location.Latitude, "Latitude"); Assert.AreEqual(expectedLongitude, response.Results.First().Geometry.Location.Longitude, "Longitude"); Assert.AreEqual(expectedLocationType, response.Results.First().Geometry.LocationType, "LocationType"); Assert.AreEqual(expectedSouthwestLatitude, response.Results.First().Geometry.Viewport.Southwest.Latitude, "Southwest.Latitude"); Assert.AreEqual(expectedSouthwestLongitude, response.Results.First().Geometry.Viewport.Southwest.Longitude, "Southwest.Longitude"); Assert.AreEqual(expectedNortheastLatitude, response.Results.First().Geometry.Viewport.Northeast.Latitude, "Northeast.Latitude"); Assert.AreEqual(expectedNortheastLongitude, response.Results.First().Geometry.Viewport.Northeast.Longitude, "Northeast.Longitude"); }
static void README_QuickStart_Sample1() { //always need to use AIzaSyDyrcySjhH_JOpJ9461agf8vkyJbvkmD_k for requests. Do this in App_Start. GoogleSigned.AssignAllServices(new GoogleSigned("AIzaSyDyrcySjhH_JOpJ9461agf8vkyJbvkmD_k")); var request = new GeocodingRequest(); request.Address = "1600 Pennsylvania Ave NW, Washington, DC 20500"; var response = new GeocodingService().GetResponse(request); //The GeocodingService class submits the request to the API web service, and returns the //response strongly typed as a GeocodeResponse object which may contain zero, one or more results. //Assuming we received at least one result, let's get some of its properties: if (response.Status == ServiceResponseStatus.Ok && response.Results.Count() > 0) { var result = response.Results.First(); Console.WriteLine("Full Address: " + result.FormattedAddress); // "1600 Pennsylvania Ave NW, Washington, DC 20500, USA" Console.WriteLine("Latitude: " + result.Geometry.Location.Latitude); // 38.8976633 Console.WriteLine("Longitude: " + result.Geometry.Location.Longitude); // -77.0365739 Console.WriteLine(); } else { Console.WriteLine("Unable to geocode. Status={0} and ErrorMessage={1}", response.Status, response.ErrorMessage); } }
public List <Location> TestGeocode() { Console.WriteLine($"{nameof(TestGeocode)}:"); var list = new List <Location>(); foreach (var location in Locations) { Console.Write($"\t{location} ..."); var request = new GeocodingRequest() { ApiKey = ApiKey, Address = location, Region = Region, }; var response = GoogleMaps.Geocode.Query(request); Console.Write($"\t{response.Status}"); if (response.Status == Status.OK) { list.AddRange(from r in response.Results select r.Geometry.Location); Console.Write("\t" + string.Join("; ", (from r in response.Results select r.Geometry.Location.LocationString).ToArray())); } Console.WriteLine(); } return(list); }
static void DoGeocodeRequest() { //always need to use YOUR_API_KEY for requests. Do this in App_Start. //GoogleSigned.AssignAllServices(new GoogleSigned("YOUR_API_KEY")); //commented out in the loop Console.WriteLine(); Console.WriteLine("Enter an address to geocode: "); string geocodeAddress = Console.ReadLine(); var request = new GeocodingRequest(); request.Address = geocodeAddress; var response = new GeocodingService().GetResponse(request); //The GeocodingService class submits the request to the API web service, and returns the //response strongly typed as a GeocodeResponse object which may contain zero, one or more results. //Assuming we received at least one result, let's get some of its properties: if (response.Status == ServiceResponseStatus.Ok && response.Results.Count() > 0) { var result = response.Results.First(); Console.WriteLine("Full Address: " + result.FormattedAddress); // "1600 Pennsylvania Ave NW, Washington, DC 20500, USA" Console.WriteLine("Latitude: " + result.Geometry.Location.Latitude); // 38.8976633 Console.WriteLine("Longitude: " + result.Geometry.Location.Longitude); // -77.0365739 Console.WriteLine(); } else { Console.WriteLine("Unable to geocode. Status={0} and ErrorMessage={1}", response.Status, response.ErrorMessage); } }
public void Geocode_With_AddressComponent_Locking() { var requestGB = new GeocodingRequest { Address = "Boston", Components = "country:GB" }; var requestUS = new GeocodingRequest { Address = "Boston", Components = "country:US" }; var responseGB = new GeocodingService(Credentials.None).Geocode(requestGB); var responseUS = new GeocodingService(Credentials.None).Geocode(requestUS); Assert.AreEqual(ServiceResponseStatus.Ok, responseGB.Status); Assert.AreEqual(ServiceResponseStatus.Ok, responseUS.Status); foreach (var r in responseGB.Results) { Assert.IsTrue(r.FormattedAddress.EndsWith("UK"), r.FormattedAddress + " <- Should be in UK"); } foreach (var r in responseUS.Results) { Assert.IsTrue(r.FormattedAddress.EndsWith("USA"), r.FormattedAddress + " <- Should be in USA"); } }
private void MainMap_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { try { isMouseDown = false; var request = new GeocodingRequest { Key = MiscStuff.googleApiKey, Location = new GoogleApi.Entities.Common.Location(currentMarker.Position.Lat, currentMarker.Position.Lng) }; var response = GoogleMaps.Geocode.Query(request); if (response.Status == Status.Ok) { textBoxAddress.Text = response.Results.First().FormattedAddress; } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } } }
public async Task <Address> ReverseGeocodingFromLocation(Location location) { if (!location.IsValid() || Math.Abs(location.Latitude) <= 0 && Math.Abs(location.Longitude) <= 0) { return(null); } var request = new GeocodingRequest { Address = new LatLng(location.Latitude, location.Longitude) }; var response = await _geocodingService.GetResponseAsync(request); if (response.Status != ServiceResponseStatus.Ok) { return(null); } var address = response.Results.FirstOrDefault(); if (address == null) { return(null); } return(new Address { FormattedAddress = address.FormattedAddress, Location = location }); }
public Game(int screenWidth, int screenHeight) : base(screenWidth, screenHeight, GraphicsMode.Default, "OpenTK Quick Start Sample") { touchDeltaCount = 5; touchXDeltas = new double[touchDeltaCount]; touchYDeltas = new double[touchDeltaCount]; pool = new MapPool(20, new int[] { screenWidth, screenHeight }); screenDimensions = new int[] { screenWidth, screenHeight }; GeocodingRequest req = new GeocodingRequest(); req.Address = "215 Keenan Hall Notre Dame, IN 46556"; req.Sensor = false; var resp = new GeocodingService().GetResponse(req); var result = resp.Results[0]; var loc = result.Geometry.Location; setLL(loc.Latitude, loc.Longitude); VSync = VSyncMode.On; Mouse.ButtonDown += new EventHandler <MouseButtonEventArgs>(handleTouchDown); Mouse.ButtonUp += new EventHandler <MouseButtonEventArgs>(handleTouchUp); Mouse.WheelChanged += new EventHandler <MouseWheelEventArgs>(handleTouchZoom); Mouse.Move += new EventHandler <MouseMoveEventArgs>(handleTouchMove); }
/// <summary> /// Execute the Command: collect the fields of the Model from the multi-converter in the View and set the values in the ViewModel /// </summary> /// <param name="parameter">parameters that were collected form the View usin</param> public async void Execute(object parameter) { var values = (object[])parameter; Report report = new Report(); report.name = values[0].ToString(); report.timeOfReport = DateTime.Parse(values[1].ToString()); string address = values[2].ToString(); try { GeocodingRequest geocodeRequest = new GeocodingRequest(); geocodeRequest.Address = address; geocodeRequest.ApiKey = googleMapsKey; GeocodingResponse geocode = await GoogleMaps.Geocode.QueryAsync(geocodeRequest); if (geocode.Status == Status.OK) { IEnumerator <Result> iter = geocode.Results.GetEnumerator(); iter.MoveNext(); GM.Location tempLocation = iter.Current.Geometry.Location; latitude = tempLocation.Latitude; longitude = tempLocation.Longitude; } } catch (Exception exception) { } report.Latitude = latitude; //coord.Latitude; report.Longitude = longitude; // coord.Longitude; report.numOfBombs = int.Parse(values[3].ToString()); report.cityName = values[4].ToString(); CurrentVM.incomingReport = report; }
static LocationDetails GetLocationDetails(String postcode) { LocationDetails locationDetails = new LocationDetails(); GoogleSigned.AssignAllServices(new GoogleSigned("APIKEY")); // APIKEY van Google hier zetten var request = new GeocodingRequest(); request.Address = postcode; { var response = new GeocodingService().GetResponse(request); if (response.Status == ServiceResponseStatus.OverQueryLimit) { WriteLine("API Quotum Reached"); } if (response.Status == ServiceResponseStatus.Ok && response.Results.Count() > 0) { var result = response.Results.First(); if (result.AddressComponents.Length > 2) { locationDetails = new LocationDetails( result.AddressComponents[0].ShortName, result.AddressComponents[1].LongName, result.AddressComponents[2].LongName, result.Geometry.Location.Longitude, result.Geometry.Location.Latitude, result.PlaceId); Console.WriteLine("Postcode: " + result.AddressComponents[0].LongName + "plaats: " + result.AddressComponents[1].LongName + "regio: " + result.AddressComponents[2].LongName + "," + result.Geometry.Location.Longitude + ", " + result.Geometry.Location.Latitude, result.PlaceId); } else { locationDetails = new LocationDetails( result.AddressComponents[0].ShortName, result.AddressComponents[1].LongName, "", result.Geometry.Location.Longitude, result.Geometry.Location.Latitude, result.PlaceId); Console.WriteLine("Postcode: " + result.AddressComponents[0].LongName + "plaats: " + result.AddressComponents[1].LongName + "," + result.Geometry.Location.Longitude + ", " + result.Geometry.Location.Latitude, result.PlaceId); } } else { Console.WriteLine("Unable to geocode. Status={0} and ErrorMessage={1}", response.Status, response.ErrorMessage); } return(locationDetails); } }
public void Geocoding_InvalidClientCredentials_Throws() { var request = new GeocodingRequest { Address = "285 Bedford Ave, Brooklyn, NY 11211, USA", ClientID = "gme-ThisIsAUnitTest", SigningKey = "AAECAwQFBgcICQoLDA0ODxAREhM=" }; Assert.Throws <AuthenticationException>(() => GoogleMaps.Geocode.Query(request)); }