Oregon post offices with longitude and latitude

I have uswest.pbf and taginfo-db.db and would like to get a list of the post offices in, say, Oregon along with their longitude and latitude. I have plenty of disk space and am comfortable with Postgres and SQLite.

If you want to extract data from large areas, you can use GeoDesk, an open-source toolkit for OSM. For basic use cases, the command-line tool is sufficient (You can also create full-blown geospatial applications in Java or Python)

First, turn your .osm.pbf into a GOL (a compact database designed for OSM features):

gol build my_database my_osm_data.osm.pbf

This creates my_database.gol, which will be about 50% larger than the .osm.pbf file, and will typically take a few minutes (state or country) to an hour (full planet) to create.

Then you can run queries – for example, to extract all post offices (with name and lon/lat) as a CSV spreadsheet:

gol query my_gol "na[amenity=post_office]" -t=name,lon,lat -f=csv

(There are lots more query options, documented here)