dkondor / osmconvert

Convert OpenStreetMap Data to TSV or Shapefile
6 stars 1 forks source link

How To Convert PBF file to CSV file? #1

Open cnowak7 opened 3 years ago

cnowak7 commented 3 years ago

Initially, I was thinking about writing a web crawler for this website:

https://ope.ed.gov/programs/maped/storymaps/trio/

This website has a map where each dot - when clicked - shows information for a student program. However, clicking a dot dynamically ADDS HTML to the page, so me writing a simple web crawler to extract information is no longer an option.

What I DID NOTICE - however - by using the Network tab in Chrome - was that when the page loads, it makes several calls to a service. Below is one of the request url's:

https://services1.arcgis.com/8U6HUsCFS1prqsf0/ArcGIS/rest/services/TRIO_Footprint/FeatureServer/2/query?f=pbf&where=1%3D1&returnGeometry=true&spatialRel=esriSpatialRelIntersects&outFields=*&outSR=102100&resultOffset=0&resultRecordCount=8000&resultType=tile&quantizationParameters=%7B%22mode%22%3A%22view%22%2C%22originPosition%22%3A%22upperLeft%22%2C%22tolerance%22%3A1.0583354500042335%2C%22extent%22%3A%7B%22xmin%22%3A-17574009.6147%2C%22ymin%22%3A771063.0683000013%2C%22xmax%22%3A19077724.760799997%2C%22ymax%22%3A9570952.275200002%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%7D

Opening this url in another tab makes Chrome download a PBF file (.pbf). This file looks super tough to parse, so I was wondering how to convert this file into a CSV? I did a little research and I imagine each "node" in this file has the following info I need (see example below):

Location Name / Program Type (this is included in the same name)

I found this tool (https://wiki.openstreetmap.org/wiki/Osmconvert) but I don't know how to run this on MAC OS. Any tips?

dkondor commented 3 years ago

Hi, I think you're looking for osm-c-tools which can output .osm (essentially an xml) from .pbf files (apparently the osmconvert name clashes with the one linked). They seem to be using GNU Autoconf that should work on a Mac too.