download_from_wfs

Get multiple layers as a geojson file from a WFS service. command line example:

download_from_wfs https://map.data.amsterdam.nl/maps/gebieden stadsdeel,buurtcombinatie 28992 output_folder

usage: wfs_get_geojson [-h]
                       url_wfs layer_names [layer_names ...] {28992,4326}
                       output_folder

Positional Arguments

url_wfs WFS url, for example http://map.data.amsterdam.nl/maps/gebieden
layer_names Layers to export, separated by a , for example: stadsdeel,buurtcombinatie
srs

Possible choices: 28992, 4326

choose srs (default: “28992”)

Default: “28992”

output_folder Set the output location path, for example output or projectdir/data

functions

datapunt_processing.extract.download_from_wfs.get_layer_from_wfs(url_wfs, layer_name, srs, outputformat, retry_count=3)

Get layer from a wfs service. Args:

  1. url_wfs: full url of the WFS including https, excluding /?:

    https://map.data.amsterdam.nl/maps/gebieden
    
  2. layer_name: Title of the layer:

    stadsdeel
    
  3. srs: coordinate system number, excluding EPSG:

    28992
    
  4. outputformat: leave empty to return standard GML, else define json, geojson, txt, shapezip:

    geojson
    
Returns:
The layer in the specified output format.
datapunt_processing.extract.download_from_wfs.get_layers_from_wfs(url_wfs)

Get all layer names in WFS service, print and return them in a list.

datapunt_processing.extract.download_from_wfs.get_multiple_geojson_from_wfs(url_wfs, layer_names, srs, output_folder)

Get all layers and save them as a geojson

Args:
  1. url_wfs: full url of the WFS including https, excluding /?:

    https://map.data.amsterdam.nl/maps/gebieden
    
  2. layer_names: single or multiple titles of the layers, separated by a comma without spaces:

    stadsdeel,buurtcombinatie,gebiedsgerichtwerken,buurt
    
  3. srs: coordinate system number, excluding EPSG:

    28992
    
  4. output_folder: define the folder to save the files:

    path_to_folder/another_folder
    
datapunt_processing.extract.download_from_wfs.parser()

Parser function to run arguments from the command line and to add description to sphinx.