Skip to content

Instantly share code, notes, and snippets.

@perrygeo
Created December 20, 2016 13:05
Show Gist options
  • Save perrygeo/3fd95031033f6f34dfaaac4524e47bae to your computer and use it in GitHub Desktop.
Save perrygeo/3fd95031033f6f34dfaaac4524e47bae to your computer and use it in GitHub Desktop.
Geocode coordinates in `lat/lon` format for Mapbox web URIs
function coords-for {
if [ $# -lt 1 ]; then
echo "Usage: coords-for LOCATION"
fi
local location=$1
mapbox geocoding "$location" --features --limit 1 \
| jq -c ".center|[.[1],.[0]]" \
| sed 's/\[//g' | sed 's/\]//g' | sed 's/,/\//g'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment