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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ohsome_filter_to_sql-0.14.0.tar.gz.
File metadata
- Download URL: ohsome_filter_to_sql-0.14.0.tar.gz
- Upload date:
- Size: 36.6 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a11d46bbe65c5c13a6b0f4d30563ae300c63dd3b0cca1d02d76e543aedf7196
|
|
| MD5 |
c6d6527675fb3f0252d34f13b24d9d27
|
|
| BLAKE2b-256 |
6d5ceabbd040844bd285012caa6ce7b3a5ba5a99434190e98790e8b129a93829
|
File details
Details for the file ohsome_filter_to_sql-0.14.0-py3-none-any.whl.
File metadata
- Download URL: ohsome_filter_to_sql-0.14.0-py3-none-any.whl
- Upload date:
- Size: 38.1 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d12a7119d69b651fdfb194d90c2a0ff138bb7accf93b0db21d38770670ff4029
|
|
| MD5 |
acf125cd4f2a90ed735561b4db105a9d
|
|
| BLAKE2b-256 |
7c175304d98c8849d6eb13f772ab2ea06dc78758cec02bd87967c0df573f5418
|