Skip to content

Use bounding boxes as pre-step to speed up around statement - #13

Open
lonvia wants to merge 1 commit into
fossgis:masterfrom
lonvia:perf-around
Open

lonvia wants to merge 1 commit into
fossgis:masterfrom
lonvia:perf-around

Conversation

@lonvia

@lonvia lonvia commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

This is one of mmd's performance fixes ported over from drolbr#167. See the original PR for details.

@cldellow

Copy link
Copy Markdown

I think something might have been lost - in drolbr#167, way_bboxes is added to: https://github.com/drolbr/Overpass-API/pull/167/changes#diff-588331687964a7008508f33275b6f6477585d48f39195c8ec3814bff8d0b11f9R942, but that line is missing in this PR.

The Nova Scotia regression suite flagged some queries whose behaviour change with this PR, e.g. 0574.

Simplifying it a bit, the part that changed was way(around:0,44.761014,-63.661347,44.758743,-63.661981); out count; -- master returns 9 ways, this PR returns 0.

@mmd-osm

mmd-osm commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Right, https://dev.overpass-api.de/overpass-turbo/?q=d2F5KGFyb3VuZDowLDQ0Ljc2MTAxNCwtNjMuNsSRMzQ3xIzEjjc1ODc0M8SWxJjEmsSROTgxKTsgxIZ0IGPEhm50Ow is also returning 9 ways. Looks like there’s something missing here which is already in my fork.

@lonvia

lonvia commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

I've added those lines. Still untested though. I need to set up the regression tests.

@cldellow

Copy link
Copy Markdown

I pulled this into my fork to test it. The fuzz and property-based tests found a change in behaviour vs baseline. I think the change is good -- IMO the patch fixes incorrect behaviour currently in master.

Another datapoint about testing: neither the upstream built-in tests nor my fixed 612-query Nova Scotia corpus caught the change in behaviour.

The change in behaviour:

[out:csv(::id,::lat,::lon;false)];
node(around:0,44.8697971,-63.0928802);
out;

Currently returns:

3491552732  44.8697971  -63.0928802
5534330612  44.8697970  -63.0928802

With this PR, returns:

3491552732  44.8697971  -63.0928802

The new reponse feels more correct to me.

Timing wise: nothing slows down, and some around queries become dramatically faster. On a Nova Scotia extract, an unbounded query:

way[highway=motorway]->.m; node(around.m:100)[amenity];

goes from 2,143ms to 964 ms (-55%).

A maybe more realistic bounded query:

rel[route=bus](44.6,-63.7,44.7,-63.5)->.r; node(around.r:30)[highway=bus_stop];

goes from 484ms to 335ms (-31%).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants