Find latitude and longitude using C#

You have to install GoogleMaps.LocationServices from the NuGet package. It uses Google's REST API to get lat/long for a given address. Using these you can get latitude and longitude without any need of any API Key.

To install GoogleMaps.LocationServices, run the following command in the Package Manger Console.

PM> Install-Package GoogleMaps.LocationServices

After Install the above package you can use it like this:

Firstly, Adding this NameSpace.

using GoogleMaps.LocationServices;

Then use  GoogleLocationService() class to get the latitude and longitude of any given address.

Example:
 
public static void Main()
 {
   var address = "75 Ninth Avenue 2nd and 4th Floors New York, NY 10011";
  
var locationService = new GoogleLocationService();
  
var point = locationService.GetLatLongFromAddress(address);
 
var latitude = point.Latitude;
  var
longitude
= point.Longitude; /
 
}

Then you can easily plot it to the Google maps.

Ebook Download
View all
Learn
View all