In [1], an excellent tutorial is presented about the process of making maps. It is a little bit dated, so here I develop some Windows-based scripts that make it possible to follow these tutorials. The goal is two-fold:
- Make things work for Windows. I am comfortable with the Unix command line, but, by far, most of my colleagues are not. To allow for easier sharing, I used Windows CMD.
- Update the commands so they all function again. Some URLs have changed a little bit, and we need to use a specific version of d3. If you want to use the original Unix commands, and you encounter some issues, you may want to check how I repaired them.
The output format of these scripts is svg. SVG files are plain text, represent vectors (instead of bitmaps), and can be read directly by a standard web browser.
Part 1
The first thing to do is to install node.js if you don't have this available already. Using [2] this process is quite straightforward. Our first batch file will follow the steps in [1].
1 | ::--------------------------------------------------------------------------- |
Notes:
- The curl command is available on newer versions of Windows.
- Windows does not have unzip, but it has tar which can unzip files.
- Use https instead of HTTP.
- The use of quotes is different under Windows compared to Unix.
The result should be the following vector image displayed in your browser:
Part 2
1 | ::--------------------------------------------------------------------------- |
Notes:
- A key for using the Census Bureau data-API can be had from [3]. You need to update the script with your key before running it.
- We have to use v6 of d3 to be compatible with these command-line tools.
You should see something like:
Part 3
1 | ::--------------------------------------------------------------------------- |
Notes:
- Added commands to check the results.
Results:
part4
1 | ::--------------------------------------------------------------------------- |
Results:
References
- Mike Bostock, Command-line Cartography, part 1. https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c. The other parts (2 through 4) are linked from here.
- Node.js downloads, https://nodejs.org/en/download/. Download node.js (Javascript environment).
- https://api.census.gov/data/key_signup.html. A key is required to access the Census Bureau data-API.
- https://github.com/aopt/CLI-maps/archive/refs/heads/main.zip for downloading all batch scripts (without line numbers).