Tool
- d3-queue v3.0.7
- d3-request v1.0.6
- mapbox-gl v1.5.1
- topojson-client v3.1.0
- webpack v4.41.2
- webpack-cli v3.3.10
- webpack-dev-server v3.9.0
Environment
- node v8.16.2
- npm v6.13.2
Install package
npm install
serve
npm run start:dev
build
npm run build
-
prepare attribute data, ie some data cleaning and wrangling (R)
- import XLS files as a list (readr)
- clean, loop through and join all the files (dplyr, stringr)
- calculate the support rate in each region for each political camp(dplyr)
-
prepare shapefiles with attributes (QGIS)
- import shapefiles to QGIS (Layer => Add Layer)
- set projections for the shapefiles (Set CRS => Set Layer CRS...)
- join the attribute data with shapefiles (Properties => Joins)
-
prepare map tiles (QGIS)
- generate random dots in polygons (Processing Toolbox => random points inside polygons, using QGIS not later than 3.5)
- join attributes to dots (Vector => Data Management Tools => Join Attributes by Location...)
- set styles for different zoom levels (Properties => Symbology, duplicating multiple layers for different zoom levels)
- generate map tiles (Generate XYZ tiles, using QGIS later than 3.8)
-
prepare topojson (mapshaper)
- import shapefiles to mapshaper
- simplify shapefiles
- export them in topojson format
-
design interactive map (Javascript)
- set the development environment (node, npm)
- clone samples from Mapbox GL JS examples (Mapbox GL JS)
- tweak the code to make it works with our own topojson files (d3js)
- design tooltips for different zoom levels (Mapbox GL JS)
- design a fly-to feature via sleecting from options (Mapbox GL JS)
- bring in the map tiles (Mapbox GL JS)