Data & Tools for NYC Space/Time Directory
Latest commit 22e0e20 Dec 21, 2016 @bertspaan bertspaan committed on GitHub added filter by year example
Permalink
Failed to load latest commit information.
README.md added filter by year example Dec 21, 2016
geojson.io.png initial commit Oct 20, 2016

README.md

NYC Space/Time Directory - Data & Tools

This repository lists resources useful when working with NYC Space/Time Directory data.

Datasets

See http://spacetime.nypl.org/#data

Ontology

See https://github.com/nypl-spacetime/ontology

Tools

Examples

The examples below use the following tools:

  • jq: command-line JSON processor, install with brew install jq
  • ndjson-cli: command-line tools for operating on newline-delimited JSON streams, install with npm install -g ndjson-cli
  • spacetime-cli: command-line tools for Space/Time data, install with npm install -g nypl-spacetime/spacetime-cli

Convert Space/Time data to JSON

Download Space/Time Map Warper data and convert to JSON array:

curl http://s3.amazonaws.com/spacetime-nypl-org/\
datasets/mapwarper/mapwarper.objects.ndjson \
| spacetime-to-json

Use jq to only display the ID and the area the map depicts:

curl http://s3.amazonaws.com/spacetime-nypl-org/\
datasets/mapwarper/mapwarper.objects.ndjson \
| spacetime-to-json | \
jq '.[] | {id: .id, area: .data.area}'

Use ndjson-filter to filter Building Inspector data by year, and save the resulting GeoJSON file to disk:

curl http://s3.amazonaws.com/spacetime-nypl-org/\
datasets/building-inspector/building-inspector.objects.ndjson \
| ndjson-filter 'd.validSince > 1880' | spacetime-to-geojson > \
~/Downloads/building-inspector-1880.geojson

Use ndjson-map to only display the ID and the name, and then grep for Harlem:

curl http://s3.amazonaws.com/spacetime-nypl-org/\
datasets/mapwarper/mapwarper.objects.ndjson \
| ndjson-map '`${d.id} - ${d.name}`' | grep Harlem

Convert Space/Time data to GeoJSON

Download Map Warper data, filter maps which title includes broadway, convert to GeoJSON and copy to clipboard:

curl http://s3.amazonaws.com/spacetime-nypl-org/\
datasets/mapwarper/mapwarper.objects.ndjson \
| ndjson-filter 'd.name && d.name.toLowerCase().includes("broadway")' \
| spacetime-to-geojson | pbcopy

Then, we can paste this GeoJSON data into geojson.io: