如何使用GPRS检测手机位置?
如您所知,手机谷歌地图程序能够查找用户位置(“我的位置”服务)。 我想知道 Google 地图如何使用互联网移动、GPRS(而非 GPS)检测用户位置? 是否可以用 PHP 或其他基于网络的语言编写一个程序,可以在用户打开该页面时检测用户的位置? 我可以猜测 Google 不会使用用户 IP 来确定他们的位置,因为当我尝试使用我的移动互联网 IP 猜测我的位置时,会获得错误的位置。
As you know, Google maps program for Mobiles has the ability to find users location (My Location service).
I want to know how Google Maps can detect users location using internet mobile, GPRS (Not GPS)?
and is it possible to write a program in PHP or other web-based languages that can detect users location when they open that page?
I can guess that Google doesn't use users IP in order to determine their location because when I tried to guess my location using my Mobile internet IP a wrong location is obtained.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在没有 GPS 定位的情况下,进行定位的常见方法是对服务小区 ID 或检测到的 Wi-Fi MAC 地址进行反向查找。存在一个基于服务器的数据库,它提供所有已知蜂窝站点的地理位置 - 这些蜂窝站点由其蜂窝 ID(或更准确地说是其蜂窝全局 ID (CGI))唯一标识,以及所有已知 Wi-Fi AP 的位置。因此,知道了 CGI 或 MAC,人们就可以通过 GPRS 等蜂窝数据收集数据库来确定自己的大致(“粗略”)位置。这就是 SkyHook(Apple 曾经使用过,但现在不再使用)等商业服务的工作原理。
通过使用信号强度或数字地图等附加输入,可以使粗略位置更加精确。
某些设备(例如 iPhone)会在设备上缓存此数据库,以便更快地进行粗分辨率定位。几个月前,苹果公司因此陷入了麻烦,并随后改变了其运作方式。
为了让网页知道设备的位置,设备必须调用适当的(特定于设备的)定位 API,然后将其提交到 Web 服务器,这显然需要一些设备端代码(而不仅仅是浏览器) 。
In the absence of a GPS fix, a common way to do positioning is to do a reverse lookup of the serving cell ID or of a detected Wi-Fi MAC address. A server-based database exists which gives the geolocation of all known cell sites -- which are uniquely identified by their cell ID, or more precisely, their Cell Global ID (CGI), as well the location of all known Wi-Fi APs. Thus, knowing the CGI or MAC, one can determine one's approximate ("coarse") location by doing a dip into the database over a cellular data collection like GPRS. This how commercial services like SkyHook (which Apple used to use, but no longer uses) work.
This coarse position can be made somewhat more precise by using additional inputs such as signal strengths or digital maps.
Some devices -- like iPhones -- cache this database on-device so as to make coarse-resolution positioning faster. Apple got in trouble for this a few months back and has since changed how this works.
In order for a web page to know the device's location, the device would have to call the appropriate (device-specific) positioning API and then submit it to the web server, which obviously requires some device-side code (not just a browser).
查看 Google 地理编码 API 和 W3 地理定位 API 规范。那么这个可能会帮助您找到答案。
Take a look at the Google Geocoding API and W3 Geolocation API Specification. Then this might be helpful for you to find your answers.
它的工作原理是这样的。谷歌地图会根据用户的浏览器(或使用谷歌地图代码的程序)是否支持和实现地理定位接口来询问用户是否愿意共享其位置,您可以了解有关该接口的更多信息 此处。如果用户同意共享其位置,有关本地无线接入点的信息将被传递,以便谷歌地图(或其他服务)可以估计用户的位置。可以在您的程序或网页中实现这一点。我不太了解如何在程序中使用谷歌地图,但对于网页来说,这里是一个用 javascript 编写的示例,可以满足您的需求。我确信您也可以用 PHP 来完成此任务。
请参阅此处的 Google 地图 API 参考,了解多种方式您可以在其中使用它。另外,源引用并不是以“sensor=true”结尾。如果您使用地理定位,请务必在源中将此值设置为 true。
It works like this. Google maps asks the user if they would like to share their location, based on whether or not their browser (or program using the google maps code) supports and implements the geolocation interface, which you can learn more about here. If the user agrees to share their location, information about local wireless access points is passed along so that google maps (or other services) can make an estimation of the user's location. It is possible to implement this in your programs or web pages. I don't know a whole lot about using google maps within programs, but as for a web-page, here is an example of one written in javascript that will do what you are looking for. I'm sure that you can also accomplish this in PHP.
Consult the google maps api reference here to see the number of ways in which you can use this. Also, not that the source reference ends in "sensor=true". It is important that you set this value to true in your source if you are using geolocation.