Created
August 29, 2014 18:48
-
-
Save mheadd/0bc564c1af48c80b6827 to your computer and use it in GitHub Desktop.
jq recipe to fetch Healthy Corner Store Locations in Philadelphia
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note - you need to have jq installed for this script to work.