Skip to content

Instantly share code, notes, and snippets.

@martgnz
Last active October 28, 2017 14:51
Show Gist options
  • Save martgnz/77b3b5a94e3146e92425636e66776ab7 to your computer and use it in GitHub Desktop.
Save martgnz/77b3b5a94e3146e92425636e66776ab7 to your computer and use it in GitHub Desktop.
Venezia
license: mit
border: none
height: 690
Display the source blob
Display the rendered blob
Raw
Loading
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/[email protected]/rbush.js"></script>
<script src="https://unpkg.com/[email protected]/spam.min.js"></script>
<script type='text/javascript'>
d3.json("roads.json", function(error, roads) {
d3.json("canals.json", function(error, canals) {
topojson.presimplify(roads);
topojson.presimplify(canals);
var map = new StaticCanvasMap({
element: "body",
data: [
{
features: topojson.feature(roads, roads.objects["roads"]),
static: {
paintfeature: function(parameters, d) {
parameters.context.lineWidth = 1;
parameters.context.strokeStyle = "rgb(175, 141, 195)";
parameters.context.stroke();
}
}
},
{
features: topojson.feature(canals, canals.objects["canals"]),
static: {
paintfeature: function(parameters, d) {
parameters.context.lineWidth = 0.5;
parameters.context.strokeStyle = "rgb(0, 116, 217)";
parameters.context.stroke();
}
}
}
]
});
map.init();
});
});
</script>
Display the source blob
Display the rendered blob
Raw
Loading
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