Hi there, I'm using the Geocoder library to get the address of the present location. But it's not returning a Thoroughfare, Locality, PostalCode and (sometimes) FeatureName.
I understand FeatureName may not return a result sometimes. I am getting a GPS location correctly and can map it using OSM_Droid. What I'm looking for, though, is to get the street address in "plain English". Can anyone advise on what I may be doing wrong?
I understand FeatureName may not return a result sometimes. I am getting a GPS location correctly and can map it using OSM_Droid. What I'm looking for, though, is to get the street address in "plain English". Can anyone advise on what I may be doing wrong?
B4X:
Sub GPS_LocationChanged (Location1 As Location)
numLat = Location1.Latitude
numLon = Location1.Longitude
labelLat.Text = "Lat = " & numLat
labelLon.Text = "Lon = " & numLon
Geocoder1.GetFromLocation(numLat, numLon, 5, Null)
MapView1.SetCenter(numLat, numLon)
End Sub
Sub GPS_UserEnabled (Enabled As Boolean)
ToastMessageShow("GPS device enabled = " & Enabled, True)
End Sub
Sub Geocoder1_GeocodeDone(Results() As Address, Tag As Object)
If Results.Length > 0 Then
Dim Address1 As Address
Dim i As Int
For i = 0 To Results.Length - 1
Address1 = Results(i)
If Address1.AddressLines.Size > 0 Then
labelAddr.Text = Address1.Thoroughfare & CRLF & Address1.Locality & CRLF & Address1.AdminArea & CRLF & Address1.PostalCode & CRLF & Address1.CountryName & CRLF & Address1.FeatureName
End If
Next
Else
labelAddr.Text = "No address found"
End If
End Sub