Android Question Gps library

Discussion in 'Android Questions' started by Isac, Jan 21, 2015.

  1. Isac

    Isac Active Member Licensed User

    Hello,
    how can I get the address of a street?
    with the library gps I have not found anything useful
    thank you
     
  2. NJDude

    NJDude Expert Licensed User

    The GPS library does what a GPS does, get location by Latitude and Longitude.
     
    Peter Simpson likes this.
  3. Peter Simpson

    Peter Simpson Expert Licensed User

    Get the GPS location, then try using an online service to get the road name information that you're looking for. I presume that there's a service that will do that for you.

    You can do it the other way around easily enough by using Geocoding. Maybe there's an API that will give you exactly what you are looking for.
    https://developers.google.com/maps/documentation/geocoding/?csw=1#Geocoding
     
    DonManfred likes this.
  4. derez

    derez Expert Licensed User

    Geocoder library !
    Code:
    Geocoder.GetFromLocation(point.Lat,point.Lon,2Null)
    ...
    End Sub

    Sub Geocoder_GeocodeDone(Results() As Address, Tag As Object)
        
    If Results.Length>0 Then
            
    Dim Address1 As Address
            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
        
    End If
        display_parameter = place
    End Sub
     
    Isac and wonder like this.
  5. wonder

    wonder Expert Licensed User

    My GPS (Garmin Nuvi) got stolen from my car last Summer... :(

    Now, seeing how easy to use this lib looks, I'm starting to consider creating my own GPS app! :D

    Derez, is there any chance that your path finding algorithms can work together with real world maps (such as Google Maps)?

    [​IMG]
     
    Last edited: Jan 22, 2015
  6. DonManfred

    DonManfred Expert Licensed User

    i guess NO. Google Maps, and also other map solutions, presents you images... Depending on the zoomlevel they are more clear and detailed (showing streetnames). But they are just images. Google does not expose Streetnames in the api.
     
    Peter Simpson and wonder like this.
  7. derez

    derez Expert Licensed User

    The address details in geocoder are coming from google and they need network for getting the data.
    The map is another issue.
     
    Isac likes this.
  8. Isac

    Isac Active Member Licensed User

    Thank you all for your attention
    but I honestly do not understand how to use the library Geocoder.
    I simply need to obtain the address and read it into a label.

    Library gps I always use it to get lat and long right?

    Code:
    Sub GPS_LocationChanged (Location1 As Location)  
        lon1 =Location1.Latitude
        long2 =Location1.Longitude
        Label1.Text=
    "Latitude: "&lon1
        Label2.Text=
    "Longitude: "&long2
        Label4.Text=geo.GetFromLocation(long2,lon1,
    2,Null)
    End Sub
    Thank You
     
  9. DonManfred

    DonManfred Expert Licensed User

    You need to get the value in the sub
    Code:
    Sub Geocoder_GeocodeDone(Results() As Address, Tag As Object)
        
    If Results.Length>0 Then
            
    Dim Address1 As Address
            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
        
    End If
    End Sub
    and then put it onto your label(s)
     
  10. Isac

    Isac Active Member Licensed User

    I see nothing in the label, but it is correct to put a NULL?


    Code:
    Sub GPS_LocationChanged (Location1 As Location)   
       
        lon1 =Location1.Latitude
        long2 =Location1.Longitude
        Label1.Text=
    "Latitude: "&lon1
        Label2.Text=
    "Longitude: "&long2
        geo.GetFromLocation(long2,lon1,
    2,Null)

    End Sub

    Sub Geocoder_GeocodeDone(Results() As Address, Tag As Object)
       
        
    If Results.Length>0 Then
            
    Dim Address1 As Address
            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
        
    End If
        Label4.Text = place
    End Sub
     
  11. Isac

    Isac Active Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice