-
-
Save jtanguy/5712770 to your computer and use it in GitHub Desktop.
Semitan opendata jq helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the nearest stops for a given line | |
# Usage: curl -s https://open.tan.fr/ewp/arrets.json/47,24943/-1,54812 | jq 'nearestStops("2")' | |
def nearestStops(l):map(select(.ligne[].numLigne == l))| map({libelle, codeLieu, distance}); | |
# Get the next two stops for a given stop | |
# Requires jq version >= 1.3 | |
# Usage: curl -s https://open.tan.fr/ewp/tempattente.json/ECSU | jq 'nextStops("2")' | |
def nextStops(l): map(select(.ligne.numLigne == l)) | [{(.[].terminus): [.[].temps][0:3]}] | unique; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment