+ Reply to Thread
Results 1 to 12 of 12

Get google maps place name from lat/long coordinates in excel

  1. #1
    Forum Contributor
    Join Date
    11-29-2014
    Location
    India
    MS-Off Ver
    MS Excel 2007
    Posts
    240

    Get google maps place name from lat/long coordinates in excel

    I am looking to find an address on google map and then construct an url where people can click and find directions. I want to do it in excel but not sure if it is possible. So far I was able to find the address in Json format and need help on how to get the formatted_address value from the result.

    The url that gives me formatted_address is
    https://maps.googleapis.com/maps/api...1&key=YOUR_KEY
    (I have generated a key at https://console.developers.google.com)

    I have latitudes in column F and longitudes in column G in the range F5:G100 and want to have the result (formatted address) in column K. I wish to request the programmers out here if they can help me with some kind of a UDF or a VBA that can help me achieve this.

    Here is what I get from the above url. The result is too big so i have truncated it. If there are two or more formatted_address listed, then I need the first one.
    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Get google maps place name from lat/long coordinates in excel

    You can't use the google web service when you aren't displaying a map, it's against the terms and conditions.

    There are other reverse geocoding services out there though, so if you find one you're happy with, link to it and we'll see what we can do

  3. #3
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Get google maps place name from lat/long coordinates in excel

    Are you sure you can not use it when his Link points to a google Map for the Direction?
    It says "you will not use the Content in a Maps API Implementation without a corresponding Google map"

    In this case the API is used to generate a Link that goes to Google Maps to get directions. I Would count that as "Corresponding Google Map" :D

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Get google maps place name from lat/long coordinates in excel

    You don't need to reverse geocode for that, you can use the lat lon directly, so yes :p

  5. #5
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Get google maps place name from lat/long coordinates in excel

    good point did not think about that :D

  6. #6
    Forum Contributor
    Join Date
    11-29-2014
    Location
    India
    MS-Off Ver
    MS Excel 2007
    Posts
    240

    Re: Get google maps place name from lat/long coordinates in excel

    Thank you Kyle and Lorloki for your reply. I could not find other reverse geocoding services. I found an url that does not require a KEY
    Here is the url
    http://maps.googleapis.com/maps/api/...671,77.0977691
    and here is the script (it gives a lot of info but i need only complete address)
    Fiddle to check result for the above script. http://jsfiddle.net/NNuDe/367/

    I found one service that finds location using client side IP address using ipinfo.io but it does not give me the full address
    Here is the link http://jsfiddle.net/zK5FN/2/

    Moreover, I also found an html code that gives me what i want but it is in html format and i need it in excel. Could not paste the code as it is giving me firewall error. Its a post answered by Michal with 125+ upvotes available at http://stackoverflow.com/questions/6...ng-geolocation

    My objective is to get the formatted complete address in excel and appreciate if someone can help me. Thank you !

  7. #7
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Get google maps place name from lat/long coordinates in excel

    What do you actually need, your first post contradicts itself.

    Do you need a link (from lat/long) that opens at the correct location in google maps that someone can click from excel?

    OR

    Do you want to get address details from a lat / long?

    Other reverse geocoding service: https://msdn.microsoft.com/en-us/library/ff701710.aspx

  8. #8
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Get google maps place name from lat/long coordinates in excel

    Here is some code i quickly throw together using openstreetmaps that should get you on the right way

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    11-29-2014
    Location
    India
    MS-Off Ver
    MS Excel 2007
    Posts
    240

    Re: Get google maps place name from lat/long coordinates in excel

    I went to try it. It worked fine and result looks good too. However, when i change the lat/long to the one in question then it halts on the below line with an error Run time error 5 invalid procedure call or argument
    getfield = Mid(Data, Start, ende - Start) & " "

  10. #10
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Get google maps place name from lat/long coordinates in excel

    Hi the Error you get is probably cause the XML does not have one of the fields you want to show.
    My home adress has no town for example

    i played around with the thing a bit and put together a function that should account for this.
    Check out the file i attached that should give you enough to get to the desired result

    if you have a very long list it would be better to use a button that adds the adress data etc instead of an UDF
    But if its just a couple this should work fine and you can easy adapt it with a little effort

    Greets Loki
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    11-29-2014
    Location
    India
    MS-Off Ver
    MS Excel 2007
    Posts
    240

    Re: Get google maps place name from lat/long coordinates in excel

    Wonderful !
    Appreciate you help. God bless.

  12. #12
    Registered User
    Join Date
    02-06-2019
    Location
    Komarno, Slovakia
    MS-Off Ver
    MS Office 2007, 2010
    Posts
    1

    Re: Get google maps place name from lat/long coordinates in excel

    Hi!
    Looks good but it seems to me not working...
    Is it still actual?

    Jozef

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Route Calculator - Google Maps Api 22 Minutes quicker than Actual Google Website
    By lookingforhelp1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-06-2015, 01:23 PM
  2. Embedding Google Maps in to Excel
    By jkfoxworth in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2015, 05:22 PM
  3. Coordinates to Create Google Maps Image VBA
    By harrisj_ in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-24-2015, 05:55 AM
  4. [SOLVED] Modifying a Lat/Long function to extract ID and Reference from a Google Place query
    By Eagle29 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-26-2013, 05:51 AM
  5. Excel and Google Maps Directions
    By kinseld5 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-02-2012, 12:27 PM
  6. Google Maps in Excel?
    By kklein in forum Excel General
    Replies: 8
    Last Post: 09-26-2011, 06:54 PM
  7. Google maps in excel
    By censura in forum Excel General
    Replies: 0
    Last Post: 02-21-2008, 04:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1