Skip to content

Instantly share code, notes, and snippets.

@arbakker
Last active October 21, 2021 15:56
Show Gist options
  • Save arbakker/37d90fb6d655aa5046c906aba3a6ae1f to your computer and use it in GitHub Desktop.
Save arbakker/37d90fb6d655aa5046c906aba3a6ae1f to your computer and use it in GitHub Desktop.
Generate GeoJSON file with all download URLS for the AHN3 #jq #ahn #pdok #wfs #elevation #DEM #GIS
#!/usr/bin/env bash
ogr2ogr -f GeoJSON /vsistdout/ WFS:https://geodata.nationaalgeoregister.nl/ahn3/wfs ahn3:ahn3_bladindex | \
jq -c ".features[].properties |=
if(.has_data_05m_dsm == true) then
.+{url_05m_dsm: ( \"https://download.pdok.nl/rws/ahn3/v1_0/05m_dsm/R_\" + (.bladnr | ascii_upcase ) + \".ZIP\")}
else . end" | \
jq -c ".features[].properties |=
if(.has_data_05m_dtm == true) then
.+{url_05m_dtm: ( \"https://download.pdok.nl/rws/ahn3/v1_0/05m_dtm/M_\" + (.bladnr | ascii_upcase ) + \".ZIP\")}
else . end" | \
jq -c ".features[].properties |=
if(.has_data_5m_dsm == true) then
.+{url_5m_dsm: ( \"https://download.pdok.nl/rws/ahn3/v1_0/5m_dsm/R5_\" + (.bladnr | ascii_upcase ) + \".ZIP\")}
else . end" | \
jq -c ".features[].properties |=
if(.has_data_5m_dtm == true) then
.+{url_5m_dtm: ( \"https://download.pdok.nl/rws/ahn3/v1_0/5m_dtm/M5_\" + (.bladnr | ascii_upcase ) + \".ZIP\")}
else . end" | \
jq -c ".features[].properties |=
if(.has_data_laz == true) then
.+{url_laz: ( \"https://download.pdok.nl/rws/ahn3/v1_0/laz/C_\" + (.bladnr | ascii_upcase ) + \".ZIP\")}
else . end" |
jq -c -r ".features[].properties | to_entries[]
| select(.key|startswith(\"url_\")) | .value"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment