Skip to content

Instantly share code, notes, and snippets.

@alexfu
Created November 1, 2018 13:55
Show Gist options
  • Select an option

  • Save alexfu/caef5ff703471fc553884a87f37d5c70 to your computer and use it in GitHub Desktop.

Select an option

Save alexfu/caef5ff703471fc553884a87f37d5c70 to your computer and use it in GitHub Desktop.

Revisions

  1. alexfu created this gist Nov 1, 2018.
    7 changes: 7 additions & 0 deletions geocode
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    #!/bin/bash

    BASE_URL="https://maps.googleapis.com/maps/api/geocode/json"
    API_KEY="" # Obtain an API key from https://developers.google.com/maps/documentation/geocoding/get-api-key
    ADDRESS=$1

    curl -s -G $BASE_URL --data-urlencode "address=$1" --data-urlencode "key=$API_KEY" | jq '.results[] | { name: .formatted_address, latLng: "\(.geometry.location.lat),\(.geometry.location.lng)" }'