Skip to content

Instantly share code, notes, and snippets.

@Erikvv
Forked from ndkv/index.html
Last active July 7, 2023 13:20
Show Gist options
  • Save Erikvv/b8d141de32850163ee0ffa03517c5d72 to your computer and use it in GitHub Desktop.
Save Erikvv/b8d141de32850163ee0ffa03517c5d72 to your computer and use it in GitHub Desktop.
PDOK docs Quickstart Leaflet
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="https://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
#map {
position: absolute;
top: 0px;
bottom: 0px;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
const map = L.map('map');
map.setView([53.232, 6.569], 16);
// load OpenStreetMap basemap
const basemap = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png');
basemap.addTo(map);
const params = new URLSearchParams({
request: "GetFeature",
service: "WFS",
typeName: "bag:pand",
count: "100",
outputFormat: "json",
srsName: "EPSG:4326",
bbox: [
232425,
583269,
234365,
584240,
].join(","),
version: "2.0.0"
});
const url = 'https://service.pdok.nl/lv/bag/wfs/v2_0?' + params.toString();
fetch(url)
.then(response => response.json())
.then(json => {
for (const feature of json.features) {
L.geoJson(feature.geometry).addTo(map);
}
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment