如何从浏览器获取客户端的位置? [英] Ways to get location of the client from the browser?

查看:302
本文介绍了如何从浏览器获取客户端的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要的是客户端的经纬度(通过浏览器)



在网上找到一些文章,发现一些堆栈溢出本身(一篇老文章)从网络浏览器获取GPS位置。它几乎在18个月前被回答 - 想知道是否有任何其他(更有效的)方式从浏览器获取用户位置的信息。



到目前为止,发现2



使用Maxmind



其他,使用google的api





w3c的geo api会有向下兼容性问题: http://dev.w3.org/geo/api/spec-source.html ,所以不要选择



找到一个网站, www.drumaroo.com - 当我们进入该网站时第一次分享位置的请求。需要类似的东西 用户可以通过以下方式找到: -


  1. 使用IP地址。
    最容易实现,但由于网络地址/
    拓扑结构的不确定性而最不可靠。

  2. 使用纬度,经度对
    最准确的解决方案,但大多数最终用户不知道他们的纬度,
    经度值。

  3. 使用zipcodes
    很好思考但很难实现,尽管ZipCodes是用于

    相当长时间,但这还不是标准。 (见链接

    http://en.wikipedia.org/wiki/Postal_code )。仅使用ZipCode不足以计算
    的距离,我们需要将其转换为纬度,经度对,这是一个

    开销。使用用户地址
    最引人注目的思想,因为每个用户至少有一个地理地址。
    地址本身不足以计算距离,我们需要将其转换为
    纬度,经度对,这是一个开销。

最佳选择是将选项2,3.4一起使用,您可以分两步执行: -


  1. 首先从地址中确定纬度和经度。
  2. 然后使用这个经纬度值作进一步处理,即存储在
    数据库等中。

  3. ol>

    对于可用的各种选项,请参阅这个问题


    What i need is the lat/long of the client(via browser)

    Found some articles on the net,found some in stack overflow itself(an old article) Get GPS location from the web browser. it was answered almost 18months ago -- wondering if there's any other(more efficient) way of getting the information of the location of the user from the browser.

    Soo far,found 2

    using Maxmind

    Other,using google's api

    w3c's geo api will have downward compatibility issues: http://dev.w3.org/geo/api/spec-source.html ,so not choosing that.

    Found a site, www.drumaroo.com -- requests for the location to be shared the 1st time when we drop into the site.Needed something similar

    解决方案

    The user can be located by using following ways:-

    1. Using the IP addr. easiest to achieve but most unreliable due to the uncertainty of network addresses / topologies.
    2. Using the latitude, longitude pair most accurate solution, but most of the end users don’t know about their latitude, longitude value.
    3. Using the zipcodes nice to think but quite difficult to achieve, although ZipCodes are being used for
      quite a long time but this is not a standard yet. (see link
      http://en.wikipedia.org/wiki/Postal_code ). ZipCode alone is not sufficient for calculation of distance we need to convert it to latitude, longitude pair which is an
      overhead.
    4. Using user’s address most compelling thought since each user will have at least one geographic address. Address alone is not sufficient for calculation of distance we need to convert it to latitude, longitude pair which is an overhead.

    The Best option will be to use options 2,3.4 together, You can do that in two steps:-

    1. First determine the latitude, longitude from the address.
    2. Then use this lat, long value for further processing i.e. storing in database etc.

    For various options available for this see the answer of this question

    这篇关于如何从浏览器获取客户端的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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