根据纬度/经度确定时区,而不使用像Geonames.org这样的网络服务 [英] Determine timezone from latitude/longitude without using web services like Geonames.org

查看:166
本文介绍了根据纬度/经度确定时区,而不使用像Geonames.org这样的网络服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有可能在不使用webservices的情况下确定点(lat / lon)的时区? Geonames.org对我来说不够稳定:我需要这个在PHP中工作。



谢谢

解决方案

我曾经遇到过这个问题,并且做了adam的建议: 来自geonames.org的城市数据库

  • 将它转换为紧凑的经纬度 - >时区列表

  • 使用 R-Tree 实现有效地查找离给定坐标最近的城市(或更确切地说是它的时区)


    IIRC花费不到1秒来填充R-Tree,然后它可以每秒执行数千次查询(在5年前的PC上)。

    is there any possibility to determine the timezone of point (lat/lon) without using webservices? Geonames.org is not stable enough for me to use :( I need this to work in PHP.

    Thanks

    解决方案

    I had this problem a while back and did exactly what adam suggested:

    • Download the database of cities from geonames.org
    • convert it to a compact lat/lon -> timezone list
    • use an R-Tree implementation to efficiently lookup the nearest city (or rather, its timezone) to a given coordinate

    IIRC it took less than 1 second to populate the R-Tree, and it could then perform thousands of lookups per second (both on a 5 year old PC).

    这篇关于根据纬度/经度确定时区,而不使用像Geonames.org这样的网络服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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