-
-
Save Erikvv/b8d141de32850163ee0ffa03517c5d72 to your computer and use it in GitHub Desktop.
PDOK docs Quickstart Leaflet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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