Data in JS Exercises

Part 1 - Accessing Data

Work with local and global datasets that are immediately visual and cover different parts of the world. This part focuses on the fundamentals: fetching data from a URL and getting it onto the screen. The manipulations are minimal, focusing on loops and basic property access.

Note on API Keys: Some of these exercises require API keys. When they do, there will be places in the interface for you to enter your API keys. You should generally avoid checking these keys into git unless they are explicitly called out as public keys.

Local Data Sources

Global Data Sources

Exercise Ideas

  1. Map of Polling Places in Philadelphia:

    1-phl-polling-places/

  2. Map of Historic Markers:

    2-pa-historic-markers/

    Pennsylvania has a process whereby communities can apply to have a historic marker placed at a significant site – you may have seen these blue and gold signs around, as there are many in Philadelphia (they look like this: MOVE Bombing Historic Marker). The Pennsylvania Historical and Museum Commission (PHMC) provides a search interface for these markers, which is built on top of a JSON API.

  3. List of Most Recent 311 Calls:

    3-phl-311-calls/

    The City of Philadelphia makes a feed of 311 calls available in CSV format. For example, you can download the 100 most recent calls with this URL: https://phl.carto.com/api/v2/sql?filename=public_cases_fc&format=csv&skipfields=cartodb_id,the_geom,the_geom_webmercator&q=SELECT * FROM public_cases_fc ORDER BY requested_datetime DESC LIMIT 100

  4. Map of Recent Earthquakes: 🗺️

    4-usgs-earthquakes/

    The United States Geological Survey (USGS) provides a real-time GeoJSON feed of earthquakes worldwide. You can find the feeds at https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php. Note that points in these GeoJSON feeds are comprised of three coordinates: longitude, latitude, and depth (in kilometers). The GeoJSON specification allows for three-dimensional points, even though many mapping libraries only use the first two dimensions (longitude and latitude).

  5. List of Countries by Region:

    5-worldbank-countries/

    The World Bank provides several APIs for accessing country-level data. The Indicators API in particular allows access to various data points about each country (as measured by the World Bank). One simple API endpoint returns a list of all countries in a specified region. For example, to get all countries in “Latin America & Caribbean”, you can use this URL: http://api.worldbank.org/v2/region/LCN/country?format=json, or to get the countries across all regions, you can use http://api.worldbank.org/v2/country?format=json. You can find detailed information about the API call structure at https://datahelpdesk.worldbank.org/knowledgebase/articles/898581.

  6. Chart of Air Quality in a Major City:

    6-openaq-air-quality/