如何获取美国邮政(zip)代码的边界坐标?

时间:2022-08-22 13:54:44

Is there a service/API that will take a postal/zip code and return the bounding(perimeter) coordinates so I can build a Geometry object in a MS SQL database?

是否有服务/ API将采用邮政/邮政编码并返回边界(周边)坐标,以便我可以在MS SQL数据库中构建Geometry对象?

By bounding coordinates, I mean I would like to retrieve a list of GPS coordinates that construct a polygon that defines the US zip code.

通过边界坐标,我的意思是我想要检索构建定义美国邮政编码的多边形的GPS坐标列表。

4 个解决方案

#1


45  

An elaboration of my comment, that ZIP codes are not polygons....

详细说明我的评论,邮政编码不是多边形....

We often think of ZIP codes as areas (polygons) because we say, "Oh, I live in this ZIP code..." which gives the impression of a containing region, and maybe the fact that ZIP stands for "Zone Improvement Plan" helps the false association with polygons.

我们经常将邮政编码视为区域(多边形),因为我们说,“哦,我住在这个邮政编码中......”给人的印象是包含区域,也许ZIP代表“区域改进计划”有助于与多边形的错误关联。

In actuality, ZIP codes are lines which represent, in a sense, mail carrier routes. Geometrically, lines do not have area. Just as lines are strings of points along a coordinate plane, ZIP code lines are strings of delivery points in the abstract space of USPS-designated addresses.

实际上,邮政编码是在某种意义上代表邮递员路线的线。几何上,线条没有区域。正如线是沿坐标平面的点串,邮政编码线是USPS指定地址的抽象空间中的交付点串。

They are not correlated to geographical coordinates. What you will find, though, is that they appear to be geographically oriented because it would be inefficient for carriers to have a route completely irrelevant of distance and location.

它们与地理坐标无关。然而,你会发现它们似乎是地理位置导向的,因为对于航空公司来说,拥有与距离和位置完全无关的路线是低效的。

What is this "abstract space of USPS-designated addresses"? That's how I am describing the large and mysterious database of deliverable locations maintained by the US Postal Service. Addresses are not allotted based on geography, but on the routes that carriers travel which usually relates to streets and travelability.

什么是USPS指定地址的“抽象空间”?这就是我描述由美国邮政局维护的大型神秘的可交付地点数据库的方式。地址不是根据地理位置分配的,而是根据航空公司旅行的路线分配的,这些路线通常与街道和可行驶性有关。

