About Geocoder

ciginfo

Well-Known Member
Licensed User
Longtime User
1°)How to extract data from "Address1.AddressLines". I have to display the address on one line in a label and not in a ListView.

2°) Why do you use "AddTwoLlines" and not "AddSingleLine"?

3°) What represents "Get(O)" in (Address1.AddressLines.Get(0)?

Thany you
 

derez

Expert
Licensed User
Longtime User
1°)How to extract data from "Address1.AddressLines". I have to display the address on one line in a label and not in a ListView.

B4X:
Sub Geocoder_GeocodeDone(Results() As Address, Tag As Object)
dim place as string = ""
If Results.Length>0 Then
  Dim Address1 As Address
    'For i = 0 To Results.Length-1
   Address1=Results(0)
    If Address1.AddressLines.Size>0 Then
          For j = 0 To Address1.AddressLines.Size-1
      place = place & " " & Address1.AddressLines.Get(j) & " "             
          Next
   End If
   'Next
End If
label1.text = place
End Sub

In the above code I put the results into one string and display it in a label. The outer loop is commented since I found that doing it provides additional but redundant data, but you can unmark it and try ( change to index i instead of 0 here "Address1=Results(0)"

2°) Why do you use "AddTwoLlines" and not "AddSingleLine"?

This is not related to the geocoder operation, just as a means for display.

3°) What represents "Get(O)" in (Address1.AddressLines.Get(0)?

The first item in the list of addresslines, usually its a high level part of the address.
 
Last edited:
Upvote 0
Top