Skip to content

Commit

Permalink
adding jupyter notebook with right query parameters (codeforboston#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
thiteixeira authored and Joshhw committed Feb 20, 2019
1 parent baf571c commit c2207bd
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ BostonData/lambda_function/urllib3*
*.pyc

lambda_function.zip
ipython/

96 changes: 96 additions & 0 deletions ipython/arcgis_queries.ipynb
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": []
}
]
}

0 comments on commit c2207bd

Please sign in to comment.