Skip to content

Instantly share code, notes, and snippets.

@jdlom
Last active June 21, 2021 16:11
Show Gist options
  • Save jdlom/dfa62e64b986c2dba99aa4ff6e36ccaa to your computer and use it in GitHub Desktop.
Save jdlom/dfa62e64b986c2dba99aa4ff6e36ccaa to your computer and use it in GitHub Desktop.
ogr_fdw_wfs
#/bin/bash
# create sql dump with ogr_fdw on wfs server
export adresse=WFS:http://ws.carmen.developpement-durable.gouv.fr/WFS/8/nature?REQUEST=GetCapabilities
export ogr_fdw=/usr/lib/postgresql/12/bin/ogr_fdw_info
export GDAL_HTTP_PROXY=10.27.8.20:8080
function wfs_layers() {
cmd="$ogr_fdw -s $1"
for layer in `$cmd | awk 'f;/Layers/{f=1}'`
#https://stackoverflow.com/questions/17908555/printing-with-sed-or-awk-a-line-following-a-matching-pattern/17914105
do
layer=${layer//[[:blank:]]/}
#echo "$layer"
$cmd -l $layer
done
}
#echo "$adresse"
wfs_layers $adresse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment