GithubHelp home page GithubHelp logo

ttavenner / correspondence-map Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 272 KB

A geographic visualization of correspondence between abolitionists in the 19th century

License: GNU Affero General Public License v3.0

CSS 21.95% HTML 3.41% JavaScript 74.64%

correspondence-map's Introduction

Correspondence Map

A geographic visualization of correspondence between abolitionists in the 19th century

Project Set Up

This project consists of two parts:

  1. A parser for downloading data from the DPLA API
  2. A map that visualizes the data using LeafletJS

Parser

  1. In order to use the parser you will need to install NodeJS.

  2. After installing Node, you will need to install the project dependencies

    1. Open a command prompt window and navigate to the parser folder where the project is located
      1. Type cd [directory where you saved the project]
    2. run npm install. This will create a folder called node_modules and will install the libraries you need into it.
  3. Create a file using notepad or another plain text editor called config.json in the parser folder with the text below. Replace [API Key] with your DPLA API key.

    {
      "api_key": "[API Key]"
    }
    
  4. From the command prompt window run node get-data.js. This will download the data into a file called letters.csv

Setting up the map

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

Remote web server

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

Local web server

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.

  1. Open a command line and navigate to the folder where the project is located.
  2. Run npm install -g jitsu
  3. Run jitsu install http-server
  4. 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

Code Organization

Parser

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.

Map

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.

correspondence-map's People

Contributors

ttavenner avatar

Stargazers

albert avatar Brian Jones avatar Tod Robbins avatar Gill Abarbanel avatar

Watchers

 avatar

Forkers

gkenyon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.