Skip to content

Instantly share code, notes, and snippets.



Last active May 17, 2019
What would you like to do?
Groninger gemeenten
license: gpl-3.0
height: 600
scrolling: no
border: no

Gemeenten in de provincie Groningen gevisualiseerd met Turf en D3. Bron: bestuurlijke grenzen WFS van PDOK.

<!DOCTYPE html>
path {
fill: #ccc;
stroke: #fff;
stroke-width: .5px;
path:hover {
fill: orange;
div.tooltip {
position: absolute;
text-align: center;
width: 80px;
height: 14px;
padding: 2px;
font: 12px sans-serif;
background: #fff;
border: 0px;
pointer-events: none;
<script src=""></script>
<script src=""></script>
<div class="graph"></div>
var width = 700, height = 400;
var svg =".graph").append("svg")
.attr("viewBox", "0 0 " + (width) + " " + (height))
.style("max-width", "700px");
var url = ",%20%27Loppersum%27,%20%27Appingedam%27,%20%27Westerkwartier%27,%20%27Groningen%27,%20%27Delfzijl%27,%20%27Midden-Groningen%27,%20%27Oldambt%27,%20%27Veendam%27,%20%27Pekela%27,%20%27Westerwolde%27,%20%27Stadskanaal%27)&outputFormat=json&srsName=EPSG:4326";
var tooltip ="body")
.attr("class", "tooltip")
.style("opacity", 0);
d3.json(url, function(error, mapdata) {
var fixed = {
return turf.rewind(f, {reverse:true});
var projection = d3.geoMercator();
var path = d3.geoPath().projection(projection);
projection.fitSize([width, height], {"type": "FeatureCollection", "features": fixed});
.attr("class", "gemeente")
.attr("d", path)
.on("mouseover", function(d) {
.style("opacity", .9);
.style("left", (d3.event.pageX) + "px")
.style("top", (d3.event.pageY - 28) + "px");
.on("mouseout", function(d) {
.style("opacity", 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment