EDIT/UPDATE -- I never figured out the error message, but new day, try again, this post helped: How to add properties to topojson file?
and the way to marry it was this, add a second NAME
topojson -o output.json --id-property=NAME,NAME -p -e counties.csv CountiesTopo.json
I have a nice topojson that shows all the counties in Georgia. It loads, displays fine. I converted it from .shp with shpescape.com
BUT! I want to blend it with some external properties, the graduation rate for each county as stored in a .csv. So I'm trying topojson at the command line.
GaCountiesTopo.json has a field called NAME; the data's capitalized. counties.csv has a field called NAME; the data's capitalized.
I tried this:
topojson \
-o output.json \
-e counties.csv \
-- id-property=NAME \
-p \
-- CountiesTopo.json
And got this:
fs.js:427
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory 'NAME'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at inputJson (/usr/local/lib/node_modules/topojson/bin/topojson:218:30)
at pop (/usr/local/lib/node_modules/topojson/node_modules/queue-async/queue.js:28:14)
at Object.q.defer (/usr/local/lib/node_modules/topojson/node_modules/queue-async/queue.js:59:11)
at /usr/local/lib/node_modules/topojson/bin/topojson:164:5
at Array.forEach (native)
at Object.<anonymous> (/usr/local/lib/node_modules/topojson/bin/topojson:163:8)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
No such file or directory 'NAME', eh? Is this a syntax error on my part? Or is it possible that the field name 'NAME' for some reason isn't matching up one-to-one? Or maybe somewhere there's a lonely county in the .json that doesn't have a counterpart in the .csv, like maybe I'm trying to match Screven with Scerven? 159 counties!
Hmm .. maybe my input, CountiesTopo.json has gotten screwed up? So, let's try this, just to see what happens:
-o output.json \
-p \
-- CountiesTopo.json
Well I plugged output.json back into my d3 code and it gave me a stripped-down map: just the outline of the state of Georgia: no counties!
So hmm … to explore topojson more, why not try converting my original .shp?
-o output.json \
-p \
-- input.shp
Gives me:
Trace: { [Error: ENOENT, open 'input.dbf'] errno: 34, code: 'ENOENT', path: 'input.dbf' }
at output (/usr/local/lib/node_modules/topojson/bin/topojson:232:29)
at notify (/usr/local/lib/node_modules/topojson/node_modules/queue-async/queue.js:49:26)
at EventEmitter.<anonymous> (/usr/local/lib/node_modules/topojson/node_modules/queue-async/queue.js:39:11)
at EventEmitter.emit (events.js:95:17)
at EventEmitter.ended (/usr/local/lib/node_modules/topojson/node_modules/shapefile/index.js:32:38)
at EventEmitter.emit (events.js:95:17)
at ReadStream.error (/usr/local/lib/node_modules/topojson/node_modules/shapefile/file.js:68:13)
at ReadStream.EventEmitter.emit (events.js:95:17)
at fs.js:1500:12
at Object.oncomplete (fs.js:107:15)
Something wrong with my input, eh? FWIW It's a U.S. Census Tiger shape file.
What do you think? How can I marry my .csv into my .json?
Thanks!