A simple UI tool that makes it easy to run overpass API queries on a large BBox by splitting it up into smaller areas and joining the resulting geojson file(s).
This tool uses the overpy library to run the queries, the tkintermapview library to draw the map and bbox segmentation as well as the geojson library to handle the result files.
Compile and run Overpass split 'n' stitch.py
.
Paste your overpass query into the field on the left, adjust your bbox and hit Run! A file dialog will appear. Choose the path where you want the resulting geojson file to be saved. After the query has completed, a noice will appear and you can quit the tool and open the results file you saved earlier, for example using the JOSM editor or QGIS.
If you want to add more query parameters, such as a timeout, you can select the "Add more options" checkbox, thus removing the semicolon at the end of the preset query header and therefore not terminating it. You have to add this semicolon after your custom parameters.
You can customize the borders of your rectangular bbox using the according options. You can also check "global search" to search globally.
Note that in any case, results south of -89.99999° will be ignored because of a possible bug in a used library. I hope you don't want to search anything about 4 feet around the south pole.
You can set the number of segments to influence the individual segment size. Uncheck "Show segmentation" if you're using a large number and the visualisation bogs down your computer.
This is an early version of the Overpass Split 'n' Stitch tool. It works well enough for what I need it for personally, which is why I chose to publish it now, but it is very much unpolished and I will try to get around to some issues. Here are some of my ideas for future versions:
For particularly large queries, it would be nice if you could usse this tool to query a self hosted version of the overpass api. But it seems there isn't support for that yet in ther overpy library. This other overpass wrapper has an easy option for that, but doesn't just easily pass through the query, which is why I ultimately opted against using that one.
I prefer looking at pretty pictures rather than working with the naked numbers, especially when it comes to geocoordinates and maps. However, I know people like command line tools and I consider removing all the gui elements and just packing the bbox segmentation function into its own command line tool.
To make it more complete and easy to use just like the overpass turbo website. Run huge queries and look at the results in just one window, so you don't even have to figure out what to do with the resulting geojson file and how to open it.
So far, all the input options go inactive and nothing happens for a while until all the queries are finished. That is ok if you know what's going on, but I would like to add a "everything is fine" communication of some kind for confused users. I dream of multi-colored progress bars showing succesful, unsuccesful and currently pending segments.
The tile view is a great opportunity to show each tiles progress for each tile.
This one is a big oversight. If you have a typo in your query, the program just stops. Error handling should be somewhat easy to implement in the future and is necessary for dealing with unsuccesful segments.
It doesn't make any sense to have the same segment size over oceans and in city centers. Options for dynamic tile sizes based on node density would be very useful, but that is above my paygrade at this point.
If you're interested in any of these issues or other possible features feel free to contribute, open an issue or write me on Mastodon!