Created
March 17, 2026 07:03
-
-
Save hugoledoux/e3b98491eb06676f9b6034af2fa70b04 to your computer and use it in GitHub Desktop.
6-digit NL postcode to BAG pand_id
This file contains hidden or 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
| import requests | |
| base_url = "https://service.pdok.nl/lv/bag/wfs/v2_0" | |
| params = { | |
| "service": "WFS", | |
| "version": "2.0.0", | |
| "request": "GetFeature", | |
| "typeName": "bag:verblijfsobject", | |
| "outputFormat": "json", | |
| "filter": ( | |
| "<Filter><And>" | |
| "<PropertyIsEqualTo><PropertyName>postcode</PropertyName>" | |
| "<Literal>2628BL</Literal></PropertyIsEqualTo>" | |
| "<PropertyIsEqualTo><PropertyName>huisnummer</PropertyName>" | |
| "<Literal>134</Literal></PropertyIsEqualTo>" | |
| "</And></Filter>" | |
| ), | |
| } | |
| resp = requests.get(base_url, params=params) | |
| data = resp.json() | |
| if data["features"]: | |
| pand_id = data["features"][0]["properties"]["pandidentificatie"] | |
| print("pand_id:", pand_id) | |
| else: | |
| print("No features found") |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
and then
wget https://api.3dbag.nl/collections/pand/items/NL.IMBAG.Pand.0503100000032914