Appengine位置标头是根据什么来确定位置的? [英] On what basis does the Appengine location headers tell the location?

查看:63
本文介绍了Appengine位置标头是根据什么来确定位置的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的Web应用托管在Google Appengine上.有时我需要知道访客的位置.因此,我一直在使用Google提供的请求标头:

I have hosted my Web app on Google Appengine. At times I need to know the location of the visitors. So I have been using the request headers provided by Google:

        String visitorCountry = request.getHeader("X-AppEngine-Country");
        String visitorRegion = request.getHeader("X-AppEngine-Region");       
        String visitorCity = request.getHeader("X-AppEngine-City");
        String visitorLatLong = request.getHeader("X-AppEngine-CityLatLong");

它们从未精确定位过,我想它告诉我ISP的位置.Google Appengine的请求标头在什么基础上起作用?它主要在客户端随请求发送的IP地址上吗?

They have never been accurate to the location, and I guess it tells me the location of the ISP. On what basis does the Google Appengine's request headers work? Is it primarily on the IP address the client sends along the request?

以下是标题文档供参考.

推荐答案

人们可以去这里- http://mylocationtest.appspot.com/-并查看它们的位置信息.

People can go here - http://mylocationtest.appspot.com/ - and see what location information comes up for them.

对我来说,纬度/经度只是所列城市的名义中心-距我的实际位置约20公里.ISP是加拿大罗杰斯(Rogers Canada).

For me, the lat/long are just the nominal center of the city listed - about 20km from my actual location. The ISP is Rogers Canada.

显然,有时国家/地区回来时会显示"ZZ". http://code.google.com/p/googleappengine/issues/detail?id = 5296

Apparently, sometimes country comes back as 'ZZ'. http://code.google.com/p/googleappengine/issues/detail?id=5296

此IP地址信息通常与 ASN 打包在一起.这告诉您ISP,并且正如上面提到的那样,只有他们才能说出自己IP的分配位置.位置信息的准确性可能取决于ISP.

This IP address information is usually packaged with the ASN. This tells you the ISP, and as someone mentioned above, only they can say where one of their IP's is assigned. Perhaps the accuracy of the location information depends on the ISP.

(这不是问题的答案-只是进一步的讨论-但这在评论中并没有真正作用).

(This isn't an answer to the question - just further discussion - but it didn't really work in a comment).

这篇关于Appengine位置标头是根据什么来确定位置的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