按纬度和经度查找电话区号 [英] Lookup telephone area code by latitude and longitude

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

问题描述

寻找一种获得给定经度和纬度的电话区号列表的方法(并且如果必要的话给定的国际代码)。注意,我不是在谈论国际拨号前缀,而是在它们中的区号。例如,丹佛科罗拉多地区代码为303和720.它位于39.739 -104.985,在NANP1中。因此给出了39.739,-104.985,1 I 'd想回来[303,720]。

需要解析为数据库的库,Web服务,数据库或原始数据,例如形状点,都很好,越全球覆盖越好,但只是NANP 1将是一个很大的帮助。



注意我已经使用MaxMind并可以打开lat-在一个虚假的IP中使用它作为查找关键字,但MaxMind只声称美国区号(无论它们是真的意味着美国还是实际上我没有测试过的NANP),并且每个位置看起来只有1个(例如,丹佛只有303个)。这是一种可能性,但不是一个好的选择。






更新我找到了更多相关信息,但没有明确的解决方案,因此我将其列在此处而不是答案中:



我能够找到两个美国数据库 http://www.area-codes.com/area-code-database.asp http:// www.nationalnanpa.com/area_codes/index.html (页面下降50%,MS Access文件)。前者包括450美元的lat / lng,后者则需要与KeithS谈论的最近邻居匹配(它是可能是他找到的NANPA城市查询的底层数据库。)

另外,我发现信息暗示Teleatlas具有区域代码边界映射,并且ESRI包含带副本的区域代码形状文件的ArcGIS。 Maponics似乎有数据可用:Google地图的数据实现在 http://www.usnaviguide.com/areacode.htm

解决方案

哇。你肯定会需要某种预先存在的点数据库。我的第一个想法是 ZIPList5地理编码。它包含每个有效美国邮政编码的经纬度数据,因此您可以将这些数据放在数据库表中,将它们编入索引,然后根据您可以访问的任何地理信息进行搜索。您可以以40美元购买一份,企业级使用价格为100美元。唯一的问题是,这个数据库只有每个邮政编码的主要区号,所以有超过一个(达拉斯,芝加哥,纽约)的城市区域不会显示所有这些。



您可以尝试采用双管齐下的方法,并发现一些免费数据:对于给定的经度和纬度,请在 USGS地理名称信息系统;它包括每个人类居住中心的信息,以及每个指定的地标特征,其中心的纬度/经度坐标。您现在已将您的经纬度点映射到最近的城镇,邮政编码,县和州。现在,您可以将其与美国名单进行比较。区号,以查找与USGS的任何或全部识别信息匹配的区号。这是完全免费的,并且最终会让你得到你所需要的,但是你可能需要做一些工作来将这两组数据按摩成可以有效交叉引用的东西,并且/或者你需要实施一个好的搜索引擎,可以准确找到最近邻居的命名点,然后找到匹配地名的地区代码。

还有一件事要看的是NANPA,负责管理区号分配。我确信他们有一个更全面的可下载数据库,但唯一免费的公共访问是我可以找到的是这个搜索页面,它可以找到任何有> 20k人的城市的区域代码。您可以将经纬度数据转换为城市和州,然后点击此搜索页面: NANPA城市查询


Looking for a way to get a list of telephone area codes for a given latitude and longitude (and if necessary a given intl. code.) Note, I'm not talking about international dialing prefixes but the area codes within them.

For example, Denver Colorado is covered by the area codes 303 and 720. It's at 39.739 -104.985 and is in NANP 1. So given 39.739,-104.985,1 I'd like to get back [303,720].

Libraries, web services, DB's, or raw data that needs to be parsed into a DB, e.g., a web page of shape points, are all fine and the more global coverage the better, but just NANP 1 would be a great help.

Note I already use MaxMind and could turn the lat-lng into a fake IP and use that as the lookup key, but MaxMind claims only U.S. area codes (whether they truly mean U.S. or actually NANP I haven't tested) and seemingly only 1 per location (e.g. just 303 for Denver.) So it's a possibility, just not a great one.


UPDATE: I found some more relevant information, but no definitive solutions so I'm listing it here rather than in an answer:

I was able to find two U.S. databases http://www.area-codes.com/area-code-database.asp and http://www.nationalnanpa.com/area_codes/index.html (50% down the page, MS Access file.) The former includes lat/lng for $450 and the latter would require nearest-neighbor matching as KeithS talks about (it's probably the same DB underlying the NANPA City Query he found.)

Additionally I found information that implies Teleatlas has area code boundary maps and that ESRI includes area code shape files with copies of ArcGIS. Maponics seems to have data available: there's a Google Maps implementation of Maponics' data at http://www.usnaviguide.com/areacode.htm.

解决方案

Wow. You'll definitely need some sort of pre-existing database of points. My first thought was ZIPList5 Geocode. It includes lat-long data for each active U.S. ZIP code, so you can throw this data in a DB table, index the hell out of it, and search by just about any geographic info you'd have access to. You can buy one copy for $40, with enterprise-level use for $100. Only problem is that this DB has only the "primary" area code for each ZIP code, so metro areas that have more than one (Dallas, Chicago, NYC) aren't going to show all of them.

You could try a two-pronged approach with some free data I found: for a given latitude and longitude, do a nearest-neighbors search of the data in the USGS Geographic Names Information System; it includes information on every human habitation center, and every named landmark feature, with lat/long coordinates of their centers. You now have your lat/long point mapped to the nearest town/city, ZIP code, county, and state. Now, you can compare that against this list of U.S. Area Codes, to find area codes matching any or all of the identifying information from the USGS. This is all free, and will eventually get you what you need, but you'll probably have to do some work to "massage" the two sets of data into something you can efficiently cross-reference, and/or you'll need to implement a good "search engine" that will accurately find nearest-neighbor named points, and then find area codes for locations matching the names.

One more thing to look at is NANPA, which administers area code assignment to begin with. I'm sure they have a more comprehensive downloadable DB, but the only free public access I could find was this search page, which will find area codes for any city with >20k people. You could turn your lat/long data into a city and state, and then hit this search page: NANPA City Query

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

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