{"id":25982425,"url":"https://github.com/krafpy/overpass-forge","last_synced_at":"2025-03-05T09:23:53.759Z","repository":{"id":186748617,"uuid":"675641752","full_name":"Krafpy/Overpass-Forge","owner":"Krafpy","description":"A library for generating OpenStreetMap's Overpass QL queries from Python objects.","archived":false,"fork":false,"pushed_at":"2023-09-09T09:50:35.000Z","size":131,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T09:18:42.748Z","etag":null,"topics":["openstreetmap","openstreetmap-api","overpass-api","overpass-ql"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/overpassforge/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Krafpy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-08-07T11:45:15.000Z","updated_at":"2024-07-22T00:04:38.000Z","dependencies_parsed_at":"2023-08-07T22:57:57.999Z","dependency_job_id":"e3bdba07-d327-4d89-ad60-8311c15d3048","html_url":"https://github.com/Krafpy/Overpass-Forge","commit_stats":null,"previous_names":["krafpy/overpass-forge","krafpy/python-overpass-forge"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krafpy%2FOverpass-Forge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krafpy%2FOverpass-Forge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krafpy%2FOverpass-Forge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Krafpy%2FOverpass-Forge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Krafpy","download_url":"https://codeload.github.com/Krafpy/Overpass-Forge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241998091,"owners_count":20055222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["openstreetmap","openstreetmap-api","overpass-api","overpass-ql"],"created_at":"2025-03-05T09:23:49.716Z","updated_at":"2025-03-05T09:23:53.720Z","avatar_url":"https://github.com/Krafpy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overpass Forge: a query builder for the Overpass query language\n\n[![PyPI latest version](https://img.shields.io/pypi/v/overpassforge)](https://pypi.org/project/overpassforge/)\n![License](https://img.shields.io/github/license/Krafpy/Overpass-Forge)\n[![Documentation status](https://readthedocs.org/projects/overpassforge/badge/?version=latest)](https://overpassforge.readthedocs.io/en/latest/?badge=latest)\n![CI tests](https://github.com/Krafpy/Overpass-Forge/actions/workflows/ci.yml/badge.svg)\n\nAn object-oriented model to build Overpass queries in Python. Primarly intended\nto generate complex queries in Python. Checkout the [documentation](https://overpassforge.readthedocs.io/en/latest/).\n\n## Install\n\nRequires **Python 3.10 or higher**. Install with:\n\n```cmd\npip install overpassforge\n```\n\n## Example\n\n```python\nfrom overpassforge import Areas, Nodes, Ways, build, beautify\n\n# Find both cinema nodes and ways in Bonn, which\n# are at most 100m away from bus stop nodes\n\nbus_stops = Nodes(within=Areas(name=\"Bonn\"), highway=\"bus_stop\")\nways = Ways(around=(bus_stops, 100.0)).where(amenity=\"cinema\")\nnodes = Nodes(around=(bus_stops, 100.0)).where(amenity=\"cinema\")\nresult = ways + nodes\nresult.out(\"meta\")\n\nquery = build(result)\nprint(beautify(query))\n```\n\nOutput:\n\n```text\narea[\"name\"=\"Bonn\"]-\u003e.set_0;\nnode(area.set_0)[\"highway\"=\"bus_stop\"]-\u003e.set_1;\n(\n  way(around.set_1:100.0)[\"amenity\"=\"cinema\"];\n  node(around.set_1:100.0)[\"amenity\"=\"cinema\"];\n);\nout meta;\n```\n\n## Features\n\nList of currently implemented features, based on the [Overpass QL wiki](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL).\n\n- Settings: all except augmented-difference between dates (*adiff*)\n- Block statements\n  - [x] union, difference, intersection\n  - [ ] For-each loop (*foreach*)\n  - [ ] Block statements *if, for, complete, retro, compare*\n- Standalone statements\n  - [x] out\n  - [x] Item (implicit)\n  - [x] Recurse up (\u003c) and down (\u003e)\n  - [x] Recurse up relations (\u003c\u003c) and down (\u003e\u003e)\n  - [x] Query for areas (*is_in*)\n  - [ ] Statements *timeline*, *local*, *convert*, *make*\n  - [x] The Query Statement (*node, way, rel, area* **only**)\n  - [ ] The Query Filter\n  - [x] Map way/relation to area (*map_to_area*)\n- Filters\n  - [x] By tag (*has-kv*)\n  - [x] Bounding box\n  - [ ] Recurse (*n, w, r, bn, bw, br*)\n  - [ ] Recurse (way_cnt, way_link)\n  - [x] By input set (*.setname*)\n  - [x] By element id\n  - [x] Relative to other elements (*around*)\n  - [x] By polygon (*poly*)\n  - [x] *newer*\n  - [x] By date of change (*changed*)\n  - [x] By user (*user, uid*)\n  - [x] By area (*area*)\n  - [x] Area pivot (*pivot*)\n  - [ ] Conditional query filter (*if:*)\n\n## Contributing\n\n### Setup the development environment\n\n#### Windows\n\n```cmd\npython -m venv .venv\n.\\.venv\\Scripts\\Activate.ps1\npython -m pip install -r requirements.txt\n```\n\n#### Linux\n\n```cmd\npython -m venv .venv\nsource .venv/bin/activate\npython -m pip install -r requirements.txt\n```\n\n### Unit tests\n\nRun all the tests with:\n\n```cmd\npython -m pytest ./tests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrafpy%2Foverpass-forge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrafpy%2Foverpass-forge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrafpy%2Foverpass-forge/lists"}