Skip to content

Instantly share code, notes, and snippets.

@FrieseWoudloper
Last active May 16, 2019 11:25
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 FrieseWoudloper/0ff8a3e6824c427554ec603d34861a04 to your computer and use it in GitHub Desktop.
Save FrieseWoudloper/0ff8a3e6824c427554ec603d34861a04 to your computer and use it in GitHub Desktop.
Groninger gemeenten
license: gpl-3.0
height: 400
scrolling: no
border: no

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

<!DOCTYPE html>
<script src="https://d3js.org/d3.v4.min.js"></script>
<div class="graph"></div>
<script>
var width = 700, height = 400;
var svg = d3.select(".graph").append("svg")
.attr("viewBox", "0 0 " + (width) + " " + (height))
.style("max-width", "700px");
var url = "https://geodata.nationaalgeoregister.nl/bestuurlijkegrenzen/wfs?service=wfs&request=GetFeature&typeName=bestuurlijkegrenzen:gemeenten&cql_filter=gemeentenaam%20IN%20(%27Het%20Hogeland%27,%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";
d3.json(url, function(error, mapdata) {
var projection = d3.geoMercator();
var path = d3.geoPath().projection(projection);
projection.fitSize([width, height], {"type": "FeatureCollection", "features": mapdata.features});
svg.append("g")
.attr("class", "gemeente")
.selectAll("path")
.data(mapdata.features)
.enter()
.append("path")
.attr("d", path);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment