I have a address in string like "444 NE Ravenna Blvd, Seattle, WA" , now how can I get the lat/long of this address using Google maps or any other services in C#.
Basically need to convert address into Lat-long using C#.
You can do it using Nuget Package GoogleMaps.LocationServices in C#.
Here is how to use it:
Install-Package GoogleMaps.LocationServices?
if you are using .NET 4.6 or below, instal older version like 1.2.0
public static void GetLatLongFromAddress(string address)
{
//replace APIKey your Google API Key here
var locationService = new GoogleLocationService("APIKey");
var point = locationService.GetLatLongFromAddress(address);
var latitude = point.Latitude;
var longitude = point.Longitude;
// Save lat/long values to DB...
}?
That's it, simple to use and get Lat-long from address.
With the helpf of above API, you can also convert lat-long into address using C#.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly