How to get lat-long from address (string) using C#?

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#.

Asked by:- neena
: 2864 At:- 11/7/2018 11:56:57 AM
C# lat-long-from-address google-maps-api

1 Answers
profileImage Answered by:- Sam

You can do it using Nuget Package GoogleMaps.LocationServices in C#.

Here is how to use it:

  1. Install it using Nuget Package Manager Command
    Install-Package GoogleMaps.LocationServices?

    if you are using .NET 4.6 or below, instal older version like 1.2.0

  2. Once installed use the below C# code
    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#.

At:- 11/8/2018 3:27:34 PM
Looks easy and better solution to use GoogleMaps.LocationServices in C#, thanks 0
By : neena - at :- 11/24/2018 7:06:44 AM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use