Assignment 5: LocalData
Worth: 40 points
For this assignment, you will create a custom LocalData survey to collect spatial data for something that interests you in the Bay Area. You will then map and analyze this data using the tools we've learned this semester. The purpose of this assignment is to gather your own data and analyze it.
- Identify some area of interest -- a neighborhood close by that you can walk through to collect data -- and a question you'd like more data about
- Visit http://demo.localdata.com and login with the following credentials for the "master" UC Berkeley account. Email: email@example.com Password: B34rsEatB33ts
- Create a LocalData survey based on your question. Each student should create his or her own survey by clicking the "Create Survey" button.
- Selecting a base layer: When creating a survey, students will be prompted to select the type of survey data they want to collect (points or parcels). Berkeley and San Francisco parcel data is pre-loaded. Currently students can choose to drop points on a satellite layer or add data to a parcel layer.
- Mobile data collection: Once a survey has been created, students can access the mobile web app by clicking on the tab "Collect Data." The link that appears in the url bar will open in any mobile browser (best in chrome). Students can add questions, change the order conditionally and add things like photos or text-based answers to their dataset.
- Use the survey in your area of interest to create a data set to answer your question (we expect the work involved for this step to take around 4 hours) Collect at least 50 data points in order to have enough data to map and analyze
- Export your data set to geojson and visualize it as a leaflet map
- Export your data set to csv and run some descriptive statistics on it using Python and pandas. Create at least 2 matplotlib visualizations.
- Write a brief assessment of your experience generating the data and using LocalData for this assignment.
- Submit your ipython notebook, written assessment, and a screenshot of your leaflet map
Here are Prashant's suggestions for accessing geojson data from LocalData:
You can log on to the dashboard with the following username/password
After you create a survey, you’ll notice the URL for that survey has a “slugified” version of the name. For example, the “Cal Demo” survey I used in class has “cal-demo” as its URL slug. I’ll use that survey/slug as an example. By grabbing that slug from the dashboard URL, we can avoid the API steps of logging in, listing surveys, etc.
Use the survey’s slug to get the survey’s ID:
That should give you something like the following:
Now we can fetch the responses. To get the first 10, we can use the following URL:
We can change the
count parameter to get more responses at once, or we can change the
startIndex parameter to 10 to get the next chunk of data.
To map the data, it’s probably more useful to grab results that fit into some bounding box. You can make the geographic queries using the
bbox parameter instead of
count. We use decimal longitude/latitude for the bounding box coordinates, and the format is north,west,south,east. For example, here is a request for data bounded by northwest corner (-122.255859375, 37.85750715625204) and southeast corner (-122.25311279296875, 37.859675659210026) (part of the block at Regent and Oregon):
To get a more visual sense of the data, and to sanity check the queries, you can copy-and-paste the API’s response into geojson.io. The previous query should give you something like what you get here: http://bl.ocks.org/d/919ffd9367f555686691