Computational Methods in the Civic Sphere at Stanford University
Project Example: Show Me Nearest Earthquakes
A step-by-step process of creating a project that downloads earthquake data, geocodes a user's location, and displays the nearest locations.
Say Hello to the User
Writing a Python script that responds to a user is as easy as using the input() function
Making and packaging a fake (for now) geocode() function
We might not know how to write a geocoder yet, but we can at least fake it with some fake data and then package it in the Python way.
Documenting our fake geocode() function with a docstring
By adding a "docstring" to the beginning of our functions, we can create a human-readable piece of text that describes what our function actually does.
Parsing the Mapzen response data before actually calling the API
Before we make the geocode() function actually talk to Mapzen, let's just focus on a pre-fetched response and extracting the data from it.
Contacting the Mapzen API and geocoding a real location
After all that work to prepare for the response from the Mapzen API, we just have to call the correct endpoint and pass along the location.