Search code examples
c#.netgeolocationgps

How can I get the GPS location for use in a web site?


I am developing a web site that needs to know the user's location. All of the users will be employees of the company; there's no tracking of customers or anything like that. The users will be employees out in the field. They could be on Android phones, iPhones, tablets, or laptops. I've found several ways to get their location, but can't find specific ways to get that location back to our website. Ideally, we'd like the user's location to be reported to database and the website would get that location when they login. Below are some ways I've researched to accomplish this. How do I get any of this information into my web site?

  1. Personal GPS tracker (like this: http://www.ezoomgps.com/home.aspx). These devices seem to let employers track employees via a map and have other features, but all we need to know is the location (latitude and longitude). Anyone know how to get a device like this to report those coordinates for use in a web site?
  2. Mobile app. Lots of apps out there for showing locations on a map, but nothing that just takes the location and reports it to a database/web site. Anyone know of an app that just reports the devices location?
  3. IP tracing. Found some IP tracing services (like http://www.ip2location.com/), but not sure how well they work on mobile. Tried some with my phone and it got my city name right, but couldn't pinpoint my location. Anyone know an accurate way to get a physical location from an IP address?

Solution

  • Sounds like a job for navigator.geolocation.getCurrentPosition in HTML5. That would be reasonably cross-platform and you could build it into web pages that report back to your database.

    See: