Reputation: 1605
Is it possible to use the Overpass Api for OpenStreetMap to find all relations crossing the bounds of a boundingbox?
I have the boundingboxes of several cities. Now I want to find all bus routes going in and out the boundingbox to find bus route connections between cities.
So: how to find relations with part of it in and part of it out the boundingbox?
Upvotes: 1
Views: 616
Reputation: 3678
If you happen to have a matching relation for your city, I'd recommend to use (around:0)
and find the routes intersecting the city borders.
As for the City of Berlin, you could find all railway routes crossing the city border via this query:
[bbox:{{bbox}}];
rel(62422);
out geom;
>;
relation(around:0)[route=railway];
out geom;
As there's no existing relation in the OSM data to exactly match your bounding box, you won't be able to use that approach. As an alternative, you could introduce four very small bounding boxes matching each side of your current bounding box.
Here's an illustration: the blue inner box is what you have right now. I added 4 very small yellow bounding boxes covering each 4 sides of that inner bbox. When a bus route is included in any one of the 4 bounding boxes, you should have the ones you're looking for.
Upvotes: 3