2022-09-26 09:40:12 +02:00
|
|
|
#!/bin/sh
|
2022-10-04 10:59:17 +02:00
|
|
|
set -efux
|
2022-09-26 09:40:12 +02:00
|
|
|
expected_max_results=1024 # the upper bound on the number of restaurants
|
2022-10-04 10:59:17 +02:00
|
|
|
radius=250
|
2022-09-26 09:40:12 +02:00
|
|
|
|
|
|
|
|
echo '[out:json];node(id:260050809)->.cbase;
|
|
|
|
|
(
|
2022-10-04 10:59:17 +02:00
|
|
|
node(around.cbase:'$radius')[amenity=fast_food];
|
2022-09-26 09:40:12 +02:00
|
|
|
node(around.cbase:'$radius')[amenity=restaurant];
|
|
|
|
|
);out;' \
|
|
|
|
|
| curl -sSL -d @- -X POST http://overpass-api.de/api/interpreter \
|
|
|
|
|
| jq --argjson random "$(shuf -i 0-$expected_max_results -n 1)" '
|
|
|
|
|
.elements
|
|
|
|
|
| length as $length
|
|
|
|
|
| .[$random % $length]
|
|
|
|
|
'
|