1

I've gone through Mike Bostock's excellent tutorials on Command-Line Cartography and I'm confused by his use of his ndjson-split utility. That program is used to split up an array of objects in a json file, putting each object in the array on a single line. (Reference: https://github.com/mbostock/ndjson-cli)

In Part Two of the tutorial (https://medium.com/@mbostock/command-line-cartography-part-2-c3a82c5c0f3#.624i8b4iy) Mike uses ndjson-split on a geojson file:

ndjson-split 'd.features' \
  < ca-albers.json \
  > ca-albers.ndjson

He explains:

The output here looks underwhelmingly similar to the ca-albers.json we saw previously; the only difference is that there is one feature (one census tract) per line.

However, it seems there is another big difference. The new file does not contain all of the data that was in the original file. Specifically, the start of the original JSON object, {"type":"FeatureCollection" ... is gone.

Mike doesn't explain why this additional key is not needed in the geojson file (the resulting files work perfectly).

Anyone know why? Is this key not needed for valid geoJSON?

Timothy Barmann
  • 598
  • 7
  • 17
  • To answer my own question, I think I see the answer. Later in the same tutorial, Mike adds back the missing property using `ndjson-map`. Note to Mike Bostock: you might want to explain that you are removing a property with `ndjson-split` but adding it back in with `ndjson-map`. – Timothy Barmann Feb 22 '17 at 16:55

0 Answers0