1
votes

I used Mike Bostock's great tutorial to make a simple map using downloaded shapefiles and processing them with GDAL into GeoJSON files.

http://bost.ocks.org/mike/map/

I'm trying to build on this learning by taking a county-level shapefile map and marrying it with additional demographic data (CSV) so that I can load a single GeoJSON file and not have to use Javascript to merge the data at runtime. The goal is to have a county-level heatmap.

The CSV file has an ID column that looks like this: 01348. While the Shapefile has two ID columns that are 01 and 348.

Is it possible to use GeoJSON to store this kind of data? If so, what kind of terminal commands must I use to combine the two?

1

1 Answers

1
votes

Little trick:

  1. When converting from Shape file to GeoJSON, keep "id-a":"01";"id-b":"348" as neighbors in this order.
  2. use a simple regex to delete all ";"id-b":" and thus obtain "id-a":"01348".
  3. go ahead to inject your CSV property given the common ID, see: How to add properties to topojson file?

That's should work.