I want to develop a C# app that can reverse GeoCode polygon and give me all the addresses that can be found inside the area of the polygon.
I managed to find a solution to reverse GeoCode long and lat coordinates as shown below:
- static string ReverseGeoCoding(string latitude, string longitude)
- {
- var json = new WebClient().DownloadString(baseUrlRGC + latitude.Replace(" ", "") + "," + longitude.Replace(" ", "") + plusUrl);
- //concatenate URL with the input lat/lng and downloads the requested resource
- GoogleGeoCodeResponse jsonResult = JsonConvert.DeserializeObject
(json); - //deserializing the result to GoogleGeoCodeResponse
- string status = jsonResult.status;
- // get status s
- tring geoLocation = String.Empty;
- if (status == "OK")
- //check if status is OK
- {
- for (int i = 0; i < jsonResult.results.Length; i++) //loop throught the result for addresses
- {
- geoLocation += "Address: " + jsonResult.results[i].formatted_address + Environment.NewLine;
- //append the result addresses to every new line
- }
- return geoLocation; //return result
- }
- else
- {
- return status; //return status / error if not OK
- }
- }
However what I want is a solution to provide multiple coordinates for the polygon and return all addresses inside the area.
Replies
Know the answer? Post it — somebody with the same question will find it here.