OCD Division ID (OCDID) Shapefiles
- install node 5.x via nodenv or via some package manager
npm install
This will download and install mapnik, the map rendering tool.- Install GraphicsMagick (
brew install GraphicsMagick
) npm run render
To see all available commands, run:
export PATH=$(npm bin):$PATH
jake -T
Some common commands you might find useful:
$(npm bin)/jake shapefiles
$(npm bin)/jake render
$(npm bin)/jake package-geojson
# then you will want to upload it with something like:
aws s3 cp build/tmp-geojson.tar.gz s3://brigade-development/geojson-districts.tar.gz --acl=public-read
To add a new map, follow the instructions in this commit message
node bin/upload.js > cloudinary_images.csv
# Recommended: use `jq` to count number of tiles to be uploaded, `pv` to show upload progress:
# node bin/upload.js | pv -ls ${ jq ‘. | length’ < build/tiles.json} > cloudinary_images.csv
Copy cloudinary_images.csv
to a Rails server, and then update the Districts
with the appropriate images from a Rails console:
open('cloudinary_images.csv') do |csv|
csv.readline # advance past headers
csv.each_line do |row|
ocdid, level, version, public_id = row.strip.split(',')
District.
joins(:civic_division).
where(level: level).
where(civic_divisions: { ocd_id: ocdid }).
update_all(image: "v#{version}/#{public_id}.png")
end
end