3

I have a Google Map (v3) on a website. When a user hits the page, I am reading the geolocation from it´s browser (if it´s supported):

navigator.geolocation.getCurrentPosition(successCallback, errorCallback, {enableHighAccuracy: true, timeout: timeOut, maximumAge: maximumAge })

The function is working, but not always as expected. In Google Chrome it´s working perfectly - the getCurrentPosition function is returning a coordinate object with latitude and longitude as floating points (decimals). Curiously it´s different in IE11. It´s also returning the coordinate object - but here are both latitude and longitude in integers, which means, that the accuracy is very bad, and not really showing the right position on the map.

Is this a bug? And does anyone know if it´s possible to fix this?

Thank you!

fgc
  • 79
  • 1
  • 1
  • 13

1 Answers1

4

Different browsers use different geolocation service providers to get an estimate of your location and that could explain why you're seeing different results with Google Maps.

Google Chrome similarly uses Google Location Services. The default geolocation service provider of Firefox is Google Location Services as well. Safari uses Skyhook Wireless's service.

Searching on the web, I could not find which specific geolocation service provider IE makes use of but the different results you see between browsers can be attributed to the quality of data provided by the geolocation service provider. So my guess is, you have to wait for the precision of the geolocation calculation in IE to improve as I haven't seen any documented way to change the geolocation service provider that a browser uses. Alternatively, see if Bing Maps works well in IE or try using a commercial IP-based Geolocation detector service like Maxmind to detect coordinates.

Community
  • 1
  • 1
mvark
  • 2,105
  • 2
  • 21
  • 36
  • Of course each browser use different geolocation services, but navigator.geolocation is an standar procedure of html5 api so it should work properly not having in count wich map provider i'm using, I mean I can use bing o google maps, but the accuracy is the same cuz it comes from the navigator.geolocation procedure. I affraid I gotta wait until micro$oft fix that horrible implementation. – fgc Nov 26 '14 at 15:30
  • 2
    Yes, the method navigator.geolocation.getCurrentPosition is standardized but what the browser does to make it work depends on its own implementation & the geolocation service provider (different from mapping service) that it uses. Some Google services work better in Chrome - they are optimized for that browser. By that logic, I'm GUESSING that Microsoft MAY optimize Bing Maps to work better in its own IE browser so I suggested you try to check the accuracy. I understand using 2 mapping services isn't practical. – mvark Nov 26 '14 at 15:53
  • Going by this thread, the accuracy of geolocation detection MAY vary by location. A SO user found IE to detect his location than Firefox - http://stackoverflow.com/a/9079730/325251 – mvark Nov 26 '14 at 16:08
  • getCurrentPosition is completely separate from the maps code. It is purely a browser/device thing, so I don't think it could make any difference to the accuracy, if you switch from Google to Bing – Emmanuel Delay Nov 26 '14 at 16:13