forked from covid19india/covid19india-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add script for pre-projecting maps
1 parent
aca55e0
commit 6a29011
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
WIDTH=432 | ||
HEIGHT=488 | ||
|
||
SCRIPT_DIR=$(dirname $0) | ||
MAPS_DIR=${SCRIPT_DIR}/../public/maps | ||
OUTPUT_DIR=${SCRIPT_DIR}/../public/projected_maps | ||
|
||
mkdir -p "${OUTPUT_DIR}" | ||
|
||
for file in ${MAPS_DIR}/*.json; do | ||
fn=$(basename ${file}) | ||
topo2geo districts=- -i "$file" | geoproject "d3.geoMercator().fitSize([${WIDTH}, ${HEIGHT}], d)" | geo2topo districts=- -o "${OUTPUT_DIR}/${fn}" | ||
done | ||
|
||
topomerge states=districts -k 'd.properties.st_nm' "${OUTPUT_DIR}/india.json" -o "${OUTPUT_DIR}/india_merged.json" | ||
|
||
mv "${OUTPUT_DIR}/india_merged.json" "${OUTPUT_DIR}/india.json" | ||
prettier --loglevel silent --write "$OUTPUT_DIR" | ||
|