Closed joewxboy closed 10 years ago
Timeout is configurable https://github.com/ebidel/geo-location/blob/master/geo-location.html#L122. What do you mean by a JSON fallback?
At weather.com, they use their JSONP service to resolve a location when a browser does not support geolocation (usually <=IE8, which is not a problem in Polymer), or when geolocation fails (timeout, error, etc). An example call is http://gip.imwx.com/wxdata/gip/get.js?cb=jsonCallback
This approach guarantees a mostly-correct location for most users most of the time. I believe the Google Maps API v3 does something similar at http://maps.googleapis.com/maps/api/js?client=[clientid]&sensor=false&v=3.13
Nice. I didn't know about that. Do you know if there's an available endpoint that is openly available to use?
I don't know of any public endpoints with both quality data and a decent SLA. Maybe just allow implementers to subscribe to the error event handler and code the backstop themselves? Then they can use whatever service they need, rather than trying to bake a substandard solution into the Element (unless Google releases a high-quality free service).
Yea, I think that's the right approach. Users can use the error event to do what's best for them. Thanks for bringing this to my attention. I've filed https://github.com/ebidel/geo-location/issues/4 to track making timeout
easier to configure.
Since your code has a five-second timeout, it is likely that devices will timeout before resolving location, especially with the accuracy turned up. Have you considered adding a backstop JSON service to perform IP-based geolocation if the initial resolution fails?