Skip to content

Commit

Permalink
Feat: Add script for pre-projecting maps
Browse files Browse the repository at this point in the history
shuklaayush committed Jul 2, 2020

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent aca55e0 commit 6a29011
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/project-maps.sh
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"

0 comments on commit 6a29011

Please sign in to comment.