Skip to content

Instantly share code, notes, and snippets.

@mheadd
Created August 29, 2014 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mheadd/0bc564c1af48c80b6827 to your computer and use it in GitHub Desktop.
Save mheadd/0bc564c1af48c80b6827 to your computer and use it in GitHub Desktop.
jq recipe to fetch Healthy Corner Store Locations in Philadelphia
echo 'x_coord,y_coord,name' > my-file.csv
curl -s "http://gis.phila.gov/arcgis/rest/services/PhilaGov/Healthy_Corner_Stores/MapServer/0/query?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&f=pjson" \
| jq .features[] \
| jq '[.geometry.x, .geometry.y, .attributes.OFFICIAL_S]' \
| jq @csv \
| sed 's/\\//g;s/""/"/g' \
>> my-file.csv
@mheadd
Copy link
Author

mheadd commented Aug 29, 2014

Note - you need to have jq installed for this script to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment