ohsome filter to SQL
Try it out
# USAGE:
# after running ohsome-filter-to-sql type in ohsome filter and hit enter
$ uvx ohsome-filter-to-sql
natural = tree and leaftype = broadleaf
('tags @> $1 AND tags @> $2', ('{"natural": "tree"}', '{"leaftype": "broadleaf"}'))
Installation
uv add ohsome-filter-to-sql
Usage
Python Library
from ohsome_filter_to_sql import ohsome_filter_to_sql
query, query_args = ohsome_filter_to_sql("natural = tree")
Command Line Interface (CLI)
uv run ohsome-filter-to-sql
Development Setup
uv run prek install # pre-commit hooks
export OHSOME_FILTER_TO_SQL_SCHEMA=""
export OHSOME_FILTER_TO_SQL_DATABASE=""
export OHSOME_FILTER_TO_SQL_USER=""
export OHSOME_FILTER_TO_SQL_PASSWORD=""
export OHSOME_FILTER_TO_SQL_HOST="localhost"
export OHSOME_FILTER_TO_SQL_PORT="5432"
uv run pytest
To develop new features you will need a local instance of the ohsomeDB.
How to play around with the grammar?
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>)
ANTLR Lab can also be used to try out the grammar.
How to generating parser code?
When the grammar file has changed generate new Python code with antlr4 and move generated files to ohsome_filter_to_sql/.
uv run antlr4 -Dlanguage=Python3 OFL.g4 && mv *.py ohsome_filter_to_sql/
Release
This project uses SemVer.
To make a new release run ./scripts/release.sh <version number>.
Resources
Metadata
Release files for ohsome-filter-to-sql 0.15.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ohsome_filter_to_sql-0.15.0.tar.gz | 36.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ohsome_filter_to_sql-0.15.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 75.0 kB
Release files / ohsome_filter_to_sql-0.15.0.tar.gz
| Download URL | ohsome_filter_to_sql-0.15.0.tar.gz |
|---|---|
| Size | 36.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f6912afeb421c6cdee5c17831d47555e427452a8a8c1e509d6f10853c2677f3
|
|
BLAKE2b-256 checksum How to use checksums |
91ba9f406ddbe78457bd3ba61a7954bf753d4630454cc99bd710b5bb191254c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ohsome_filter_to_sql-0.15.0-py3-none-any.whl
| Download URL | ohsome_filter_to_sql-0.15.0-py3-none-any.whl |
|---|---|
| Size | 38.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
155cc03e1284b178583f289a622a48dc85339100d63ca18fb20bb6abf564f1dd
|
|
BLAKE2b-256 checksum How to use checksums |
8fe4c1ca9180715bd548b3b32402ee60642e0d1ccb689c81ae61caf2da64d9d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|