How to find latitude and longitude using C#

You could try the NuGet package GoogleMaps.LocationServices, or just spin of its source code. It uses Google’s REST API to get lat/long for a given address and vice versa, without the need for an API key.

You use it like this:

public static void Main()
{
    var address = "Stavanger, Norway";

    var locationService = new GoogleLocationService();
    var point = locationService.GetLatLongFromAddress(address);

    var latitude = point.Latitude;
    var longitude = point.Longitude;

    // Save lat/long values to DB...
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)