public Tuple <float, float> GetLatLong(string address) { string formatedText = address.Replace(" ", "+"); formatedText = formatedText.Replace(",", ""); // get rid of commas string url = urlBase + "address=" + formatedText; var response = HTTPrequests.GetHTTPRequestWithGoogle(url); if (response == null) { return(new Tuple <float, float>(-404, -404)); } else { LatLongResults results = Newtonsoft.Json.JsonConvert.DeserializeObject <LatLongResults>(response); return(new Tuple <float, float>(results.results[0].geometry.location.lat, results.results[0].geometry.location.lng)); } }
public string[] GetAutocomplete(string enteredText) { string formatedText = enteredText.Replace(" ", "+"); string url = urlBase + "input=" + formatedText; var response = HTTPrequests.GetHTTPRequestWithGoogle(url); //JObject json = JObject.Parse(response.ToString()); //Console.WriteLine(json); AutocompleteResults results = Newtonsoft.Json.JsonConvert.DeserializeObject <AutocompleteResults>(response); //Console.WriteLine(response.ToString()); int numResults = results.predictions.Count(); string[] returnResults = new string[numResults]; for (int i = 0; i < numResults; i++) { returnResults[i] = results.predictions[i].description; } return(returnResults); }