Reverse GeoCoding with Google API and C#


I needed to write a function to get a set of co-ordinates from an address, supplied as a string.
Using the Google API, I came up with this:

First, I created a struct, to represent the lat and lon co-ordinates:

This is a simple representation of a set of latitude and longitude co-ordinates.

The main method, which returns the above Coordinate struct is:

On line 5, you need to specify your Google API URL, in the format of: GOES HERE&output=csv&key=YOUR KEY HERE

And that’s it!

Obviously, there are usage restrictions when using the Google API for this, as outlined on the documentation pages