Skip to content

Instantly share code, notes, and snippets.

@martgnz
Last active October 28, 2017 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martgnz/c48aa019de720fcd86030d3b07990d8d to your computer and use it in GitHub Desktop.
Save martgnz/c48aa019de720fcd86030d3b07990d8d to your computer and use it in GitHub Desktop.
German Provinces
height: 1250
license: mit
border: none

Basic static map done with spam.

Features:

  • Automatic projection (defaults to mercator)
  • Automatic centering
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.
<!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("germany.json", function(error, d) {
topojson.presimplify(d);
var map = new StaticCanvasMap({
element: "body",
data: [
{
features: topojson.feature(d, d.objects["germany"]),
static: {
paintfeature: function(parameters, d) {
parameters.context.stroke();
}
}
}
]
});
map.init();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment