How to get OSM latitude and longitude of each zip code polygon for USA

I would like to find the latitude and longitude of each zip code polygon for USA.

At the following link, I can find state, county and city/town levels. But, I cannot find zip-code level polygon data.

https://osm.wno-edv-service.de/boundaries/?zoom=3&lat=43.50488&lon=-124.45835&layers=0BT&selected=148838_161950_1116270_162018_161646_165475_161961_165794_162110_162069_162050_161957_306001_166563_162116_122586_161816_161650_161644_161655_224922_63512_162112_61315_165789_165471_161943_161638_162115_161648_165473_67213_224951_162014_61320_224045_161653_162061_161645_165476_162109_392915_224040_161652_161838_114690_161993_60759_224042_165479_162068_165466_161991

Also, is it possible to get the data from C# code ?

I do not want to download the data manually for each zip code one by one.

Any help would be appreciated.

Thanks!

There are no zip code polygons defined for the US. The information we do have was obtained from TIGER, as well as individual survey data points by individuals who collected the zip code.

Postal Zip Codes are proprietary to the US Postal service, and will not be in any public database.

Thanks !

I also need to get data of state and county borders from OSM.

is it possible to get the data from C# code ?

It is hard to get the data manually for 3000+ counties and 50 states.

Thanks!

If all the counties are in OSM, it is almost certain they came from some other machine readable source, and it would be better to use that source directly. Otherwise expect there to be gaps. This looks a likely good starting point: http://www.usgs.gov/science/cite-view.php?cite=528

You’ve already been told about overpass. If C# can issue HTTP GETs, and parse XML responses, it should be able to obtain whatever data is available in OSM. You will need to write suitable code to interpret the XML document object models. My guess is that little work has been done in MS .NET tools for this.

Thanks,

I have been searching an example of C# to access OSM through overpass API for some time.

But, I cannot find one.

I found some applications on
http://wiki.openstreetmap.org/wiki/Frameworks

but “OSM common” are for JavaScript.

“The Overpass API has been developed to perform read-only queries to the Openstreetmap database, using a powerful and flexible language known as Overpass QL. This post illustrates the syntax of this language with sample queries.”

Are there examples to show how to call overpass API from C# ?

Or, are there other APIs that can be called from C# to get data from OSM ?

Any help would be appreciated.

thanks

Did you try it? may be.
Did you ask me how to do it? No

Activate one state, right mouse, “select next admin level”, export and one state is done.

After that “deselect all children” and deactivate state. Goto next state.

Please don’t do that for more that 2-3 states in one export, because you will kill my server and i’ll have to block your account. If the spinning glass does not finish after about 60 seconds, stop and export.

Regards
walter

btw: there is no API yet, may be next year

There may not be direct examples of how to call the overpass API from C#, but the solution is to break the task into smaller parts:

  1. Determine the string that needs to be entered into a browser to get the desired Overpass results.

  2. Look at C# examples using the WebLClient() object. One example is at http://stackoverflow.com/questions/5401501/how-to-post-data-to-specific-url-using-webclient-in-c-sharp

  3. Look at C# examples to parse XML such as http://stackoverflow.com/questions/55828/how-does-one-parse-xml-files

The OSM county and state boundaries have all been ‘joined’ from what I have seen. There will always be a question of what is most accurate, but the OSM state and boundaries have been cleaned up, and in some cases the boundaries have been updated to follow physical features where it is known that those features define the boundary.

If you think, OSM-data is wrong or damaged, proof it and fix them. Don’t say: “Take other data from external sources, they may be better”.

That’s the OSM way :wink:

regards
walter

btw: there are a lot of quality tools to check and fix osm-data. e.g “Missing Boundaries” (see link in signature) or OSMI