OpenStreetMap Forum

The Free Wiki World Map

You are not logged in.

#1 2019-01-28 13:00:03

sabyasachi_gupta
Member
Registered: 2019-01-24
Posts: 4

Extract zipcode , latitude and longitude information from a PBF file

My project requirement :
I have a project requirement where I need to create a database for the country of the United States of America containing the following columns:
Zip code
Latitude(of zip code)
Longitude(of zip code)
Zip code 1 ( which is at a distance of 10 miles from zip code)
Zip code 2 (which is at a distance of 25 miles from zip code)
Zip code 3 (which is at a distance of 50 miles from zip code)

My approach :
1.Download the OSM file (in PBF format ) for the country of united states of America
2.Convert the PBF file into a format which contains the zip code, latitude, and longitude information of USA.
3.Extract the information into the database

My Research
I tried using the site https://mygeodata.cloud/converter/osm-to-xlsx to convert pbf file into excel file. However, it had size limitations and I could not use it for free. I also searched the internet for various other formats in which the PBF file could be converted. I haven't got any such file format.

My Question :
I have downloaded the OSM(PBF) file for the entire country of the United States of America from http://download.geofabrik.de

Does these files contain the following information :
All zip codes in the USA
Latitude
Longitude

In which format can I convert the PBF file so that I can get the above information? Can I get a converter for free which allows the conversion so that I can extract all the relevant information for my database?

Any help will be appreciated

Offline

#2 2019-01-28 14:07:47

GerdP
Member
Registered: 2015-12-18
Posts: 818

Re: Extract zipcode , latitude and longitude information from a PBF file

Can you explain what the latitude of a zip code would be? My understanding is that a zip code is described by a closed ring, not by a single position.
Do you want to be able to retrieve the zip code for a given lat/lon pair or do want to draw the zip code area?

Offline

#3 2019-01-28 14:09:19

Richard
Member
From: Charlbury, UK
Registered: 2007-04-24
Posts: 364
Website

Re: Extract zipcode , latitude and longitude information from a PBF file

OSM really isn't the right tool for this. There are several zip code databases on the internet which you will find much, much easier to use. Downloading OSM for the US to get zip codes is a bit like memorising the entire Bible to get a recipe for unleavened bread.

Offline

#4 2019-01-28 18:10:24

alester
Member
Registered: 2011-09-21
Posts: 238

Re: Extract zipcode , latitude and longitude information from a PBF file

Cross-posted here

Offline

#5 2019-01-28 18:19:06

alester
Member
Registered: 2011-09-21
Posts: 238

Re: Extract zipcode , latitude and longitude information from a PBF file

GerdP wrote:

Can you explain what the latitude of a zip code would be? My understanding is that a zip code is described by a closed ring, not by a single position.

ZIP codes are not described by an area. They're an attribute assigned to each specific address by the US Postal Service. If you plot the locations of a single ZIP code on a map, it's often a very messy distribution and not something that could be easily described by a polygon. This site gives a bit of information about the problems with trying to group ZIP codes into polygons, including overlap, inconsistency, and a lack of contiguousness.

Offline

Board footer

Powered by FluxBB