Data Adventure #6: How to Map Geographic Data from a CSV File

Posted on 07/01/19 by LA Counts


Everyone who uses a smartphone knows about location tracking. When you hail a Lyft or ask Google Maps for directions, your smartphone uses your GPS (Global Positioning System) location. Data analyses can also use location data to help you better understand what is going on in a particular geographic area. For example, you could map all the taco stands in your neighborhood. Data visualization tools have steadily improved over the last decade. Thanks to a robust set of Python libraries, anyone can now create maps using geographic data!

In this instructable, you'll map the location of every public elementary school in Los Angeles. You could be interested in simply understanding where the schools are, or have a larger project related to community health that involves location.

There are several data formats for geographic data. Here, we use a simple form of geographic data – latitude and longitude coordinates – to create a map using Plotly and Mapbox. To do this, we will use the same Plotly library in Python, alongside the integration of Mapbox. This same code will work with any dataset that includes latitude and logitude coordinates.

While programming experience helps for this instructable, it is not required. (Please see our first and second instructables for information on the tools used in this exercise, and the final instructable for information on APIs)

Linked stories

comments powered by Disqus