Skip to content

Instantly share code, notes, and snippets.

@hepplerj
Last active April 28, 2016 17:14
Show Gist options
  • Save hepplerj/11074df2789d8fea8feecd84437e6531 to your computer and use it in GitHub Desktop.
Save hepplerj/11074df2789d8fea8feecd84437e6531 to your computer and use it in GitHub Desktop.
Greenland coast
node_modules
Display the source blob
Display the rendered blob
Raw
{"type":"Topology","objects":{"coast":{"type":"GeometryCollection","crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:OGC:1.3:CRS84"}},"geometries":[{"type":"MultiLineString","arcs":[[0],[1],[2],[3],[4],[5],[6],[7]]}]}},"arcs":[[[9999,401],[-39,-4],[-10,-5],[-54,7],[-85,32],[-66,10],[-44,1],[-6,-16],[37,-26],[56,-11],[45,-17],[81,-15],[28,-31],[19,-33],[-3,-18],[0,-21],[14,-115],[-38,-39],[-29,-36],[-100,5],[-18,12],[-97,38],[6,-18],[70,-51],[25,-26],[-17,-5],[-28,-2],[-40,-17],[-71,9],[4,26],[13,27],[-32,-5],[-37,-13],[-21,5],[-18,-2],[-10,14],[-13,52],[16,26],[59,68],[19,36],[-17,16],[-42,-38],[-43,-62],[-20,-38],[-27,-7],[-67,19],[-193,86],[6,53],[-2,44],[56,5],[41,19],[37,24],[41,42],[37,70],[-4,5],[-111,-89],[-68,-30],[-33,-5],[-17,13],[-54,28],[-36,13],[-81,22],[-15,11],[-23,9],[-33,91],[42,111],[29,32],[18,37],[11,50],[-8,21],[-24,-8],[-11,-16],[1,-27],[-14,-18],[-96,-42],[-97,-34],[-46,-33],[-30,-25],[-23,-25],[-36,2],[-49,-5],[-34,-16],[-50,10],[-32,24],[-39,3],[-43,-12],[-30,1],[2,-16],[20,-40],[-33,-3],[-63,-1],[-32,11],[-25,15],[-21,22],[13,27],[101,51],[46,30],[-30,10],[-97,-9],[-16,7],[-66,-4],[3,75],[-16,19],[-1,9],[-23,21],[-21,6],[-13,7],[-111,17],[-14,42],[-8,44],[-21,54],[-53,14],[-28,23],[22,24],[10,30],[-24,14],[-16,22],[3,13],[-20,38],[-6,29],[22,28],[63,31],[20,12],[10,14],[72,23],[-61,16],[-38,2],[-28,-7],[-25,-31],[-24,-20],[-94,-6],[-14,10],[-6,43],[5,33],[39,46],[-45,23],[-41,8],[-46,21],[-43,23],[-37,26],[-36,32],[-12,4],[13,32],[7,27],[1,58],[-14,23],[32,50],[44,53],[96,80],[-102,-38],[-83,-84],[-18,-4],[-6,15],[-32,55],[-24,15],[-11,16],[-47,29],[-21,22],[-29,43],[-42,52],[-59,101],[-95,117],[-24,65],[30,83],[-33,58],[91,26],[130,30],[67,25],[39,7],[82,5],[28,25],[-46,-7],[-31,4],[-2,11],[12,21],[7,27],[-16,-5],[-80,-46],[-120,-37],[-93,-20],[-15,1],[-33,-12],[-18,-4],[-15,4],[-33,35],[-8,23],[59,61],[44,85],[58,55],[42,7],[69,-3],[24,-5],[-8,33],[3,16],[56,19],[65,8],[47,-6],[29,-38],[38,-71],[50,-24],[-2,34],[-26,44],[-10,67],[-33,28],[-27,14],[-74,-6],[-45,49],[-10,18],[-1,24],[-44,70],[-15,35],[-23,47],[-13,3],[16,-59],[21,-42],[30,-91],[14,-37],[-20,-29],[-37,-29],[-33,-17],[-79,-21],[17,45],[11,44],[-40,-15],[-37,-32],[-12,-45],[-24,-40],[-70,-99],[-28,-55],[-26,-27],[-29,-8],[-26,22],[-22,50],[-10,40],[-2,103],[3,47],[-12,65],[-38,150],[-8,54],[-64,28],[-1,9],[-16,31],[-13,30],[10,11],[16,8],[95,45],[71,50],[85,79],[35,25],[124,19],[55,2],[0,14],[-19,6],[-84,-4],[-112,-31],[-19,-12],[-49,-49],[-38,-27],[-106,-61],[-69,0],[-71,74],[-79,-15],[-54,5],[-16,11],[-12,101],[44,116],[-47,1],[-10,5],[-24,27],[-16,8],[12,14],[115,55],[172,109],[74,42],[46,19],[34,21],[42,45],[14,20],[24,16],[49,19],[54,27],[88,62],[11,23],[-19,5],[-41,-21],[-83,-57],[-60,-31],[-203,-143],[-86,-51],[-47,-34],[-37,-31],[-38,-23],[-41,-13],[-87,-10],[-43,-12],[-26,9],[-11,67],[8,40],[-4,40],[22,56],[32,40],[14,22],[6,15],[66,41],[37,18],[26,42],[148,14],[38,-1],[20,5],[15,12],[-15,10],[-44,6],[-117,-1],[-109,7],[-50,7],[-24,-4],[-39,12],[-43,23],[-67,85],[26,108],[3,52],[85,45],[45,15],[65,34],[86,58],[103,35],[53,7],[43,-5],[161,-50],[83,-10],[73,12],[91,-18],[162,-72],[31,11],[-9,17],[-180,77],[1,22],[46,6],[49,23],[-28,13],[-119,-12],[-35,-18],[-116,-9],[-61,15],[-54,8],[-82,33],[-68,-11],[-43,-13],[-77,-12],[-27,-9],[-149,-104],[-63,-21],[-45,7],[32,67],[9,27],[0,29],[13,40],[76,76],[48,82],[20,52],[38,6],[51,-8],[154,-33],[128,-40],[95,-11],[62,-1],[27,13],[21,22],[8,15],[6,32],[7,11],[21,13],[42,48],[13,33],[-13,20],[-29,-2],[-55,-13],[-7,-5],[1,-11],[-54,-52],[-58,-12],[-134,-18],[-61,-1],[-109,24],[-16,10],[-11,18],[-134,-4],[-40,-6],[-31,3],[15,31],[42,34],[59,112],[50,29],[98,27],[103,-5],[177,-86],[53,-8],[49,7],[118,29],[21,12],[42,36],[50,61],[-3,15],[-75,-34],[-41,-10],[-34,0],[32,113],[12,86],[12,21],[99,-6],[136,12],[32,18],[0,9],[-55,11],[-26,24],[-45,-7],[-62,-16],[-76,1],[6,37],[56,78],[6,35],[22,71],[2,36],[29,36],[89,25],[37,15],[2,16],[-53,63],[13,17],[42,16],[15,11],[-10,8],[-39,6],[-59,-13],[-65,-7],[-58,21],[-45,10],[-29,-3],[-77,-36],[-28,-1],[-33,10],[-223,31],[-28,10],[-80,54],[-65,35],[-88,38],[-114,29],[-139,20],[-84,19],[-41,27],[-70,58],[-54,48],[-10,24],[32,30],[32,21],[60,18],[104,-6],[56,-8],[62,-17],[46,-3],[97,5],[98,-11],[58,-11],[77,-25],[211,-104],[88,-36],[38,-4],[158,-39],[25,1],[65,18],[6,12],[-22,11],[-69,9],[-82,43],[-51,34],[-6,56],[7,31],[13,14],[9,48],[-48,29],[-33,9],[-88,41],[-7,11],[42,4],[41,-2],[89,-21],[47,-3],[34,8],[3,8],[-54,24],[-67,43],[-141,6],[-91,-4],[-59,14],[-62,24],[-40,6],[-82,-15],[-41,-2],[-38,6],[-37,75],[10,22],[29,10],[22,24],[16,26],[48,25],[265,55],[67,41],[-2,6],[-46,-7],[-57,-19],[-39,-4],[-156,24],[-25,-5],[-63,-34],[-86,-38],[-40,2],[-53,23],[-8,15],[-4,19],[58,26],[19,14],[38,37],[-2,18],[-64,-10],[-9,17],[1,29],[-6,37],[-16,36],[-53,56],[-21,14],[-18,21],[-40,75],[11,19],[36,14],[6,7],[-84,-12],[-9,-13],[16,-19],[11,-26],[7,-32],[12,-28],[30,-31],[25,-16],[39,-42],[18,-47],[-5,-25],[-31,-25],[-50,-27],[-15,-23],[-7,-22],[-39,-21],[-24,8],[-18,1],[22,-37],[14,-37],[-17,-38],[-46,-23],[-25,-1],[-50,-19],[-126,-9],[-44,4],[-80,19],[-95,10],[-38,26],[-50,46],[-25,42],[0,36],[13,27],[27,17],[33,107],[47,87],[117,89],[33,32],[11,18],[0,13],[-19,8],[-144,-110],[-89,-12],[-26,25],[8,44],[16,11],[71,-5],[28,25],[-45,37],[-47,10],[-11,9],[49,28],[113,-2],[26,20],[41,21],[46,40],[17,33],[4,28],[-10,23],[-1,23],[8,23],[-12,26],[-32,28],[-70,27],[-21,-31],[-22,-12],[-30,-3],[-29,13],[-29,4],[-29,12],[-30,4],[-12,9],[-8,26],[0,33],[34,16],[47,12],[32,24],[21,33],[3,37],[-15,40],[-39,35],[-71,-34],[-28,-9],[-7,25],[-9,18],[-30,25],[-40,19],[-38,12],[-2,18],[9,21],[17,24],[22,51],[24,-5],[20,5],[-11,42],[-20,35],[-23,20],[0,8],[-6,11],[-17,24],[-20,18],[-34,51],[-25,20],[-32,10],[-34,0],[-55,-13],[-102,-16],[-80,-7],[-14,4],[41,19],[59,21],[78,13],[23,34],[-8,29],[3,27],[-21,29],[21,16],[71,16],[32,3],[33,20],[-91,50],[-95,33],[-23,13],[-21,21],[-18,31],[-30,30],[-40,30],[-59,30],[-152,53],[-53,37],[-48,57],[-24,24],[-25,18],[-106,41],[-13,19],[110,49],[10,20],[-44,59],[-46,44],[-50,15],[-74,8],[-68,20],[-62,30],[-61,23],[-93,21],[-154,55],[-239,59],[-106,34],[-64,13],[-83,3],[-162,32],[-135,10],[-84,-4],[-27,5],[-62,33],[-97,18],[-50,-7],[-62,-35],[-76,-34],[-39,-5],[-60,32],[-30,22],[-28,7],[-27,-7],[-53,-29],[-51,-21],[-74,-24],[-60,-12],[-77,-3],[-19,-9],[-29,-1],[-40,9],[-37,16],[-35,24],[-31,13],[-26,2],[-61,-13],[-78,-36],[-35,-9],[-30,4],[-36,11],[-73,29],[-40,-2],[-29,-11],[8,-24],[68,-58],[61,-41],[-51,-5],[-449,56],[-58,13],[-82,34],[-69,21],[-117,53],[-90,29],[-30,23],[-8,15],[29,21],[181,71],[70,14],[141,17],[33,11],[11,9],[-37,15],[-184,-6],[-165,11],[-143,28],[-25,9],[-24,17],[-24,25],[5,29],[35,31],[20,21],[6,11],[-180,-76],[-74,-27],[-58,8],[-41,13],[-20,14],[1,16],[6,11],[13,7],[-96,32],[-42,25],[-5,25],[34,27],[33,19],[32,12],[88,10],[322,20],[230,-19],[78,63],[53,20],[155,21],[238,3],[169,-11],[79,-15],[107,-33],[6,10],[-26,30],[674,-180]],[[8862,619],[-135,-73],[1,-12],[41,4],[39,-14],[19,-30],[39,-15],[39,68],[4,34],[12,27],[5,31],[-64,-20]],[[6920,5480],[42,34],[30,31],[-2,18],[-25,16],[-9,12],[7,10],[3,11],[-2,11],[-9,22],[-12,15],[-120,32],[-113,46],[-126,111],[-66,37],[-27,9],[-214,42],[-124,12],[-113,-35],[-28,-21],[-10,-17],[-5,-16],[0,-16],[8,-27],[12,-18],[41,-23],[112,-40],[-14,-10],[-102,24],[-42,-9],[-18,-27],[-27,-107],[18,-28],[21,-19],[24,-11],[81,-19],[123,-7],[47,-7],[25,-11],[33,4],[14,-19],[21,-9],[21,-15],[-78,-16],[-54,0],[-37,-5],[-9,-14],[21,-22],[24,-15],[51,-20],[37,-22],[13,-2],[59,-2],[196,49],[79,12],[223,71]],[[7179,5687],[11,-29],[-7,-41],[8,-32],[27,-70],[11,-15],[11,-4],[53,20],[15,17],[-3,20],[4,26],[19,52],[53,24],[19,17],[7,11],[-89,34],[-52,9],[-39,-6],[-48,-33]],[[6969,6322],[-47,-4],[-14,-37],[1,-12],[9,-7],[105,-10],[46,2],[23,7],[-8,14],[-60,28],[-55,19]],[[6405,6355],[32,4],[16,9],[11,15],[6,18],[2,22],[-3,18],[-24,36],[-25,27],[-39,-8],[-55,-43],[-29,-29],[-3,-16],[5,-13],[15,-11],[91,-29]],[[5762,7224],[85,66],[39,22],[48,38],[-5,17],[-59,12],[-10,-10],[-65,-20],[-30,-5],[-20,0],[-31,8],[-112,-7],[-28,-16],[-47,-20],[25,-28],[34,-7],[36,7],[23,-4],[14,-5],[4,-9],[12,-11],[32,-4],[17,-18],[23,-8],[15,2]],[[138,9999],[-54,-2],[-64,-9],[-18,-9],[-2,-26],[41,-17],[119,-22],[121,5],[68,16],[11,23],[-40,5],[-61,16],[-85,16],[-36,4]]],"transform":{"scale":[0.0029453775455670593,0.001765337666579158],"translate":[-72.49492187499999,59.815478515625045]}}
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<style>
body {
background: #333;
}
.coastline {
fill: none;
stroke: orange;
stroke-width: 1px;
}
.graticule {
fill: none;
stroke: #777;
stroke-width: .5px;
stroke-opacity: .5;
}
.land {
fill: #222;
}
.boundary {
fill: none;
stroke: #333;
stroke-width: .5px;
}
</style>
</head>
<div id="map"></div>
<body>
<script src="//d3js.org/d3.v3.min.js"></script>
<script src="//d3js.org/topojson.v1.min.js"></script>
<script src="//d3js.org/queue.v1.min.js"></script>
<script src="main.js"></script>
</body>
queue()
.defer(d3.json, "world-50m.json")
.defer(d3.json, "coast.topojson")
.await(makeMap);
// Defaults
var width = 600,
height = 600;
var svg = d3.select('#map').append('svg')
.attr('width', width)
.attr('height', height);
// Projection information
var projection = d3.geo.stereographic()
.scale(2500)
.translate([width / 2, height / 2])
.rotate([50, -70])
.clipAngle(180 - 1e-4)
.clipExtent([[0, 0], [width, height]])
.precision(.1);
var path = d3.geo.path()
.projection(projection);
// Build our map
function makeMap(error, world, greenland) {
if (error) throw error;
// Draw world countries and borders
svg.insert("path", ".graticule")
.datum(topojson.feature(world, world.objects.land))
.attr("class", "land")
.attr("d", path);
svg.insert("path", ".graticule")
.datum(topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; }))
.attr("class", "boundary")
.attr("d", path);
// Select our coastline objects
var route = topojson.feature(greenland, greenland.objects['coast']);
// Make a group for features
var greenland_coast = svg.append('g').attr('class', 'feature-group');
// Add coastline data
greenland_coast.selectAll('.coastline')
.data(route.features)
.enter().append('path')
.attr('class', 'coastline')
.attr('d', path);
}
{
"name": "greenland-map",
"version": "0.0.1",
"description": "Mapping the coast of Greenland",
"keywords": [
"Greenland",
"d3js",
"visualization",
"spatial history",
"digital humanities"
],
"main": "main.js",
"author": "Jason Heppler <jason@jasonheppler.org>",
"license": "MIT",
"dependencies": {
"d3": "3",
"topojson": "1",
"d3-queue": "1"
},
"devDependencies": {
"d3": "3",
"topojson": "1",
"d3-queue": "1"
}
}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment