How to know the latitude and longitude of a given address

Posted on 2011-10-08
Last Modified: 2012-05-12
Hi ,
if I supply the details like
Zip Code:
in an page

How can I get the values of the latitude and longitude of the address using C#
Question by:mauneeld
    LVL 12

    Expert Comment

    by:Ramkisan Jagtap
    you can use google maps api.
    Refer following link

    Author Comment

    Hi RamKisan,

    I am unable to find the code snippet which takes in address as the input from the user and then give the coordinates i.e..., latitude and longitude of that address.

    LVL 12

    Expert Comment

    by:Ramkisan Jagtap
    please che following example link. View source for code.
    LVL 12

    Accepted Solution

    LVL 1

    Expert Comment

    Google Maps geocoding service can be used.
    Since the question was about C# you may use this small C# wrapper of the Google Maps geocoding service:

    private static readonly List<string> Addresses = new List<string> 
        "1600 Amphitheatre Parkway, Mountain View, CA 94043",       // Google 
        "1 Microsoft Way, Redmond, WA 98052",                       // Microsoft 
        "1601 S. California Ave., Palo Alto, CA 95304",             // Facebook 
        "701 First Ave, Sunnyvale, CA 94089"                        // Yahoo 
    // The API is rate limited.  1 request every 0.5 seconds seems to keep Google happy. 
    private static readonly int DelayInMs = 500; 
    static void Main(string[] args) 
        foreach (string address in Addresses) 
                .ForEach(coordinate => DisplayCoordinate(coordinate, address)); 
    private static void DisplayCoordinate(GeographicCoordinate coordinate, string address) 
        Console.WriteLine("Geographic coordinate for '{0}':", address); 
            "\t* Latitude: {0}, Longitude: {1}", 

    Open in new window


    Author Comment

    Hi ggeek,
    For the code which you supplied needs to have a key...but I dont have a key since I do not have an URL...
    Is there a way to get a key without providing the URL

    Author Comment

    Hi Ramkisan,

    I am getting the address correctly, but how do I find the latitude and longitude of the specified address?
    With the code over the link

    I am unable to still find the latitude and longitude of a given location.

    Author Closing Comment

    Solution was easy to follow

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video discusses moving either the default database or any database to a new volume.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now