mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
17 lines
471 B
Bash
Executable File
17 lines
471 B
Bash
Executable File
#!/bin/sh
|
|
set -efux
|
|
expected_max_results=1024 # the upper bound on the number of restaurants
|
|
radius=250
|
|
|
|
echo '[out:json];node(id:260050809)->.cbase;
|
|
(
|
|
node(around.cbase:'$radius')[amenity=fast_food];
|
|
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]
|
|
'
|