来自纬度经度位置的国家/地区代码(不使用地理编码服务)

发布于 2024-10-19 20:57:08 字数 324 浏览 4 评论 0原文

如何从纬度经度位置获取国家/地区代码?

我知道有许多地理编码服务可用,但它们不能满足我的要求,因为我的应用程序在上线几个小时后就被阻止(许多地理编码请求)。

大多数地理编码服务还提供商业服务,但它们还不是一种选择,因为该项目还处于起步阶段。

我做了一些研究,认为我找到了一种方法: 获取包含所有国家(多边形)边界的形状文件(或其他数据文件)。 接下来只需查看纬度/经度位置在哪个多边形中。 最后读取特定多边形的元数据。

有谁知道我在哪里可以获得包含显示世界所有国家边界的多边形(或仅线条)的形状文件(或其他格式)?

或者是否有更简单的方法来解决这个问题?

How can i get the country code from a latitude longitude position?

I know that there are many geocoding services available, but they don't meed my requirement because my application gets blocked a few hours after it goes live (many geocoding requests).

Most geocoding services also offer commercial services, but they are not yet a option because the project is in it starting blocks.

I did a bit of research and think i found a way to do it:
Get a shape file (or other data file) that contains the borders of all countries (in polygons).
Next just look in which polygon the lat/lng position is.
Finally read the meta data from the specific polygon.

Does anyone know where i can get a shape file (or other format) that includes polygons (or just lines) that show the borders of all countries in the world?

Or is there maybe a easier way to solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

琉璃繁缕 2024-10-26 20:57:08

给定世界上国家(多边形)的数量,您可能希望先细分国家多边形集合来进行粗略过滤(例如,如果该点位于西半球和北半球,则只需要检查北美,中部美国和加勒比国家/地区可能会提高速度。

此外,请记住,许多国家/地区由多个多边形组成,请在编写代码时记住这一点

。但结帐:
http://geocommons.com/overlays/33578

http://geospatial.edublogs.org/2010/06/ 29/世界国家边界文件/

Given the number of countries (polygons) in the world, you may want to subdivide the set of country polygons to do a rough filter first (e.g., if the point is in the western and northern hemispheres, only need to check North American, Central American, and Carribean countries. That may give you a speed improvement.

Also, keep in mind that many countries consist of multiple polygons, just keep that in mind as you code.

I haven't used any of these sources for country boundary data, but checkout:
http://geocommons.com/overlays/33578
and
http://geospatial.edublogs.org/2010/06/29/world-country-boundary-files/

太阳公公是暖光 2024-10-26 20:57:08

我假设您需要 ISO 3166-1 alpha-2 国家/地区代码(相对于 2012 年 12 月将逐步淘汰的 FIPS 10=4)。 ISO 列出了 248 个国家、地区和属地。 ViennaMike 通过快速过滤来减少按大陆进行检查的方法听起来是一种很好的性能方法。

您将需要使用国家形状文件来了解纬度/经度位于哪个国家/地区(即,检查点是否位于多边形内)。

有很多免费资源(但可能有商业许可限制)。这是开源项目 (openstreetmap)

http://downloads.cloudmade.com/

Andrew 的另一个来源OpenGeoCode.Org 团队

I assume you want the ISO 3166-1 alpha-2 country code (vs. the FIPS 10=4 which is being phased out by Dec. 2012). There are 248 countries, territories and dependencies listed by ISO. ViennaMike's approach by doing a quick filter to reduce to checking by continent sounds like a good performance approach.

You will want to use the countries shapefile to know which country the lat/lng is within (ie., check if point is within a polygon).

There are a lot of free sources (but may have commerical licensing restrictions). Here's another source from the open source project (openstreetmap)

http://downloads.cloudmade.com/

Andrew, The Team at OpenGeoCode.Org

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文