My favorite way is to use the transition APIs . Here's how:
Put something like this in the query form at http://www.overpass-api.de/query_form.html , changing the four bounding edges s, n, w and e at the south, north, west and east edges of your desired data. (Use the OpenStreetMap export tab to drag the rectangle and get the borders.)
<osm-script timeout="10000" element-limit="1073741824"> <union into="_"> <bbox-query into="_" s="52" n="52.4" w="4.8" e="5"/> <recurse from="_" into="_" type="up"/> <recurse from="_" into="_" type="down"/> </union> <print from="_" limit="" order="id"/> </osm-script>
I got this method directly from good authority: one of the Overpass developers. I have used it successfully. One caveat: it is repeated twice to get all the paths that are members of the relations that overlap the rectangle, and then get all the points in that direction.
The script sets the wait time to 10,000 seconds, and the element is limited to a sufficiently large number.
source share