A geographic visualization of correspondence between abolitionists in the 19th century
This project consists of two parts:
- A parser for downloading data from the DPLA API
- A map that visualizes the data using LeafletJS
-
In order to use the parser you will need to install NodeJS.
-
After installing Node, you will need to install the project dependencies
- Open a command prompt window and navigate to the parser folder where the project is located
- Type
cd [directory where you saved the project]
- Type
- run
npm install
. This will create a folder callednode_modules
and will install the libraries you need into it.
- Open a command prompt window and navigate to the parser folder where the project is located
-
Create a file using notepad or another plain text editor called
config.json
in theparser
folder with the text below. Replace[API Key]
with your DPLA API key.{ "api_key": "[API Key]" }
-
From the command prompt window run
node get-data.js
. This will download the data into a file called letters.csv
Before running the map you will need to save the letters.csv
file you created with the parser into the main repository folder. The repo includes a sample letters file named letters-sample.csv
. To use this data set simply rename this file to letters.csv
. If you are using your own data, the map assumes that you have a file named letters.csv
with at least the following columns:
Field | Column Name |
---|---|
Sender | sender |
Recipient | recipient |
Title | title |
Link | link |
Date | date |
Place | place |
Sent Location | sentLocation |
Received Location | receivedLocation |
Sender Latitude | senderLat |
Sender Longitude | senderLng |
Receiver Latitude | receiverLat |
Receiver Longitude | receiverLng |
If you have a website with FTP access, the easiest thing to do is copy all the files in this repository to your web server in a folder called something like map
. The map should then be available on your website at that folder i.e. http://www.yourdomain.com/map
There are a number of ways to run a local web server, one of the easiest with Node is to use the node-server
module.
- Open a command line and navigate to the folder where the project is located.
- Run
npm install -g jitsu
- Run
jitsu install http-server
- Run
node http-server/bin/http-server
There will now be a server running by default on port 8080. To visit the map open a browser and go to http://localhost:8080
To stop the server you will hit Ctrl-C
. To start the server again, you don't need to download it again, just run node http-server/bin/http-server
All the code for the parser is contained in the parser
folder. At present this is a single file named get-data.js
, a configuration file named config.json
, and a package.json
for node installation.
The core code of the map is organized into four different files, all of which can be found in the js
folder:
controls.js
contains functions that handle the time line slider and filters.data.js
contains functions that load and handle the initial formatting of the CSV file.map.js
contains all the code which loads and displays the map layers, including filtering the layers in response to the controls.sidebar.js
contains the code which displays detailed letter information in the sidebar when a line or point is clicked.