$ uvx --from git+https://github.com/GIScience/ohsome-filter-to-sql.git ohsome-filter-to-sql
natural = tree and leaftype = broadleaf # type in ohsome filter and hit enter
tags @> '{"natural": "tree"}' AND tags @> '{"leaftype": "broadleaf"}' # result
uv add git+https://github.com/GIScience/ohsome-filter-to-sql.git
from ohsome_filter_to_sql.main import ohsome_filter_to_sql
sql_query = ohsome_filter_to_sql("natural = tree")
Setup a local instance of the ohsomeDB.
After ohsomeDB runs on localhost:5432
all tests can be run with:
uv run pytest
To install pre-commit hooks run:
uv run pre-commit install
Execute antlr4-parse
, type in an ohsome filter and press ctlr+d.
antlr4-parse OFL.g4 root -tree
buildings=yes
(root:1 (expression:8 (tagMatch:1 (string:1 buildings) = (string:1 yes))) <EOF>)
When the grammar file has change generate new Python code with antlr4
and move genrated files to ohsome_filter_to_sql/
.
uv run antlr4 -Dlanguage=Python3 OFL.g4 && mv *.py ohsome_filter_to_sql/
For open tasks, please take a look at inbox.md