Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

GET street address by lat and lng

GET street address by lat and lng

GET street address by lat and lng

My code:
Private Sub APRI_LAT_LNG()

STRADA = LAT & "," & LNG

Me.WebBrowser1.Visible = True

Me.WebBrowser1.Navigate "https://dev.virtualearth.net/REST/v1/Imagery/Map/R..." & STRADA & "/17?mapSize=640,480&pp=" & STRADA & ";8&mapLayer=Basemap,Buildings&key=" & BINGKEY

Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE

Me.CZOOM.Enabled = True

Me.WebBrowser1.Document.body.Style.border = "none"
Me.WebBrowser1.Document.body.Scroll = "no"
Me.WebBrowser1.Document.body.setAttribute "scroll", "no"


End Sub

possible to return in MyVarStreet the name of the nearest street, the lat and lng value?

use for test:


is a street based city=NAPOLI>countryPIMONTE>zipcode>80050

RE: GET street address by lat and lng

You can certainly get what Bing calls 'location data; from a lat and long - but not sure if location data contains street names.

RE: GET street address by lat and lng

strongm, is important, in other case...

RE: GET street address by lat and lng


for strong...

with http://dev.virtualearth.net/REST/v1/Locations/42.7...


<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/search/local/ws/rest/...">
<Copyright>Copyright © 2022 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright>
<Name>Frazione Morgnano 25, 06049 Spoleto Perugia</Name>
<AddressLine>Frazione Morgnano 25</AddressLine>

<FormattedAddress>Frazione Morgnano 25, 06049 Spoleto Perugia</FormattedAddress>


how to get the bold info?

RE: GET street address by lat and lng

Why do you want all of the bold text when your original query relates to simply getting the street address?

Now, if it is just the address line you need, then some simple XML-extracting code will do the trick. The following assumes you have a form with a textbox containing your good, well-formed XML response

CODE -->

Option Explicit

Private Sub Command1_Click()
    MsgBox GetAddressLine(Text1.Text)
End Sub

Public Function GetAddressLine(myXMLString As String) As String
    Dim objXML As New MSXML2.DOMDocument
    If objXML.LoadXML(myXMLString) Then
        ' Get first match. And remember that XML is case-sensitive
        GetAddressLine = objXML.SelectSingleNode("//AddressLine").Text
        ' oops - XML failed to load
    End If
End Function 

(oh, and by not surrounding your examples with TGML tags that prevent parsing, your links get modified for display, e.g we see


versus the same link surrounded by e.g. Pre tags:


RE: GET street address by lat and lng

but wath is the parameter in bold, MsgBox GetAddressLine(Text1.Text)

RE: GET street address by lat and lng

Quote (strongm)

a textbox containing your good, well-formed XML response

RE: GET street address by lat and lng

i use


XMLQUERY = "http://dev.virtualearth.net/REST/v1/Locations/" & LAT & "," & LNG & "?o=xml&C=IT&key=" & BINGKEY

With CreateObject("MSXML2.XMLHTTP")

.Open "GET", XMLQUERY, False

Sleep (100)

myXML.loadXML .responseText 'raw xml
Set nodes = myXML.selectNodes("//*")

MsgBox GetAddressLine(?????)


RE: GET street address by lat and lng

So, in your code (or more accurately my code, since it looks to be an extract from my example in thread222-1807492: inser map from url of 18 months ago) myXML is the same thing as objXML - an MSXML2.DOMDocument object with XML loaded

Sop you don't need my function (which assumed you had TEXT that you wanted to work with as per your post 2 Jun 22), just:

MsgBox objXML.SelectSingleNode("//AddressLine").Text

By the way - just a reminder: my posts here are NOT production code; they are examples of possible solutions. They do not have error checking, bounds checking, or even include simple checks for valid return values. The idea is that you take the example and figure out how to best use it in your code. I point this out because if the XML response from Bing does not have AddressLine as a node in the returned XML both my original function and the above code will error - and, sorry Sal21, I have no intention of spending my time talking you through error handling.

RE: GET street address by lat and lng


RE: GET street address by lat and lng

sorry strong i'm busy (inFamily)

RE: GET street address by lat and lng

Still busy?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close