Skip to content

civiccc/brigade-maps

Repository files navigation

brigade-maps

OCD Division ID (OCDID) Shapefiles

example map - CA-12

Installation

  1. install node 5.x via nodenv or via some package manager
  2. npm install This will download and install mapnik, the map rendering tool.
  3. Install GraphicsMagick (brew install GraphicsMagick)
  4. npm run render

Commands

To see all available commands, run:

export PATH=$(npm bin):$PATH
jake -T

Some common commands you might find useful:

Download all the Shapefiles

$(npm bin)/jake shapefiles

Render everything

$(npm bin)/jake render

Package GeoJSON for upload

$(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

Adding a New Map

To add a new map, follow the instructions in this commit message

Uploading to Cloudinary

  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

About

Maps of OCD Civic divisons for Brigade

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published