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 Placemark?GetPlacemark(PointLatLng location, out GeoCoderStatusCode status) { var request = new GeocodingRequest { Address = new LatLng(location.Lat, location.Lng), Sensor = false }; var response = _geocodingService.GetResponse(request); status = GoogleMapWrapper.ToGeoCoderStatusCode(response.Status); return(response.Results.Any() ? GoogleMapWrapper.ToPlacemark(response.Results[0]) : (Placemark?)null); }
// reverse geo coding public GeoCoderStatusCode GetPlacemarks(PointLatLng location, out List <Placemark> placemarkList) { var request = new GeocodingRequest { Address = new LatLng(location.Lat, location.Lng), Sensor = false }; var response = _geocodingService.GetResponse(request); placemarkList = (from r in response.Results select GoogleMapWrapper.ToPlacemark(r)).ToList(); return(GoogleMapWrapper.ToGeoCoderStatusCode(response.Status)); }
public GeoCoderStatusCode GetPoints(string keywords, out List <PointLatLng> pointList) { var request = new GeocodingRequest { Address = keywords, Sensor = false }; var response = _geocodingService.GetResponse(request); pointList = (from r in response.Results select GoogleMapWrapper.ToPointLatLng(r.Geometry.Location)).ToList(); return(GoogleMapWrapper.ToGeoCoderStatusCode(response.Status)); }