Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:12
Show Gist options
  • Save dhoboy/a2134fbfd30d90edd06a to your computer and use it in GitHub Desktop.
Save dhoboy/a2134fbfd30d90edd06a to your computer and use it in GitHub Desktop.
Song Tea and Ceramics Map

This is a map of Song Tea and Ceramics's 2014 tea collection. Click each marker on the map to see where the teas are from. Tea collection information taken from their website. This map was made with d3 and leaflet.

<link rel="stylesheet" href="" />
<script src=""></script>
#map { height: 97%; }
#key { font-family: "Times New Roman"; }
#key a { text-decoration: none; color: #B23403;}
<title>Song Tea's 2014 Collection</title>
<div id="map"></div>
// establish the map tile
var map ='map').setView([29.16, 117.09], 5); // large view of china/taiwan
L.tileLayer('http://{s}{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="">OpenStreetMap</a> contributors, <a href="">CC-BY-SA</a>, Imagery © <a href="">Mapbox</a>',
maxZoom: 18
// extend this to add pdf2json later and pull straight from internet...
var tea_data = [
{"name":"Dragonwell", "location":"Zhejiang", "latitude":"30.16", "longitude":"120.09"},
{"name":"Bird Tongue", "location":"Sichuan", "latitude":"30.39", "longitude":"104.04"},
{"name":"Gan Lu", "location":"Sichuan", "latitude":"30.39", "longitude":"104.04"},
{"name":"Wild Mao Feng", "location":"Anhui", "latitude":"31.51", "longitude":"117.17"},
{"name":"Fragrant Leaf", "location":"Fujian", "latitude":"26.6", "longitude":"119.17"},
{"name":"Snow Jasmine", "location":"Sichuan", "latitude":"30.39", "longitude":"104.04"},
{"name":"Gold Peony White", "location":"Fujian", "latitude":"26.6", "longitude":"119.17"},
{"name":"Lishan Shuixian", "location":"Taiwan", "latitude":"23.41", "longitude":"120.57"},
{"name":"Dragon Phoenix Shan Lin Xi", "location":"Taiwan", "latitude":"23.41", "longitude":"120.57"},
{"name":"Lishan Winter Sprout", "location":"Taiwan", "latitude":"23.41", "longitude":"120.57"},
{"name":"Shan Lin Xi Winter Sprout", "location":"Taiwan", "latitude":"23.41", "longitude":"120.57"},
{"name":"Gold Peony Twisted Leaf", "location":"Fujian", "latitude":"26.6", "longitude":"119.17"},
{"name":"Gold Peony Rolled Leaf", "location":"Fujian", "latitude":"26.6", "longitude":"119.17"},
{"name":"Old Tree Shuixian", "location":"Fujian", "latitude":"26.6", "longitude":"119.17"},
{"name":"Red Water Shuixian", "location":"Taiwan", "latitude":"23.41", "longitude":"120.57"},
{"name":"Red Water Tieguanyin", "location":"Taiwan", "latitude":"23.41", "longitude":"120.57"},
{"name":"Nantou Dark", "location":"Taiwan", "latitude":"23.41", "longitude":"120.57"},
{"name":"Formosa Dahongpao 1992", "location":"Taiwan", "latitude":"23.41", "longitude":"120.57"},
{"name":"1960s Baozhong", "location":"Taiwan", "latitude":"23.41", "longitude":"120.57"},
{"name":"Twenty One", "location":"Taiwan", "latitude":"23.41", "longitude":"120.57"},
{"name":"Eighteen", "location":"Taiwan", "latitude":"23.41", "longitude":"120.57"},
{"name":"Old Tree Yunnan Red", "location":"Yunnan", "latitude":"25.2", "longitude":"102.42"},
{"name":"Meizhan Red", "location":"Fujian", "latitude":"26.6", "longitude":"119.17"},
{"name":"Gold Peony Red", "location":"Fujian", "latitude":"26.6", "longitude":"119.17"}
// display the data in the map
var m = {};
if (m[tea.location]) {
m[tea.location]._popup._content += "<br>";
m[tea.location]._popup._content +=;
else {
m[tea.location] = L.marker([tea.latitude, tea.longitude]).bindPopup("<div style='text-decoration:underline;'>" + tea.location + "</div>" +;
<div id="key"><a href="" target="_blank">Song Tea and Ceramics</a> -- 2014 Tea Collection. Click the icons to see where the teas are from.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment