forked from codeforboston/voiceapp311
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding jupyter notebook with right query parameters (codeforboston#207)
- Loading branch information
1 parent
baf571c
commit c2207bd
Showing
2 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,3 +105,5 @@ BostonData/lambda_function/urllib3* | |
*.pyc | ||
|
||
lambda_function.zip | ||
ipython/ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ | ||
"nbformat": 4, | ||
"nbformat_minor": 0, | ||
"metadata": { | ||
"colab": { | ||
"name": "arcgis_queries.ipynb", | ||
"version": "0.3.2", | ||
"provenance": [], | ||
"collapsed_sections": [] | ||
}, | ||
"kernelspec": { | ||
"name": "python3", | ||
"display_name": "Python 3" | ||
} | ||
}, | ||
"cells": [ | ||
{ | ||
"metadata": { | ||
"id": "4E5zeVkY2LGK", | ||
"colab_type": "text" | ||
}, | ||
"cell_type": "markdown", | ||
"source": [ | ||
"# Base Queries to the ARCGIS Server\n", | ||
"\n", | ||
"## Grocery Stores in Boston" | ||
] | ||
}, | ||
{ | ||
"metadata": { | ||
"id": "pHZM3dPwqm2Q", | ||
"colab_type": "code", | ||
"colab": {} | ||
}, | ||
"cell_type": "code", | ||
"source": [ | ||
"import requests\n", | ||
"from pprint import pprint\n", | ||
"\n", | ||
"grocery_url = \"https://services.arcgis.com/sFnw0xNflSi8J0uh/ArcGIS/rest/services/Supermarkets_GroceryStores/FeatureServer/0/query\"\n", | ||
"params = {\n", | ||
" \"f\": \"json\",\n", | ||
" \"outFields\": \"*\",\n", | ||
" \"outSR\": \"4326\",\n", | ||
" \"returnGeometry\": \"true\",\n", | ||
" \"where\": \"1=1\"\n", | ||
"}\n", | ||
"\n", | ||
"response = requests.request(\"GET\", grocery_url, params=params)\n", | ||
"\n", | ||
"pprint(response.json())\n" | ||
], | ||
"execution_count": 0, | ||
"outputs": [] | ||
}, | ||
{ | ||
"metadata": { | ||
"id": "hvKaEx3f2MAv", | ||
"colab_type": "text" | ||
}, | ||
"cell_type": "markdown", | ||
"source": [ | ||
"## Food trucks today" | ||
] | ||
}, | ||
{ | ||
"metadata": { | ||
"id": "xTOyWxGEtD3b", | ||
"colab_type": "code", | ||
"colab": {} | ||
}, | ||
"cell_type": "code", | ||
"source": [ | ||
"import requests\n", | ||
"from datetime import date\n", | ||
"from pprint import pprint\n", | ||
"\n", | ||
"food_trucks_url = 'https://services.arcgis.com/sFnw0xNflSi8J0uh/arcgis/rest/services/food_trucks_schedule/FeatureServer/0/query'\n", | ||
"where = \"Day='\" + datetime.datetime.today().strftime('%A') + \"' AND Time='Lunch'\"\n", | ||
"\n", | ||
"params = {\n", | ||
" \"f\": \"json\",\n", | ||
" \"outFields\": \"*\",\n", | ||
" \"outSR\": \"4326\",\n", | ||
" \"returnGeometry\": \"true\",\n", | ||
" \"where\": where\n", | ||
"}\n", | ||
"\n", | ||
"response = requests.request(\"GET\", food_trucks_url, params=params)\n", | ||
"pprint(response.json())\n" | ||
], | ||
"execution_count": 0, | ||
"outputs": [] | ||
} | ||
] | ||
} |