block by maptastik fc888b0ad9fef4ac301e9615a877b24a

LFUCG's live traffic cams and process to GeoJSONify the data (5/26/16)

Convert LFUCG traffic camera json into GeoJSON

LFUCG released their live traffic cam map. There are more cameras on this map than in the dataset on the open data portal. There are also links to the traffic streams. This gist has the JSON data used in LFUCG’s map, a Python script for turning that JSON into more easily mapable GeoJSON, and GeoJSON of that data itself.

What you’ll need/want

Process

  1. Make a new project directory. This example uses lex-traffic-camera but you can use whatever you want.

  2. Add json2geojson.py to your directory.

  3. Download[1] the traffic camera JSON from this gist using cURL:

      curl https://gist.githubusercontent.com/maptastik/fc888b0ad9fef4ac301e9615a877b24a/raw/3a54f02d8cb17bb808f6eb126f0c1a3f5779f6dd/lfucg-live-traffic-cams.json > lfucg-live-traffic-cams.json
  4. Run json2geojson.py specifying the data you just downloaded as your input and specifiying the name of your outputted GeoJSON.

     python json2geojson.py lfucg-live-traffic-cams.json lfucg-live-traffic-cams.geojson
  5. Check out your output in geojson.io[2]

[1] You can also copy if from the page source. The data were stored in a variable camMarker beginning on line 334. This might change so you may have to do some poking around the source for the data. At any rate, you can copy the contents of the camMarker variable and use that as the JSON data to convert to GeoJSON as well.

[2] Supposedly you can use geojsonio-cli to open up this directly from the command line. I keep getting an error that the output is not valid GeoJSON although I’ve run it through linters without error. Alas…

json2geojson.py