Skip to content

Instantly share code, notes, and snippets.

@mattgrill
Created October 30, 2014 00:04
Show Gist options
  • Save mattgrill/e2f054e5a4d125ce1b62 to your computer and use it in GitHub Desktop.
Save mattgrill/e2f054e5a4d125ce1b62 to your computer and use it in GitHub Desktop.
#!/bin/sh
ZIPCODES=(36101 99801 85001 72201 94203 80201 06101 19901 32301 30301 96801 83701 62701 46201 50301 66601 40601 70801 04330 21401 02108 48901 55101 39201 65101 59601 68501 89701 03301 08601 87501 12201 27601 58501 43201 73101 97301 17101 02901 29201 57501 37201 73301 84101 05601 23218 98501 25301 53701 82001)
echo "id,lat,lng" >> out.csv
for i in ${ZIPCODES[@]}; do
curl "https://www.mapquestapi.com/search/v2/radius?key=Gmjtd%7Clu6t2luan5%252C72%253Do5-larsq&origin=${i}&units=m&maxMatches=4000&ambiguities=ignore&radius=3000&hostedData=mqap.33454_DunkinDonuts" | jq -r '.searchResults[] | [.fields.mqap_id, .fields.mqap_geography.latLng.lat, .fields.mqap_geography.latLng.lng] | @csv' >> out.csv
done
cat out.csv | sort -r | uniq >> sorted.csv
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment