nau-sidewalks/scripts/fetch_sidewalk_data.sh

17 lines
773 B
Bash
Executable file

#!/usr/bin/env nix-shell
#! nix-shell -i bash --pure
#! nix-shell -p bash curl cacert jq
# TODO: process out extraneous data
# curl -s https://overpass-api.de/api/interpreter --data-urlencode 'data=[out:json];area[name="Northern Arizona University"]->.searchArea;(way["highway"="footway"](area.searchArea);way["highway"="cycleway"](area.searchArea););out geom;' -o data/sidewalks.json
curl -s "https://overpass-api.de/api/interpreter" --data '
[out:json];
area[name="Northern Arizona University"]->.searchArea;
(
way["highway"="footway"](area.searchArea);
way["highway"="cycleway"](area.searchArea);
);
out geom;' \
| jq '[ .elements[] | { OSMID: .id, Geometry: [ .geometry[] | [ .lat, .lon ] ], Tags: .tags } ]' > data/sidewalks.json