从经纬度时区查询 [英] Timezone lookup from latitude longitude

查看:321
本文介绍了从经纬度时区查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有可以从一个转换纬度/经度成一个时区的库(甚至更好,Web服务)是否可用?

Is there any library (or even better, web service) available which can convert from a latitude/longitude into a time zone?

推荐答案

我看着相当深入探讨这个问题的一个项目我工作。 GeoNames.org和EarthTools.com都很多情况下只是有以下严重缺陷不错的选择:

I looked fairly deeply into this question for a project I am working on. GeoNames.org and EarthTools.com are both good options for many situations but with the following serious flaws:


  • GeoNames.org通过搜索其数据库中包含的时区字段的最近点发现的时区。这经常导致错误的结果接近边界。它也是极为缓慢,导致查询倍的每个请求几秒钟的数量级。它还如果在查询点靠近其数据库中没有项目没有返回有效的时区。 GeoNames的限制也可以每天进行查询的数量,使得批量操作困难。

  • EarthTools.org使用地图,并且能够快速返回的查询,但它并没有考虑到日光节约时间对于大多数位置,并将其返回原始偏移,而不是一个时区ID(即,它们将返回 GMT-7,而不是美国/芝加哥)。另外,我只是看着他们的网页,而preparing这篇文章和谷歌Chrome警告在其网站上的恶意软件。这是新的给我,这可能会改变,但显然是一个令人关注的原因。

这些缺陷意味着,这些现有的工具是不适合我的需要,所以我推出我自己的解决方案,并已公布其用于一般用途。你可以在这里找到它:

These flaws meant that these existing tools were not suitable for my needs so I rolled my own solution and have published it for general use. You can find it here:

http://www.askgeo.com/

AskGeo是根据世界时区地图上,所以它返回每个有效经纬度一个有效的时区。它返回标准时区ID(例如,美国/洛杉矶),在Linux和大多数其他操作系统和编程框架中使用。它还返回当前的偏移量,同时充分考虑到夏令时。

AskGeo is based on a time zone map of the world, so it returns a valid time zone for every valid latitude and longitude. It returns the standard time zone ID (e.g., "America/Los_Angeles") used on Linux and most other operating systems and programming frameworks. It also returns the current offset, taking full account of daylight savings time.

这是非常容易使用和使用进行了说明该网站的主页上。该API支持批量查询,所以如果你需要做大量的查找窗口,请使用批处理接口,而不是拖垮我们的服务器与串行请求。批量查询也快很多,所以大家都赢了。

It is extremely easy to use and usage is documented on the main page of the site. The API supports batch queries, so if you need to do a lot of look-ups, please use the batch interface rather than bog down our servers with serial requests. The bulk queries are also much faster, so everybody wins.

当我们第一次推出了这一点,我们便在谷歌的App Engine(GAE),并使它免费提供给所有用户。这是可能的,因为GAE的价格在当时是如此之低。从那时起,我们的服务器的负载大幅度增强,GAE的价格又一路上涨。这两个因素结合起来使我们切换到亚马逊网络服务托管,并开始收取用于商业用途,同时保持免费服务的非盈利,非商业的开源项目,和研究人员。对于商业用户,我们可提供1000免费查询,让潜在客户评估API,以确保其满足他们的需求。请访问网站的定价和条款。

When we first launched this, we built it on Google App Engine (GAE) and made it free to all users. This was possible because GAE's prices were so low at that time. Since then, our server load has increased substantially and GAE's prices went way up. Both factors combined led us to switch to Amazon Web Services for hosting and to start charging for commercial use, while keeping the service free for non-profit, non-commercial open source projects, and researchers. For commercial users, we provide 1000 free queries to let potential customers evaluate the API to make sure it meets their needs. See the web site for pricing and terms.

基础库是用Java编写的,并且由于大众需求,我们还发布了按照商业许可证库中。图书馆和定价细节完整的文件是在网站上。

The underlying library was written in Java and due to popular demand, we also released the library under a commercial license. Full documentation of the library and pricing details are on the web site.

我希望这是有益的。这当然是对我工作的项目非常有用。

I hope this is useful. It certainly was useful for the project I was working on.

这篇关于从经纬度时区查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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