Javascript/Maps: Difference between revisions
From charlesreid1
| Line 35: | Line 35: | ||
Final link: https://charlesreid1.com:3000/d3/maps/src/master/map-shapes | Final link: https://charlesreid1.com:3000/d3/maps/src/master/map-shapes | ||
<s>Cards map | |||
* leaflet | |||
* geojson data | |||
* on click, modify another element</s> | |||
Final link: https://charlesreid1.com:3000/d3/maps/src/master/map-cards | |||
==Code== | ==Code== | ||
Revision as of 08:26, 18 February 2018
Planning out some simple map visualizations using Leaflet, build on those.
Why maps?
The main point of these map visualizations is to learn Leaflet, D3, and Javascript. The advantages of using maps:
- no lack of interesting data sets
- data sets get very large very fast, so provides motivation for learning to bundle data, deal with "promises" etc.
- maps are mainly interesting when linked to another component, so focus on learning to link pieces
Components
Building maps in Javscript requires a few moving parts.
First, the Javascript dependency manager. Unconventionally, I'm staying as far away from Javascript package managers as possible. No Bower, Grunt, Backbone, Gulp, Node, or whatever other stupid framework is most popular these days. Just use Javascript.
Second, the static page content generator. Pages are managed using Pelican. The setup is basically to create a separate folder with all files related to the map application, and keep everything as minimal and standalone as possible. Creating a map should not require modifying the pelican theme.
Third, the Javascript/css/html files for the map itself. These are managed by Pelican and sit together in a single directory.
Phases
Phase 1: Map Only
Simple map
- leaflet with mapbox tiles
- pelican javascript css files workflow
on click, popup with latitude longitude
Final link: https://charlesreid1.com:3000/d3/maps/src/master/map-mouse
Active map
- leaflet
- geojson data
on click, popup with shape info
Final link: https://charlesreid1.com:3000/d3/maps/src/master/map-shapes
Cards map
- leaflet
- geojson data
on click, modify another element
Final link: https://charlesreid1.com:3000/d3/maps/src/master/map-cards
Code
Code for each map is being staged here: https://charlesreid1.com:3000/d3/maps
Final deployed maps are checked into charlesreid1.com repo here: https://charlesreid1.com:3000/charlesreid1/charlesreid1.com
Specifically, example map is here: https://charlesreid1.com:3000/charlesreid1/charlesreid1.com/src/charlesreid1-src/pelican/examplemap
Final version of example map is here: http://charlesreid1.com/examplemap/