Small library to request geospatial data (WFS)
Project description
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
Questions/ suggestions/ requests/ bugs?
Send an email to brencodeert@outlook.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wfs20-0.2.2.tar.gz
.
File metadata
- Download URL: wfs20-0.2.2.tar.gz
- Upload date:
- Size: 53.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ca24da3a18bf8f62ea75a2a13c7fa19a717cf6c7952029841f75c7274ad5f32 |
|
MD5 | 2d475085a9f3ed5d26d8de5318e2f36c |
|
BLAKE2b-256 | 8dbdd710ff4d0a3d521340ca9718173c1c36bb293101a32a9d4e5ebcd42681e7 |
File details
Details for the file wfs20-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: wfs20-0.2.2-py3-none-any.whl
- Upload date:
- Size: 61.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3163fc751ddc590bc6339d3481c88ee0fa8b835f09db08144210af22773ee874 |
|
MD5 | a7670f07f740522a875652536180f415 |
|
BLAKE2b-256 | a0aabd48173f96e43ea9815499c6af2f6ab14818f28ab1c8a6ae27238a7f83c1 |