Skip to content

nypl-spacetime/spacetime-data

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

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

Data Model & JSON Schemas

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

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 NYC Space/Time Directory data, install with npm install -g nypl-spacetime/spacetime-cli

Convert Data to JSON

Download Map Warper data from the NYC Space/Time Directory and convert to a 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 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:

About

Data & Tools for NYC Space/Time Directory

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published