This repo is intended as an example/demo of taking the output from the REM model developed at MIT Tata center and quickly visualizing those results on an interactive web map.
To get set up, first:
- Install tippecanoe
- Install csvkit (
pip install csvkit
) - Install Node (v4 or higher)
- Clone this repo and run
npm install
Drop the raw output data in the data/raw
directory (which you'll need to
create), and then run:
make data/rem-customer-model.mbtiles
to make the customer locations data source.make data/rem-output/MODEL_RUN.mbtiles
, whereMODEL_RUN
should match up with the name of a top-level subdirectory ofdata/raw
(e.g. if there's data for a run indata/raw/Vaishali_Run_1
, then you'd domake data/rem-output/Vaishali_Run_1.mbtiles
)- (Alternatively,
make all-models
will attempt to build a model for each subdirectory ofdata/raw
-- use it likemake all-models -j 8
to take advantage of parallelization).
This does a few things:
- Converts the shapefiles to geojson (in
data/geojson
) - Merges each "type" of data into a single geojson:
Customers
,Generator
,Network
,Transformer
. The features from each individual file are given two new properties:voltage
andnetwork_type
, which are inferred from the original file names. (This step can easily be replaced if a different scheme is used later.) - Use
tippecanoe
to slice this data up into Mapbox Vector Tiles.
Now you can do:
# You'll need a Mapbox API token with uploads:write scope granted
export MapboxAccessToken=YOUR_TOKEN
make upload-model-runs MB_ACCOUNT=your_mapbox_account
Configure the Mapbox account details and specific tilesets (data sources) by editing app/config.js
Then, to build, just run npm run bundle
, which updates the the bundled javascript file in dist/
, and then commit the change to github.