查找位置的城市和郵政編碼 (Finding City and Zip Code for a Location)


問題描述

查找位置的城市和郵政編碼 (Finding City and Zip Code for a Location)

給定緯度和經度,找到城市名稱和該位置的美國郵政編碼的最簡單方法是什麼。

(這類似於 https://stackoverflow.com/questions/23572/latitude‑longitude‑database,除非我想在相反的方向轉換。)


相關問題:獲取經緯度對的街道地址


參考解法

方法 1:

Any of the online services mentioned and their competitors offer "reverse geocoding" which does what you ask‑‑convert lon/lat coordinates into a street address of some‑sort.

If you only need the zip codes and/or cities, then I would obtain the Zip Code database and urban area database from the US Census Bureau which is FREE (paid for by your tax dollars). http://www.census.gov/geo/www/cob/zt_metadata.html.

From there, you can either come up with your own search algorithm for the spatial data or make use of one of a spatial databases such as Microsoft SQL Server, PostGIS, Oracle Spatial, ArcSDE, etc.

Update: The 2010 Census data can be found at: http://www2.census.gov/census_2010/

方法 2:

This is the web service to call. http://developer.yahoo.com/search/local/V2/localSearch.html

This site has ok web services, but not exactly what you're asking for here. http://www.usps.com/webtools/

方法 3:

You have two main options:

Use a Reverse Geocoding Service

  • Google's can only be used in conjunction with an embedded Google Map on the same page, so I don't recommend it unless that is what you are doing.
  • Yahoo has a good one, see http://developer.yahoo.com/search/local/V3/localSearch.html
  • I've not used OpenStreetMap's. Their maps look very detailed and thorough, and are always getting better, but I'd be worried about latency and reliability, and whether their address data is complete (address data is not directly visible on a map, and OpenStreetMap is primarily an interactive map).

Use a Map of the ZIP Codes

The US Census publishes a map of US ZIP codes here. They build this from their smallest statistical unit, a Census Block, which corresponds to a city block in most cases. For each block, they find what ZIP code is most common on that block (most blocks have only one ZIP code, but blocks near the border between ZIP codes might have more than one). They then aggregate all the blocks with a given ZIP code into a single area called a Zip Code Tabulation Area. They publish a map of those areas in ESRI shapefile format.

I know about this because I wrote a Java Library and web service that (among other things) uses this map to return the ZIP code for a given latitude and longitude. It is a commercial product, so it won't be for everyone, but it is fast, easy to use, and solves this specific problem without an API. You can read about this product here:

http://askgeo.com/database/UsZcta2010

And about all of your geographic offerings here:

http://askgeo.com

Unlike reverse geocoding solutions, which are only available as Web APIs because running your own service would be extremely difficult, you can run this library on your own server and not depend on an external resource.

方法 4:

If you call volume to the service gets up too high, you should definitely consider getting your own set of postal data. In most cases, that will provide all of the information that you need, and there are plenty of db tools for indexing location data (i.e. PostGIS for PostgreSQL).

方法 5:

You can buy a fairly inexpensive subscription to zipcodes with lat and long info here: http://www.zipcodedownload.com/

(by Kristopher JohnsonJames Schekcoder1James DDana the SaneGeri Langlois)

參考文件

  1. Finding City and Zip Code for a Location (CC BY‑SA 2.5/3.0/4.0)

#mapping #gis #maps #geocoding #location






相關問題

Hibernate 單向父/子關係 - delete() 對子表執行更新而不是刪除 (Hibernate Unidirectional Parent/Child relationship - delete() performs update on child table instead of delete)

TIGER shapefile - 使用和解釋 (TIGER shapefiles - using and interpreting)

查找位置的城市和郵政編碼 (Finding City and Zip Code for a Location)

如何使 Vim 插件 NERDTree 的 <CR> 表現得更像 `go`? (How to make Vim plugin NERDTree's <CR> behave more like `go`?)

在 NHibernate 上的多對多關係上添加自定義列 (Add custom columns on many to many relationship on NHibernate)

在大型 .NET 項目中管理 DTO 和映射 (Managing DTOs and mapping in large .NET project)

使用 Fluent NHibernate 進行繼承映射 (Inheritance Mapping with Fluent NHibernate)

Biztalk映射問題,請想法 (Biztalk Mapping Problem, Ideas please)

BizTalk 數據庫查找 functoid 固定條件 (BizTalk Database Lookup functoid fixed condition)

EntityFramework FluentAPI 映射問題 (EntityFramework FluentAPI mapping issue)

將外鍵添加到現有數據庫 (Adding foreign keys to an already existing database)

如何重命名對像數組中對象的所有鍵? (How does one rename all of an object's keys within an array of objects?)







留言討論