Skip to content

Instantly share code, notes, and snippets.

View arbakker's full-sized avatar

Anton Bakker arbakker

  • Kadaster
  • Apeldoorn
View GitHub Profile
@arbakker
arbakker / script.sh
Created January 5, 2024 15:47
yq add fields to objects in array
yq -P < src/coordinate_transformation_api/assets/config.yaml '{"crs": [.crs | to_entries | .[] | .value.uri="http://www.opengis.net/" + (.key | split(":") | join("/0/"))] | from_entries}'
@arbakker
arbakker / pdok-download-api-full-custom.py
Created November 30, 2023 11:53
Python CLI for creating full custom downloads on the PDOK download API
import requests
import json
import time
import os
import pathlib
import argparse
from urllib.parse import urlparse
def main(api_url, featuretypes, format, bbox_rd=None, geofilter=None):
@arbakker
arbakker / LICENSE
Created June 21, 2023 08:07
This license applies to all public gists https://gist.github.com/arbakker
MIT License
Copyright (c) 2023 Anton Bakker
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@arbakker
arbakker / get-percelen-met-adres.sh
Last active June 21, 2023 08:06
Bash script voor het ophalen van percelen uit de Kadastrale Kaart WFS aan de hand van een adres, met behulp van de PDOK Locatieserver #jq #pdok #WFS #bash #
#!/usr/bin/env bash
# Bash script voor het ophalen van percelen uit de Kadastrale Kaart WFS aan de hand van een adres, met behulp van de PDOK Locatieserver
# Author: anton.bakker@kadaster.nl
# Dependencies:
# - python3
# - jq
# - xmllint (libxml2-utils)
# - curl
set -euo pipefail
@arbakker
arbakker / _README.md
Created June 16, 2023 11:39
PDOK MapServer docker-compose voorbeeld

PDOK MapServer docker-compose voorbeeld

MapServer docker-compose voorbeeld met lighttpd reverse-proxy, voor het toevoegen van response headers.

  1. Start docker-compose met:
docker-compose up
  1. Service draait nu op: http://localhost/mapserver?service=WMS&amp;request=getcapabilities

% Habits % John Doe % March 22, 2005

In the morning

Getting up

  • Turn off alarm
  • Get out of bed

Metadata


Waarom publiceren we metadata

  • Context NSDI (National Spatial Data Infrastructure)
  • Geonovum is the National Spatial Data Infrastructure (NSDI) executive committee

An SDI is a coordinated series of agreements on technology standards, institutional arrangements, and policies that enable the discovery and use of geospatial information by users and for purposes other than those it was created for.[^1]

@arbakker
arbakker / wcs-getcoverage-request.py
Created May 9, 2023 15:26
Python script to create WCS GetCoverage request with OWSLib #owslib #python #wcs #ahn #raster
#!/usr/bin/env python3
from owslib.wcs import WebCoverageService
def main():
x = 191313.0
y = 440283.3 # coordinaten in RD/EPSG:28992 van een locatie in NL
origin = [10000,618750] # origin van ahn3 coverage in RD/EPSG:28992
cell_size = 0.5 # cell size van ahn3 coverage
bbox_size = 50 # in meters - dit is formaat van coverage dat opgehaald wordt
bbox_size_pixels=bbox_size/cell_size
@arbakker
arbakker / _CSW Test NGR.md
Last active March 22, 2023 13:30
Test script en data voor het testen van de werking van de CSW service in het NGR

CSW Test NGR

Test script en data voor het testen van de werking van de CSW service in het nationaalgeoregister.nl (NGR).

Depends on csw-client.sh.

Run ./test.sh to test CSW publication in NGR.

@arbakker
arbakker / script.sh
Created February 8, 2023 14:16
check if layers in geopackage are within bbox #bash #geopackage #ogr/gdal
#/usr/bin/env bash
layer_count=0
for file in *.gpkg;do
while read -r layer;do
echo "$layer"
count=$(ogrinfo $file -sql "select count(*) as count_outside from ${layer} where not Intersects(geom, BuildMbr(3419623.11185873579233885, 3033416.80487128812819719, 4526147.91013043466955423, 3477617.21156968083232641, 3035))" | grep "count_outside.*=" | cut -d= -f2)
if [[ count -ne 0 ]];then
echo "${count} features outside Netherlands in ${file}/${layer}"
else
echo "... ${count} features outside Netherlands in ${file}/${layer}"