Skip to content

Commit

Permalink
update module
Browse files Browse the repository at this point in the history
  • Loading branch information
gboeing committed Feb 5, 2024
1 parent ae579b3 commit bac9397
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions modules/05-geocoding-apis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Complete the following steps before the class session:
1. Sign in with your personal account (not a work or school Google account), create a new project for class, then click enable APIs.
1. Enable the Google Maps Geocoding API and then the Google Places API.
1. Go to billing and set up a credit card (you will not be billed for the usage in class, but these APIs require a card on file).
1. Go to credentials, create an API key, then copy it.
1. Rename the file `keys-example.py` (in this folder) to `keys.py`, open it, and replace the example API key with the one you copied above.
1. Go to credentials, then create credentials > API key, then copy it.
1. Rename the file `keys-example.py` (in this folder) to `keys.py`, open it in a text editor, and replace the example API key with the one you copied above.
16 changes: 8 additions & 8 deletions modules/05-geocoding-apis/lecture.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"source": [
"# geocode a place name to lat-lng\n",
"place = \"University of Southern California\"\n",
"latlng = ox.geocode(place)\n",
"latlng = ox.geocoder.geocode(place)\n",
"latlng"
]
},
Expand All @@ -163,7 +163,7 @@
" \"Vancouver, British Columbia\",\n",
" ]\n",
")\n",
"coords = places.map(ox.geocode)"
"coords = places.map(ox.geocoder.geocode)"
]
},
{
Expand Down Expand Up @@ -194,7 +194,7 @@
"# geocode a list of place names to a GeoDataFrame\n",
"# by default, OSMnx retrieves the first [multi]polygon object\n",
"# specify which_result=1 to retrieve the top match, regardless of geometry type\n",
"gdf_places = ox.geocode_to_gdf(places.to_list(), which_result=1)\n",
"gdf_places = ox.geocoder.geocode_to_gdf(places.to_list(), which_result=1)\n",
"gdf_places"
]
},
Expand All @@ -205,7 +205,7 @@
"outputs": [],
"source": [
"# geocode a single place name to a GeoDataFrame\n",
"gdf = ox.geocode_to_gdf(place)\n",
"gdf = ox.geocoder.geocode_to_gdf(place)\n",
"gdf"
]
},
Expand Down Expand Up @@ -235,7 +235,7 @@
"source": [
"# get all the buildings within that polygon\n",
"tags = {\"building\": True}\n",
"gdf_bldg = ox.geometries_from_polygon(polygon, tags)\n",
"gdf_bldg = ox.features.features_from_polygon(polygon, tags)\n",
"gdf_bldg.shape"
]
},
Expand All @@ -246,7 +246,7 @@
"outputs": [],
"source": [
"# plot the building footprints\n",
"fig, ax = ox.plot_footprints(gdf_bldg)"
"fig, ax = ox.plot.plot_footprints(gdf_bldg)"
]
},
{
Expand Down Expand Up @@ -276,7 +276,7 @@
"source": [
"# geocode an address to lat-lng\n",
"address = \"704 S Alvarado St, Los Angeles, California\"\n",
"latlng = ox.geocode(address)\n",
"latlng = ox.geocoder.geocode(address)\n",
"latlng"
]
},
Expand Down Expand Up @@ -749,7 +749,7 @@
"outputs": [],
"source": [
"# strip out all the wikipedia notes in square brackets\n",
"df = df.applymap(lambda x: re.sub(r\"\\[.\\]\", \"\", x))\n",
"df = df.map(lambda x: re.sub(r\"\\[.\\]\", \"\", x))\n",
"df"
]
},
Expand Down

0 comments on commit bac9397

Please sign in to comment.