Map of Chile made with Spam.js.
Last active
October 28, 2017 15:30
-
-
Save martgnz/f4f1f780378df706cfd024c785b44406 to your computer and use it in GitHub Desktop.
Static Chile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit | |
height: 800 | |
border: none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8" /> | |
<body> | |
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script src="https://d3js.org/topojson.v1.min.js"></script> | |
<script src="https://unpkg.com/rbush@1.4.3/rbush.js"></script> | |
<script src="https://unpkg.com/spamjs@1.1.0/spam.min.js"></script> | |
<script type='text/javascript'> | |
d3.json("chile.json", function(error, d) { | |
topojson.presimplify(d); | |
var map = new StaticCanvasMap({ | |
element: "body", | |
height: 800, | |
width: 560, | |
projection: d3.geo | |
.mercator() | |
.center([-71.188429, -31.061921]) | |
.scale(900), | |
data: [ | |
{ | |
features: topojson.feature(d, d.objects["chile"]), | |
static: { | |
paintfeature: function(parameters, d) { | |
parameters.context.lineWidth = 0.5; | |
parameters.context.strokeStyle = "rgb(30,30,30)"; | |
parameters.context.stroke(); | |
} | |
} | |
} | |
] | |
}); | |
map.init(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment