SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    geolocation accuracy

    If you where to build an app native or with HTML5 would the use of Geolocation get its information from different places? Would the accuracy be different?

  2. #2
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,516
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)
    Geolocation based on IP addresses isn't very accurate. It typically gets the Country and State/Provence correct about 90% of the time. Cities are hit or miss, and tend to return the ISP's address, rather than the user's.

    Geolocation based on GPS coordinates is very accurate, but not all devices support this.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the quick response. Is it possible to detect via javascript whether a device has GPS?

  4. #4
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,516
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)
    Sort of. In javascript, you basically just check to see if the geolocation engine can run. If so, you have access to whichever geolocation resources the device has permission to provide.

    As for GeoIP, that uses a completely different solution, and isn't really a part of the build-in geolocation engine build into HTML5.

    Code:
    if (navigator.geolocation) {
        //do geolocation stuff
    }else{
        //geolocation not supported. Do something else.
    }
    You can also do error detection do see *why* geolocation isn't available even when it is supported on the device:

    http://merged.ca/iphone/html5-geolocation
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  5. #5
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe slightly off track, you can also eventually incorporate google maps api with the sensor argument as 'true'

    for example
    http://maps.googleapis.com/maps/api/directions/xml?origin=ORIGIN&destination=DESTINATION&sensor=true
    Last edited by Mittineague; Jan 7, 2013 at 22:56.


Tags for this Thread

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
  •