开发者

How does Twitter get its geolocation data?

开发者 https://www.devze.com 2023-01-30 19:40 出处:网络
I was wondering if anyone knew how Twitter (or facebook) gets its geolocation data, like the vario开发者_StackOverflowus streets and possible buildings. It seems like Twitter gets it from Google, but

I was wondering if anyone knew how Twitter (or facebook) gets its geolocation data, like the vario开发者_StackOverflowus streets and possible buildings. It seems like Twitter gets it from Google, but does anyone know of any resources on how to set that up?

Thanks! Matt Mueller


Google doesn't parse from all locations either it seems. At least this seems not to work from Curacao. I'm working on a solution that is more stable. See my open question for details. If you just want google you can use this.

Include

<script type="text/javascript" src="http://www.google.com/jsapi"></script>

JS

if(google.loader.ClientLocation) {
  latitude = (google.loader.ClientLocation.latitude);
  longitude = (google.loader.ClientLocation.longitude);
}


It does it through the HTML5 Geolocation API that is now supported by most modern browsers. Of course it is up to the browser's implementation of the interface to decide how to determine the location. A cell phone will figure it out very differently from a desktop machine, etc. For instance, Firefox uses a Google web service to do it based on the IP address, while Mobile Safari would use Core Location.

A quick Google search will turn up lots of information how to detect and use the capability.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号