Skip to main content

wfs20: Small library for requesting geospatial data (WFS)

What is it?

wfs20 is a small library with the sole purpose of making it easy on the user to request geospatial data from a WebFeatureService. wfs20 only caters to the 2.0.0 version of the WebFeatureService for now. wfs20 will be expanded in the future to also contain the 1.0.0 and 1.1.0 version of the WebFeatureService.

Where to get it?

Source code is available at this repository on Github: https://github.com/B-Dalmijn/WFS20

The package can be installed from:

# PyPI
pip install wfs20

What can it do?

Some of its functionality is listed below:

  • Get the capabilities and metadata of/from the service
# service
from wfs20 import WebFeatureService
wfs = WebFeatureService(url)

# metadata
wfs.Constraints 
wfs.FeatureTypes 
wfs.FeatureTypeMeta 
wfs.GetCapabilitiesMeta
wfs.GetFeatureMeta
wfs.Keywords
  • Request geospatial data from the service
reader = wfs.RequestData("<layer>",(x1,y1,x2,y2),proj_code)
# proj_code is the projection code corresponding with the geospatial data
# to be requested and the given bbox (x1,y1,x2,y2)
The returned reader object holds the geospatial data and 
subsequent metadata
  • Export the requested data to the harddrive, as long as there is data in the reader object
# to gml
wfs.ToFile("<folder>",format="gml")
# to ESRI ShapeFile
wfs.ToFile("<folder>",format="shp")
  • It is completely modular, so if you know the capabilities of the service, you don't really need to use the WebFeatureService class

    E.g.

from wfs20.crs import CRS
from wfs20.reader import DataReader
from wfs20.request import CreateGetRequest

crs = CRS.from_epsg(epsg)

url = CreateGetRequest(
  service_url,
  version,
  featuretype,
  bbox,
  crs
  )

reader = DataReader(url,keyword)
keyword is in general the Title of the featuretype, e.g. 'bag:pand' -> keyword is 'pand'
Where again you have a reader object holding the geospatial data
  • Both GET and POST requests are supported, though wfs20.RequestData only supports GET request url and POST request data can however be implemented in the DataReader
from wfs20.request import CreatePostRequest

url,data = CreatePostRequest(
  url,
  version,
  featuretype,
  bbox,
  crs
  )

reader = DataReader(url,keyword,method="POST",data=data)

Again one would have a reader object holding the acquired geospatial data.

Dependencies

  • [requests: HTTP library]
  • [lxml: XML parsing library]

Additional packages

These packages improve the functionality wfs20 package

  • [GDAL: Geospatial Data Abstraction Library]

GDAL can either be installed from the conda repository via:

conda install gdal

Or from a wheel (.whl) file. Wheel files for GDAL are very kindly made by Christoph Gohlke and are in the releases of this repository on github. The newest GDAL wheel file of Gohlke will always be in the newest release of wfs20 on github.

Simply install the wheel file with pip:

# GDAL 3.6.2 for python 3.10
pip install GDAL-3.6.2-cp310-cp310-win_amd64.whl

License

BSD 3

Questions/ suggestions/ requests/ bugs?

Send an email to brencodeert@outlook.com

Metadata

Release files for wfs20 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wfs20 0.2.2
File Size Uploaded Provenance Actions
wfs20-0.2.2.tar.gz 53.8 kB Without provenance Details for wfs20-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wfs20 0.2.2
File Interpreter ABI Platform Actions
wfs20-0.2.2-py3-none-any.whl Python 3 none any Details for wfs20-0.2.2-py3-none-any.whl

Total release size: 115.4 kB

Release files / wfs20-0.2.2.tar.gz

Download URL wfs20-0.2.2.tar.gz
Size 53.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0ca24da3a18bf8f62ea75a2a13c7fa19a717cf6c7952029841f75c7274ad5f32
BLAKE2b-256 checksum
How to use checksums
8dbdd710ff4d0a3d521340ca9718173c1c36bb293101a32a9d4e5ebcd42681e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / wfs20-0.2.2-py3-none-any.whl

Download URL wfs20-0.2.2-py3-none-any.whl
Size 61.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3163fc751ddc590bc6339d3481c88ee0fa8b835f09db08144210af22773ee874
BLAKE2b-256 checksum
How to use checksums
a0aabd48173f96e43ea9815499c6af2f6ab14818f28ab1c8a6ae27238a7f83c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for wfs20 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page