Some 5-digit ZIP codes are only a single building, or a complex of buildings. These are "unique" ZIPs. Companies and universities frequently get their own ZIP codes for marketing or organizational purposes. For instance, the ZIP code "12345" belongs to General Electric up in Schenectady, NY. (Edit: In a previous version of Google Maps, when you follow that link, you'd notice that the placement marker was hovering, because it points to a ZIP code, which is not a coordinate. While most US ZIP codes used to show a region on Google Maps, these types cannot because the USPS does not "own" them, so to speak, and they have no area.)

一些5位数的邮政编码只是一栋建筑物或一幢建筑群。这些是“独特的”ZIP。公司和大学经常出于营销或组织目的获得自己的邮政编码。例如,邮政编码“12345”属于纽约斯克内克塔迪的通用电气公司。 (编辑:在以前版本的Google地图中,当您点击该链接时,您会注意到展示位置标记悬停,因为它指向的是邮政编码,而不是坐标。虽然大多数美国邮政编码用于显示谷歌地图上的一个区域,这些类型不能,因为USPS不“拥有”它们,可以这么说,它们没有区域。)

Just for fun, let's try verifying an address in a unique ZIP code. Head over to SmartyStreets and punch in a bogus address in 12345, like:

只是为了好玩,让我们尝试用唯一的邮政编码验证地址。前往SmartyStreets并在12345打出一个虚假的地址,如:

Street: 999 Sdf sdf

街:999 Sdf sdf

ZIP Code: 12345

邮政编码:12345

When you try to verify that, notice that... it's VALID! Why? The USPS will deliver a piece to the receptacle for that unique ZIP code, but at that point, it's up to GE to distribute it. Pretty much anything internal to the ZIP code is irrelevant to the USPS, including the street address (technically "delivery line 1"). Many universities function in a similar manner. Here's more information regarding that.

当您尝试验证时,请注意......它有效!为什么? USPS将为插件提供一个独特的邮政编码,但在那时,由GE来分发它。邮政编码内部的任何内容都与USPS无关,包括街道地址(技术上称为“交付线1”)。许多大学以类似的方式运作。以下是有关此内容的更多信息。

Now, try the same bogus address, but without a ZIP code, and instead do the city/state:

现在,尝试相同的虚假地址,但没有邮政编码,而是做城市/州:

Street: 999 Sdf sdf

街:999 Sdf sdf

City: Schenectady

城市:斯克内克塔迪

State: NY

州:纽约州

It doesn't validate. This is because even though Schenectady contains 12345, where the address is "valid," it geometrically intersects with the "real" ZIP codes for Schenectady.

它没有验证。这是因为即使Schenectady包含12345,其中地址是“有效的”,它几何上与Schenectady的“真实”邮政编码相交。

Take another instance: military. Certain naval ships have their own ZIP codes. Military addresses are an entirely different class of addresses using the same namespace. Ships move. Geographical coordinates don't.

再举一个例子:军事。某些海军舰艇有自己的邮政编码。军事地址是使用相同名称空间的完全不同的地址类。船只移动。地理坐标没有。

ZIP precision is another fun one. 5-digit ZIP codes are the least "precise" (though the term "specific" might be more meaningful here, since ZIP codes don't pinpoint anything). 7- and 9-digit ZIP codes are the most specific, often down to block or neighborhood-level in urban areas. But since each ZIP code is a different size, it's really hard to tell what actual distances you're talking.

ZIP精度是另一个有趣的。 5位邮政编码是最不“精确”的(尽管术语“具体”在这里可能更有意义,因为邮政编码没有指出任何东西)。 7位和9位邮政编码是最具体的,通常是城市地区的街区或街区。但由于每个邮政编码的大小不同,因此很难说出您正在谈论的实际距离。

A 9-digit ZIP code might be portioned to a floor of a building, so there you have overlapping ZIP codes for potentially hundreds of addresses.

9位邮政编码可能会被分配到建筑物的楼层,因此您可能会有数百个地址重叠的邮政编码。

Bottom line: ZIP codes don't, contrary to popular belief, provide geographical or boundary data. They vary widely and are actually quite un-helpful unless you're delivering mail or packages... but the USPS' job was to design efficient carrier routes, not partition the population into coordinate regions so much.

底线:与普遍看法相反,邮政编码不提供地理或边界数据。它们差别很大,除非你提供邮件或包裹,否则实际上没有帮助......但USPS的工作是设计有效的运输路线,而不是将人口分配到协调区域。

That's more the job of the census bureau. They've compiled a list of cartographic boundaries since ZIP codes are "convenient" to work with. To do this, they sectioned bunches of addresses into census blocks. Then, they aggregated USPS ZIP code data to find the relation between their census blocks (which has some rough coordinate data) and the ZIP codes. Thus, we have approximations of what it would look like to plot a line as a polygon. (Apparently, they converted a 1D line into a 2D polygon by transforming a 2D polygon based on its contents to fit linear data -- for each non-unique, regular ZIP code.)

这更像是人口普查局的工作。他们编制了一个制图边界列表,因为邮政编码“方便”使用。为此,他们将成群地址划分为人口普查区块。然后,他们汇总USPS邮政编码数据,以找到他们的人口普查区块(有一些粗略的坐标数据)和邮政编码之间的关系。因此,我们将近似于将线绘制为多边形的样子。 (显然,他们通过基于其内容变换2D多边形来将1D线转换为2D多边形以适合线性数据 - 对于每个非唯一的常规邮政编码。)

From their website (link above):

从他们的网站(上面的链接):

A ZIP Code tabulation area (ZCTA) is a statistical geographic entity that approximates the delivery area for a U.S. Postal Service five-digit or three-digit ZIP Code. ZCTAs are aggregations of census blocks that have the same predominant ZIP Code associated with the addresses in the U.S. Census Bureau's Master Address File (MAF). Three-digit ZCTA codes are applied to large contiguous areas for which the U.S. Census Bureau does not have five-digit ZIP Code information in its MAF. ZCTAs do not precisely depict ZIP Code delivery areas, and do not include all ZIP Codes used for mail delivery. The U.S. Census Bureau has established ZCTAs as a new geographic entity similar to, but replacing, data tabulations for ZIP Codes undertaken in conjunction with the 1990 and earlier censuses.

邮政编码列表区域(ZCTA)是统计地理实体,其近似于美国邮政服务五位或三位邮政编码的递送区域。 ZCTA是人口普查区块的聚合,其具有与美国人口普查局的主地址文件(MAF)中的地址相关联的相同的主要邮政编码。三位数的ZCTA代码适用于大型连续区域,美国人口普查局在其MAF中没有五位数的邮政编码信息。 ZCTA没有精确描述邮政编码交付区域,也没有包括用于邮件传递的所有邮政编码。美国人口普查局已将ZCTA建立为一个新的地理实体,类似于,但取代了与1990年及之前的人口普查相结合的邮政编码数据表。

The USCB's dataset is incomplete, and at times inaccurate. Google still has holes in their data, too (the 12345 is a somewhat good example) -- but Google will patch it eventually by going over each address and ZIP code by hand. They do this already, but haven't made all their map data perfect quite yet. Naturally, access to this data is limited to API terms, and it's very expensive to raise these.

USCB的数据集不完整,有时不准确。谷歌的数据仍然存在漏洞(12345就是一个很好的例子) - 但谷歌最终会通过手动遍历每个地址和邮政编码来修补它。他们已经这样做了,但还没有完成他们所有的地图数据。当然,对这些数据的访问仅限于API术语,并且提高这些数据非常昂贵。

Phew. I'm beat. I hope that helps clarify things. Disclaimer: I used to be a developer at SmartyStreets. More information on geocoding with address data.

唷。我被打败了。我希望这有助于澄清事情。免责声明:我曾经是SmartyStreets的开发人员。有关使用地址数据进行地理编码的更多信息。

Even more information about ZIP codes.

有关邮政编码的更多信息。

#2


1  

What you are asking for is a service to provide "Free Zip code Geocoding". There are a few out there with varying quality. You're going to have a bad time coding something like this yourself because of a few reasons:

您要求的是提供“免费邮政编码地理编码”的服务。有一些有不同的质量。由于以下几个原因,你自己编写类似这样的东西的时间会很糟糕:

  1. Zip codes can be assigned to a single building or to a post office.
  2. 邮政编码可以分配到单个建筑物或邮局。
  3. Zip codes are NOT considered a polygonal area. Projecting Zip codes to a polygonal area will require you to make an educated guess where the boundary is between one zipcode and the next.
  4. 邮政编码不被视为多边形区域。将Zip代码投影到多边形区域将需要您进行有根据的猜测,其中边界位于一个邮政编码和下一个邮政编码之间。
  5. ZIP code address data specifies only a center location for the ZIP code. Zip code data provides the general vicinity of an address. Mailing addresses that exist between one zipcode and another can be in dispute on which zipcode it actually is in.
  6. 邮政编码地址数据仅指定邮政编码的中心位置。邮政编码数据提供地址的一般附近。一个邮政编码与另一个邮政编码之间存在的邮件地址可能与它实际所在的邮政编码存在争议。
  7. A mailing address may be physically closer to zipcode 11111, yet its official zip code is a more distant zip code point 11112.
  8. 邮寄地址可以在物理上更靠近邮政编码11111,但其官方邮政编码是更远的邮政编码点11112。

Google Maps has a geocoding API:

Google地图具有地理编码API:

The google maps API is client-side javascript. You can directly query the geocoding system from php using an http request. However, google maps only gives you what the United States Postal Service gives them. A point representing the center of the zipcode.

谷歌地图API是客户端JavaScript。您可以使用http请求直接从php查询地理编码系统。但是,谷歌地图只能为您提供美国邮政服务所提供的服务。表示邮政编码中心的点。

https://developers.google.com/maps/#Geocoding_Examples

https://developers.google.com/maps/#Geocoding_Examples

map city/zipcode polygons using google maps

使用谷歌地图映射城市/邮政编码多边形

Thoughts on projecting a zipcode to its lat/long bounding box

关于将zipcode投影到其lat / long边界框的想法

There are approximately 43,000 ZIP Codes in the United States. This number fluctuates from month to month, depending on the number of changes made. The zipcodes used by the USPS are not represented as polygons and do not have hard and fast boundaries.

美国大约有43,000个邮政编码。此数字每月波动,具体取决于所做的更改次数。 USPS使用的zipcodes不表示为多边形,并且没有硬边界和快边界。

The USPS (United States Postal Service) is the authority that defines each zipcode lat/long. Any software which resolves a zipcode to a geographical location would be in need of weekly updates. One company called alignstar provides demographics and GIS data of zipcodes ( http://www.alignstar.com/data.html ).

USPS(美国邮政服务)是定义每个zipcode / lat的权限。任何将邮政编码解析到地理位置的软件都需要每周更新。一家名为alignstar的公司提供了zipcodes的人口统计数据和GIS数据(http://www.alignstar.com/data.html)。

Given a physical (mailing) address, find the geographical coordinates in order to display that location on a map.

给定物理(邮寄)地址,找到地理坐标以便在地图上显示该位置。

If you want to reliably project what shape the zipcode is in, you are going to need to brute force it and ask: "give me every street address by zipcode", then paint boxes around those mis-shapen blobs. Then you can get a general feel for what geographical areas the zipcodes cover.

如果你想要可靠地预测邮政编码的形状,你将需要暴力强迫它并询问:“通过邮政编码给我每个街道地址”,然后在那些误形状的blob周围绘制框。然后,您可以全面了解邮政编码覆盖的地理区域。

http://vterrain.org/Culture/geocoding.html

http://vterrain.org/Culture/geocoding.html

If you were to throw millions of mailing address points into an algorithm resolving every one to a lat/long, you might be able to build a rudimentary blob bounding box of that zipcode. You would have to re-run this algorithm and it would theoretically heal itself whenever the zipcode numbers move.

如果你要将数百万个邮件地址点扔进一个算法,将每一个解析为纬度/经度,你就可以构建一个该邮政编码的基本blob边界框。你必须重新运行这个算法,理论上它会在邮政编码移动时自行修复。

Other ideas

其他想法

http://shop.delorme.com/OA_HTML/DELibeCCtpSctDspRte.jsp?section=10075

http://shop.delorme.com/OA_HTML/DELibeCCtpSctDspRte.jsp?section=10075

http://www.zip-codes.com/zip-code-map-boundary-data.asp

http://www.zip-codes.com/zip-code-map-boundary-data.asp

#3


0  

I think this is what you need it uses US Census as repository: US Zipcode Boundaries API: https://www.mashape.com/vanitysoft/boundaries-io

我认为这是你需要它使用美国人口普查作为存储库:美国邮政编码边界API:https://www.mashape.com/vanitysoft/boundaries-io

Above API shows US Boundaries(GeoJson) by zipcode,city, and state. you should use the API programatically to handle large results.

以上API按邮政编码,城市和州显示US Boundaries(GeoJson)。您应该以编程方式使用API​​来处理大型结果。

如何获取美国邮政(zip)代码的边界坐标?

#4


-1  

I think the world geoJson link and the google map geocode api can help you. example: you can use the geocode api to code the zip,you will get the city,state,country,then,you search from the world and us geoJson get the boundry,I have an example of US State boundry,like dsdlink

我认为世界geoJson链接和谷歌地图geocode api可以帮助你。例如:你可以使用geocode api来编码zip,你将获得城市,州,国家,然后,你从世界上搜索我们geoJson获得边界,我有一个美国国家边界的例子,如dsdlink

#1


45  

An elaboration of my comment, that ZIP codes are not polygons....

详细说明我的评论,邮政编码不是多边形....

We often think of ZIP codes as areas (polygons) because we say, "Oh, I live in this ZIP code..." which gives the impression of a containing region, and maybe the fact that ZIP stands for "Zone Improvement Plan" helps the false association with polygons.

我们经常将邮政编码视为区域(多边形),因为我们说,“哦,我住在这个邮政编码中......”给人的印象是包含区域,也许ZIP代表“区域改进计划”有助于与多边形的错误关联。

In actuality, ZIP codes are lines which represent, in a sense, mail carrier routes. Geometrically, lines do not have area. Just as lines are strings of points along a coordinate plane, ZIP code lines are strings of delivery points in the abstract space of USPS-designated addresses.

实际上,邮政编码是在某种意义上代表邮递员路线的线。几何上,线条没有区域。正如线是沿坐标平面的点串,邮政编码线是USPS指定地址的抽象空间中的交付点串。

They are not correlated to geographical coordinates. What you will find, though, is that they appear to be geographically oriented because it would be inefficient for carriers to have a route completely irrelevant of distance and location.

它们与地理坐标无关。然而,你会发现它们似乎是地理位置导向的,因为对于航空公司来说,拥有与距离和位置完全无关的路线是低效的。

What is this "abstract space of USPS-designated addresses"? That's how I am describing the large and mysterious database of deliverable locations maintained by the US Postal Service. Addresses are not allotted based on geography, but on the routes that carriers travel which usually relates to streets and travelability.

什么是USPS指定地址的“抽象空间”?这就是我描述由美国邮政局维护的大型神秘的可交付地点数据库的方式。地址不是根据地理位置分配的,而是根据航空公司旅行的路线分配的,这些路线通常与街道和可行驶性有关。

Some 5-digit ZIP codes are only a single building, or a complex of buildings. These are "unique" ZIPs. Companies and universities frequently get their own ZIP codes for marketing or organizational purposes. For instance, the ZIP code "12345" belongs to General Electric up in Schenectady, NY. (Edit: In a previous version of Google Maps, when you follow that link, you'd notice that the placement marker was hovering, because it points to a ZIP code, which is not a coordinate. While most US ZIP codes used to show a region on Google Maps, these types cannot because the USPS does not "own" them, so to speak, and they have no area.)

一些5位数的邮政编码只是一栋建筑物或一幢建筑群。这些是“独特的”ZIP。公司和大学经常出于营销或组织目的获得自己的邮政编码。例如,邮政编码“12345”属于纽约斯克内克塔迪的通用电气公司。 (编辑:在以前版本的Google地图中,当您点击该链接时,您会注意到展示位置标记悬停,因为它指向的是邮政编码,而不是坐标。虽然大多数美国邮政编码用于显示谷歌地图上的一个区域,这些类型不能,因为USPS不“拥有”它们,可以这么说,它们没有区域。)

Just for fun, let's try verifying an address in a unique ZIP code. Head over to SmartyStreets and punch in a bogus address in 12345, like:

只是为了好玩,让我们尝试用唯一的邮政编码验证地址。前往SmartyStreets并在12345打出一个虚假的地址,如:

Street: 999 Sdf sdf

街:999 Sdf sdf

ZIP Code: 12345

邮政编码:12345

When you try to verify that, notice that... it's VALID! Why? The USPS will deliver a piece to the receptacle for that unique ZIP code, but at that point, it's up to GE to distribute it. Pretty much anything internal to the ZIP code is irrelevant to the USPS, including the street address (technically "delivery line 1"). Many universities function in a similar manner. Here's more information regarding that.

当您尝试验证时,请注意......它有效!为什么? USPS将为插件提供一个独特的邮政编码,但在那时,由GE来分发它。邮政编码内部的任何内容都与USPS无关,包括街道地址(技术上称为“交付线1”)。许多大学以类似的方式运作。以下是有关此内容的更多信息。

Now, try the same bogus address, but without a ZIP code, and instead do the city/state:

现在,尝试相同的虚假地址,但没有邮政编码,而是做城市/州:

Street: 999 Sdf sdf

街:999 Sdf sdf

City: Schenectady

城市:斯克内克塔迪

State: NY

州:纽约州

It doesn't validate. This is because even though Schenectady contains 12345, where the address is "valid," it geometrically intersects with the "real" ZIP codes for Schenectady.

它没有验证。这是因为即使Schenectady包含12345,其中地址是“有效的”,它几何上与Schenectady的“真实”邮政编码相交。

Take another instance: military. Certain naval ships have their own ZIP codes. Military addresses are an entirely different class of addresses using the same namespace. Ships move. Geographical coordinates don't.

再举一个例子:军事。某些海军舰艇有自己的邮政编码。军事地址是使用相同名称空间的完全不同的地址类。船只移动。地理坐标没有。

ZIP precision is another fun one. 5-digit ZIP codes are the least "precise" (though the term "specific" might be more meaningful here, since ZIP codes don't pinpoint anything). 7- and 9-digit ZIP codes are the most specific, often down to block or neighborhood-level in urban areas. But since each ZIP code is a different size, it's really hard to tell what actual distances you're talking.

ZIP精度是另一个有趣的。 5位邮政编码是最不“精确”的(尽管术语“具体”在这里可能更有意义,因为邮政编码没有指出任何东西)。 7位和9位邮政编码是最具体的,通常是城市地区的街区或街区。但由于每个邮政编码的大小不同,因此很难说出您正在谈论的实际距离。

A 9-digit ZIP code might be portioned to a floor of a building, so there you have overlapping ZIP codes for potentially hundreds of addresses.

9位邮政编码可能会被分配到建筑物的楼层,因此您可能会有数百个地址重叠的邮政编码。

Bottom line: ZIP codes don't, contrary to popular belief, provide geographical or boundary data. They vary widely and are actually quite un-helpful unless you're delivering mail or packages... but the USPS' job was to design efficient carrier routes, not partition the population into coordinate regions so much.

底线:与普遍看法相反,邮政编码不提供地理或边界数据。它们差别很大,除非你提供邮件或包裹,否则实际上没有帮助......但USPS的工作是设计有效的运输路线,而不是将人口分配到协调区域。

That's more the job of the census bureau. They've compiled a list of cartographic boundaries since ZIP codes are "convenient" to work with. To do this, they sectioned bunches of addresses into census blocks. Then, they aggregated USPS ZIP code data to find the relation between their census blocks (which has some rough coordinate data) and the ZIP codes. Thus, we have approximations of what it would look like to plot a line as a polygon. (Apparently, they converted a 1D line into a 2D polygon by transforming a 2D polygon based on its contents to fit linear data -- for each non-unique, regular ZIP code.)

这更像是人口普查局的工作。他们编制了一个制图边界列表,因为邮政编码“方便”使用。为此,他们将成群地址划分为人口普查区块。然后,他们汇总USPS邮政编码数据,以找到他们的人口普查区块(有一些粗略的坐标数据)和邮政编码之间的关系。因此,我们将近似于将线绘制为多边形的样子。 (显然,他们通过基于其内容变换2D多边形来将1D线转换为2D多边形以适合线性数据 - 对于每个非唯一的常规邮政编码。)

From their website (link above):

从他们的网站(上面的链接):

A ZIP Code tabulation area (ZCTA) is a statistical geographic entity that approximates the delivery area for a U.S. Postal Service five-digit or three-digit ZIP Code. ZCTAs are aggregations of census blocks that have the same predominant ZIP Code associated with the addresses in the U.S. Census Bureau's Master Address File (MAF). Three-digit ZCTA codes are applied to large contiguous areas for which the U.S. Census Bureau does not have five-digit ZIP Code information in its MAF. ZCTAs do not precisely depict ZIP Code delivery areas, and do not include all ZIP Codes used for mail delivery. The U.S. Census Bureau has established ZCTAs as a new geographic entity similar to, but replacing, data tabulations for ZIP Codes undertaken in conjunction with the 1990 and earlier censuses.

邮政编码列表区域(ZCTA)是统计地理实体,其近似于美国邮政服务五位或三位邮政编码的递送区域。 ZCTA是人口普查区块的聚合,其具有与美国人口普查局的主地址文件(MAF)中的地址相关联的相同的主要邮政编码。三位数的ZCTA代码适用于大型连续区域,美国人口普查局在其MAF中没有五位数的邮政编码信息。 ZCTA没有精确描述邮政编码交付区域,也没有包括用于邮件传递的所有邮政编码。美国人口普查局已将ZCTA建立为一个新的地理实体,类似于,但取代了与1990年及之前的人口普查相结合的邮政编码数据表。

The USCB's dataset is incomplete, and at times inaccurate. Google still has holes in their data, too (the 12345 is a somewhat good example) -- but Google will patch it eventually by going over each address and ZIP code by hand. They do this already, but haven't made all their map data perfect quite yet. Naturally, access to this data is limited to API terms, and it's very expensive to raise these.

USCB的数据集不完整,有时不准确。谷歌的数据仍然存在漏洞(12345就是一个很好的例子) - 但谷歌最终会通过手动遍历每个地址和邮政编码来修补它。他们已经这样做了,但还没有完成他们所有的地图数据。当然,对这些数据的访问仅限于API术语,并且提高这些数据非常昂贵。

Phew. I'm beat. I hope that helps clarify things. Disclaimer: I used to be a developer at SmartyStreets. More information on geocoding with address data.

唷。我被打败了。我希望这有助于澄清事情。免责声明:我曾经是SmartyStreets的开发人员。有关使用地址数据进行地理编码的更多信息。

Even more information about ZIP codes.

有关邮政编码的更多信息。

#2


1  

What you are asking for is a service to provide "Free Zip code Geocoding". There are a few out there with varying quality. You're going to have a bad time coding something like this yourself because of a few reasons:

您要求的是提供“免费邮政编码地理编码”的服务。有一些有不同的质量。由于以下几个原因,你自己编写类似这样的东西的时间会很糟糕:

  1. Zip codes can be assigned to a single building or to a post office.
  2. 邮政编码可以分配到单个建筑物或邮局。
  3. Zip codes are NOT considered a polygonal area. Projecting Zip codes to a polygonal area will require you to make an educated guess where the boundary is between one zipcode and the next.
  4. 邮政编码不被视为多边形区域。将Zip代码投影到多边形区域将需要您进行有根据的猜测,其中边界位于一个邮政编码和下一个邮政编码之间。
  5. ZIP code address data specifies only a center location for the ZIP code. Zip code data provides the general vicinity of an address. Mailing addresses that exist between one zipcode and another can be in dispute on which zipcode it actually is in.
  6. 邮政编码地址数据仅指定邮政编码的中心位置。邮政编码数据提供地址的一般附近。一个邮政编码与另一个邮政编码之间存在的邮件地址可能与它实际所在的邮政编码存在争议。
  7. A mailing address may be physically closer to zipcode 11111, yet its official zip code is a more distant zip code point 11112.
  8. 邮寄地址可以在物理上更靠近邮政编码11111,但其官方邮政编码是更远的邮政编码点11112。

Google Maps has a geocoding API:

Google地图具有地理编码API:

The google maps API is client-side javascript. You can directly query the geocoding system from php using an http request. However, google maps only gives you what the United States Postal Service gives them. A point representing the center of the zipcode.

谷歌地图API是客户端JavaScript。您可以使用http请求直接从php查询地理编码系统。但是,谷歌地图只能为您提供美国邮政服务所提供的服务。表示邮政编码中心的点。

https://developers.google.com/maps/#Geocoding_Examples

https://developers.google.com/maps/#Geocoding_Examples

map city/zipcode polygons using google maps

使用谷歌地图映射城市/邮政编码多边形

Thoughts on projecting a zipcode to its lat/long bounding box

关于将zipcode投影到其lat / long边界框的想法

There are approximately 43,000 ZIP Codes in the United States. This number fluctuates from month to month, depending on the number of changes made. The zipcodes used by the USPS are not represented as polygons and do not have hard and fast boundaries.

美国大约有43,000个邮政编码。此数字每月波动,具体取决于所做的更改次数。 USPS使用的zipcodes不表示为多边形,并且没有硬边界和快边界。

The USPS (United States Postal Service) is the authority that defines each zipcode lat/long. Any software which resolves a zipcode to a geographical location would be in need of weekly updates. One company called alignstar provides demographics and GIS data of zipcodes ( http://www.alignstar.com/data.html ).

USPS(美国邮政服务)是定义每个zipcode / lat的权限。任何将邮政编码解析到地理位置的软件都需要每周更新。一家名为alignstar的公司提供了zipcodes的人口统计数据和GIS数据(http://www.alignstar.com/data.html)。

Given a physical (mailing) address, find the geographical coordinates in order to display that location on a map.

给定物理(邮寄)地址,找到地理坐标以便在地图上显示该位置。

If you want to reliably project what shape the zipcode is in, you are going to need to brute force it and ask: "give me every street address by zipcode", then paint boxes around those mis-shapen blobs. Then you can get a general feel for what geographical areas the zipcodes cover.

如果你想要可靠地预测邮政编码的形状,你将需要暴力强迫它并询问:“通过邮政编码给我每个街道地址”,然后在那些误形状的blob周围绘制框。然后,您可以全面了解邮政编码覆盖的地理区域。

http://vterrain.org/Culture/geocoding.html

http://vterrain.org/Culture/geocoding.html

If you were to throw millions of mailing address points into an algorithm resolving every one to a lat/long, you might be able to build a rudimentary blob bounding box of that zipcode. You would have to re-run this algorithm and it would theoretically heal itself whenever the zipcode numbers move.

如果你要将数百万个邮件地址点扔进一个算法,将每一个解析为纬度/经度,你就可以构建一个该邮政编码的基本blob边界框。你必须重新运行这个算法,理论上它会在邮政编码移动时自行修复。

Other ideas

其他想法

http://shop.delorme.com/OA_HTML/DELibeCCtpSctDspRte.jsp?section=10075

http://shop.delorme.com/OA_HTML/DELibeCCtpSctDspRte.jsp?section=10075

http://www.zip-codes.com/zip-code-map-boundary-data.asp

http://www.zip-codes.com/zip-code-map-boundary-data.asp

#3


0  

I think this is what you need it uses US Census as repository: US Zipcode Boundaries API: https://www.mashape.com/vanitysoft/boundaries-io

我认为这是你需要它使用美国人口普查作为存储库:美国邮政编码边界API:https://www.mashape.com/vanitysoft/boundaries-io

Above API shows US Boundaries(GeoJson) by zipcode,city, and state. you should use the API programatically to handle large results.

以上API按邮政编码,城市和州显示US Boundaries(GeoJson)。您应该以编程方式使用API​​来处理大型结果。

如何获取美国邮政(zip)代码的边界坐标?

#4


-1  

I think the world geoJson link and the google map geocode api can help you. example: you can use the geocode api to code the zip,you will get the city,state,country,then,you search from the world and us geoJson get the boundry,I have an example of US State boundry,like dsdlink

我认为世界geoJson链接和谷歌地图geocode api可以帮助你。例如:你可以使用geocode api来编码zip,你将获得城市,州,国家,然后,你从世界上搜索我们geoJson获得边界,我有一个美国国家边界的例子,如dsdlink