python3 -m venv env
source env/bin/activate
cp config/settings/sample.local.py config/settings/local.py
pip install -r requirements.txtCreate local.py and edit for database credentials:
cp config/settings/sample.local.py config/settings/local.pySetup database:
./manage.py sqlcreate # use output to create database user
./manage.py migrateRun development server
./manage.py runserverCreate config file like the following:
feature_name: 's_uferbaeume'
url: 'https://fbinter.stadt-berlin.de/fb/wfs/data/senstadt/s_uferbaeume?service=wfs&version=2.0.0&request=GetFeature&typeNames=s_uferbaeume'
file_name: /srv/trees/files/s_uferbaeume.xml
fields:
identifier: gml_id
species: ART
genus: GATTUNG
borough: BEZIRK
year: PFLANZJAHR
age:
circumference: STAMMUMFAN
height: BAUMHOEHEwhere feature_name is an assigned name, url is the full wfs request to the service, file_name is the place to store the download on the local system, and fields is a mapping of the attributes of the api to the property fields of the service.
Then, fetch and ingest the data from the WFS service using:
./manage.py fetch /path/to/config.yml
./manage.py ingest /path/to/config.yml(On the development server the api is available at http://localhost:8000.)
- Filter trees with given properties:
- For numerical fields (
year,age,circumference,height)gt(>),gte(>=),lt(<),lte(<=) can be used: - For string fields (
identifier,species,genus,borough)iexact(case insensitive) andcontainscan be used: - All trees with a given distance to point (or less) can be retrieved:
- Histogram of
species,genus,borough, e.g.: