Community Health Maps

Creating a COVID-19 Temporal Animation with QGIS

One of the most powerful new features released with QGIS v3.14 is the Temporal Controller, which allows you to enable time in your maps. It can be used to temporally enable vector, raster, mesh and WMS(T) data. The Temporal Controller is now a core part of QGIS and has several variables associated with it that allow you to create powerful visualizations and animations. It contains most of the functionality found in the Time Manager plugin.

Here you will learn how to use it with the New York Times COVID-19 data to produce a county-based animation of the outbreak in the U.S.

Getting the Data

To begin, download the current New York Times live COVID-19 data, a U.S. Counties with population shapefile and a State boundaries layer from the U.S. Census. Unzip the county and state data.

Add the Data to QGIS & do some basic styling

Add all three datasets to QGIS 3.14, then use either the QuickMapServices or MapTiler plugin to add an OpenStreetMap basemap. If you have not installed these, you can do so from the Plugins menu option Manage and Install Plugins.

Next you will symbolize the States with a simple black outline and no fill. Press F7 to open the Layer Styling Panel. Make sure the states layer is the target layer in the panel.

  • Select the Simple fill component.

  • Change the Fill style to No brush.

  • Increase the Stroke width to 0.46.

The NYT data is structured such that there is an entry for each county for each day of the pandemic. For each date it has both the cumulative number of confirmed COVID-19 cases and deaths.

2020-08-10_162130.jpg

Processing the Data

The only data processing step is joining the COVID-19 data to the counties layer by FIPS code. This is a 5 digit code (2 for the state and 3 for the county) which is a unique identifier for each county in the country.

You will use the Join Attributes by Field Value processing algorithm. Use the Processing menu to open the Processing Toolbox. Use search box at the top of the Toolbox to search for ‘Join’. This will filter the available tools. Locate the Join Attributes by Field Value processing algorithm in the Vector general section. Fill it out as shown below being careful to select the Join type of Create separate feature for each matching feature (one-to-many).

Warning: This is going to create a very large dataset with over 400,000 features. It may take quite awhile to process depending on the speed of you machine.

2020-08-10_163329.jpg

Symbolizing the COVID-19 Data

When the data has been processed you can symbolize it. Again the size of this dataset makes it a bit unwieldy. Since the goal is an animation which builds towards the current total of COVID-19 cases, you want to set up the classes so they make sense for the latest date in the dataset. To figure this out, you will temporarily filter the data for the most current date.

  • Open Layer Properties for the layer.

  • Choose the Source tab.

  • In the Provider Feature Filter section click on the Query Builder button.

  • In the Fields box highlight the date field.

  • In the Values box click All. Again this is a big dataset so it may take a few moments for QGIS to compute a list of all the dates.

  • Form an expression in the Provider Specific Filter Expression box. First double-click on the date field to enter that in the lower box. Then click on the equals operator. Finally double-click on the most current date.

  • Click OK.

2020-08-10_164257.jpg

When finished, a small filter icon will appear to the right of the layer in the Layers Panel. If you hover over that filter your expression will appear. Now you will work on styling the filtered dataset.

  • Make sure the correct counties layer is the target layer in the Layer Styling Panel.

  • Where it reads Single symbol, change it to Graduated. The Graduated renderer allows you to symbolize the counties based on a numeric field.

  • You can begin by simply choosing the cases field as the Value.

  • Click the Classify button and you will see the counties classified into the default 5 classes in your default color ramp.

  • Choose Equal Counts as the Mode.

  • Increase the number of Classes to 7.

  • Use the Color ramp selector to find a nice color ramp. Here I’m using the RdYlBu ramp.

  • Right-click on it and choose Invert. This is necessary if using the RdYlBu ramp so that the counties with the highest number of cases are red.

  • Next you will change all the outlines for all the classes to a thin white line. To do this, click on the colored bar next to Symbol.

    • Select Simple fill.

    • Change the Stroke color to white and the Stroke width to 0.06.

    • Click the blue back arrow button to return to the main layer styling options.

2020-08-10_171438.jpg

Normalizing the data by population

This is now turning into a nice map. However, it will be more informative to normalize the number of cases against the population. Otherwise we risk making a map of just population centers. In the Value section where you chose cases as the field, click the Expression button. The Expression Dialog window opens with cases as the expression. Here you will divide cases by population and multiply by 1,000,000. This will give you the cases as a rate per 1,000,000 people. ‘

2020-08-10_172204.jpg
  • Put your cursor to the right of the word cases and click the / division symbol button.

  • Expand the Field and Values values section. You will see a list of all the attribute columns in the dataset.

  • Double-click on POPULATION to add field to your expression.

  • Next, wrap cases / “POPULATION” in parentheses.

  • Finally, enter a multiplication * symbol followed by the number 1000000 without thousands separators.

  • Click OK.

  • In the Layer Styling Panel click Classify again to see your map as cases per 1,000,000. You can also enter custom values. For example, you can set the upper limit for the first class to an even 2,500 versus the 2,508.62.

2020-08-10_172443.jpg

Now that you have the styling set, you will clear your layer filter. Click on the filter icon in the Layers Panel to open the Query Builder. Click Clear and OK.

Working with the Temporal Controller

Now you can work with the Temporal Controller.

  • Open Layer Properties for the counties layer and choose the Temporal tab.

  • Set the Configuration to Single Field with Date/Time and point it to the date column.

  • Set the Event duration to 1 week.

  • Close Layer Properties.

2020-08-11_081417.jpg

The layer will likely take awhile to render so you may want to turn it off now that you have it set up.

Decorations

Next you will work on some Decorations to add to the animation. These will allow you to add a title, legend and data source to the map canvas.

From the View menu find Decorations and choose Title Label. Click Enable Title Label and enter COVID-19 Cases per 1M by Date (NYT). Choose a font and a background color and click OK.

To add the legend to the map canvas, you will set one up in the Print Composer. Start a new Print Composition and add just a Legend. Configure it how you’d like and take a screenshot or reduce the size of the composition to fit to the legend and export it as an image.

Back at the main QGIS window revisit View —> Decorations and choose Image. Click Enable Image and load your legend. Use the Size and Horizontal/Vertical settings to place it in a good spot.

You can use the View —> Decorations—> Copyright Label to put the url to the New York Times GitHub repository on the map.

2020-08-11_082636.jpg

Labeling Time

Finally you will create a point layer to place the current day on the map. Click on the Layer menu and choose Create Layer —> New Geopackage Layer. Be sure to make it a point layer.

2020-08-11_083127.jpg

Put the layer into edit mode and create a point where you’d like the date to appear. Save your edits. Open Layer Properties and select the Temporal tab. Enable Temporal and set the Configuration to Redraw Layer Only. This tells QGIS to redraw this layer each frame.

Now you will symbolize and label this layer. For symbology change the renderer from Single symbol to No symbols. You don’t need to see the point. You will be using this layer to simply label time.

In the Layer Styling Panel switch to the Labels tab. Set labels to Single Labels. Click the Expression button to the right of Value. There are a series of variables tied to the Temporal Controller. Expand the Variables section and double-click on the @map_start_time variable to add it to your expression. This variable represents the start of the map’s time range. As you step through time on the map, this variable will update to represent the current start date for the map. You can use the format_date() function to put this time into your preferred format. If you highlight the format_date() function you will see some help in the right side of the expression window. Reference the example below. Also note that QGIS provides a preview of what your expression returns. Look in the lower left corner of the expression window. You can check this to ensure the expression is formatting the date as you wish. When finished click OK.

2020-08-11_084008.jpg

Lastly, choose a font for your time label.

Activating Time

Now you are ready to activate the Temporal Controller panel. Click on the Temporal Controller button on the Map Navigation toolbar, or use View—> Panels to activate it. Once visible, click the Animated Temporal Navigation button (right-most with green arrow) in the Temporal Controller panel.

2020-08-11_084703.jpg

Exporting Still Images

Set the Step to 1 days. You can now use the Temporal controls to step through time. However, the data are so large it will probably be awkwardly slow. Notice the Export Animation button to the right of the Step. Click this, and set it up to export out a series of still images, one per day.

2020-08-11_084932.jpg

Creating the final Animation in GIMP

Once the images have exported you can use the open source image editing software GIMP to create the animation. You can install it from the link.

Open GIMP and choose File —> Open as Layers. This will likely take a couple minutes as it loads all the still images.

2020-08-11_085248.jpg

Once it has finished loading the layers click Filters —> Animation —> Optimize (for GIF). This step too will take a couple minutes. Finally choose File —> Export As and export as a GIF. Set the File type as GIF and choose a folder for the export. Click Export and in the Export Image as GIF window be sure to check the As animation box. You can also choose the Loop forever option.

2020-08-11_090309.jpg

You will end up with something similar to the animation shown below! This same workflow can be used to create similar animations for deaths or for other countries.

Final Animation

Final Animation

Mapping King Tides in Post-Irma Miami

In the last three weeks I've flown to Miami twice, each time for the Community Health Maps (CHM) project. This is a project I've been working on for years. The goal is to empower underserved populations with low cost, intuitive mapping tools. The work is funded by the National Library of Medicine.

I went to Miami specifically to support an already established coalition of organizations working to document the impacts of king tides and help the communities being impacted. The focus was on one particular community, Shorecrest, who's residents are feeling the effects twice a day. "King tide" is basically a popular term for the highest tides of the year. It is sea level rise in action. The groups involved include: New Florida Majority, Florida International UniversityResilient Miami, and Unitarian Universalist Justice Florida.

We had been planning these two trips since summer to coincide with the September and October king tides. The plan was to support the community by training them in how to map these king tide events and their impacts. Then Hurricane Irma hit. I wasn't sure what to expect. Would it be more useful to help people document the effects Irma had on their neighborhoods?  Would people even have time to deal with the king tides in the aftermath of Irma?

When I first landed on September 17th it had only been six days since Irma had blown through. On the surface things looked almost normal. There was very obvious little structural damage. The visible damage from the street was piles of brush and debris on everyone's curb. The hotel was full of relief workers, mostly tree trimmers. Packing for these workshops were also a little different. I expected the water to be polluted, and it was also hard to know what the power situation would be in the neighborhoods I would be visiting. So I brought rubber boots, gloves, a face mask, portable chargers and a water purifier. 

We ended up going ahead with the initial plan. Collectively it was decided that there are often numerous variables involved in king tides such as storms. So the data would still be useful and it would be good practice for the community. Plus we might learn if there was more bacterial contamination resulting from the hurricane.

I thought this effort would be a perfect use of the new Fulcrum Community accounts. So Susan Jacobson from FIU applied for an account. It was immediately granted and we ended up using that. Jacobson and Tiffany Troxler from FIU, and Jan Booher from UU had already developed a water sampling protocol. They had refractometers for measuring salinity and bottles for collecting water samples. The bottles had a reagent in them that would tell us whether the samples were infected with bacteria such as coliform.  They also had yard sticks for measuring flood depth.

A King tide data collection kit

Two days ago I returned from the second trip to Shorecrest. Over the two trips I conducted several workshops with: people living in Shorecrest, students at FIU and community leaders. Using Fulcrum Community allowed me to focus on data collection with the community members. The only tech piece involved showing them how to use the Fulcrum app on their phones. That allowed our team to spend more time teaching about the actual water sampling protocol. Following that I taught a more involved workshop to the community leaders. There I showed how to manage the data and map it via QGIS and Carto. Going forward it will be their project to manage and I'll just serve in a support role. On October 7th there were dozens of people out collecting data!

Residents mapping and sampling King tides

The interesting thing about King tides is that they can come up via storm drains. The Shorecrest neighborhood we worked in is close to the coast, but not right on the coast. However, it is in a particularly low lying portion of Miami. During these king tides water comes up through these storm grates two times a day, flooding the streets, driveways and yards up to 2-3 feet in depth. The water is saline and initial water samples show that most has some level of bacterial contamination. The video below shows the flooding on October 7th at the intersection of NE 78th & 10th streets. 

Recently there have been some heavy rains saturating the soil and creating minor flooding in low lying areas. On October 7th the twice daily tidal flooding just added to it. The king tide water came up through the storm drains, cracks in the asphalt and the ground. The water rose up to knee level in a little over an hour. It flooded the Little River Pocket Park, streets, peoples driveways and yards. Trash piles from Irma are still there and are now potential sources of bacterial pollution. Most residents are also still dealing with mold and flood damage from Irma. It is not a good situation. Below are some before and afters that show the situation: 

Little River Pocket Park - before

Little River Pocket Park - during king tide

Before...

During king tide

Before...

During king tide

It was really powerful to be dropped into this community of Shorecrest, meet real people with real problems, and be able to help in some small way. My goal has always been to use the technology to help make the world a better place. I've also always been an activist. This work felt good from both perspectives. Disasters always affect poor areas the most and this is no different. It's a pretty grim situation that isn't getting much press. I'll be following up with some results in the near future, building on the initial map below.

Coffee, Community Health Maps & My Favorite Coffee Shops Visited in 2016

For the last couple of years I've been working on a project called Community Health Maps for the National Library of Medicine. The goal is to empower public health organizations working with underserved and at risk populations with mapping technology. We aim to help people who don't have backgrounds in computer science or geospatial technology, and don't have budgets for ArcGIS licenses. I've helped develop a program to show these people how they can 1) use Fulcrum to map their communities with smartphones, 2) map that data with Carto and 3) go even further with QGIS. 

Coffee Brewers

Coffee Brewers

This work takes me all over the country teaching half-day workshops. I've got it down at this point. In 3-4 hours I can teach 20-40 people who have never done any kind of map work how to collect data and map the results in Carto and QGIS.

I'm also a coffee geek. I've been hooked by the third wave coffee bug.  I take my coffee seriously as evidenced by my collection of brewers! My wife also compiled the video below of coffee roasters we tried in 2016.

For each training location, I assemble local data from OpenStreetMap and/or local sources. I always include a layer of the local coffee shops to try. After all, I'm going to try them anyway. It's a hobby of mine. Plus it makes it a little more fun, after a few hours of training, to have them open up a QGIS map showing the training location and some coffee shops to try. I usually google 'pour over' coffee in the area, and am sure to exclude all the Starbucks. To me one key to a quality coffee shop is the length of their menu. The shorter the menu the better. For example, I love this menu from Ninth Street Espresso in NYC.

In the last year or so I've been to Charleston 3 times, Seattle twice, along with Spokane, Honolulu, Lawrence, Washington DC and Salisbury MD. I've also been to NYC, Raleigh NC, Portland OR and Denver CO for other business trips. I finally got around to compiling a map of the best coffee shops I've been to in the last year. There are some good ones not on here, these are just the best of the best.

Of these Milstead and Co in Seattle is my favorite. They aren't a roaster but it is simply the best coffee shop I've ever been to. They make each each cup of coffee individually via AeroPress and offer an amazing selection of coffees to try. They are followed closely by Coava in Portland, Toby's Estate in Brooklyn, Black Tap in Charleston, and Boxcar in Denver.  Below are some shots from these coffee shops. Coffee and GIS were made for each other!

 

Black Tap - Charleston

Milstead & Co - Seattle

Toby's Estate - Brooklyn

Boxcar Coffee Roasters - Denver

Coava Coffee - Portland

If there isn't a good coffee shop I'll bring my Porlex mini grinder, some good beans an my Aeropress. Makes a great cup o' joe in my hotel room! Try it!

A Trip to Maryland to Teach Three Mapping Workshops

Last week I traveled to Maryland. I taught two workshops at the Prince Georges County Department of Social Services for people working on homeless issues. As with most Community Health Mapping workshops, all attendees were novices to mapping technology. However, in the first hour they all built a data collection form in Fulcrum and went outside to collect some data around the building.

Prince Georges County Community Health Mappers

Prince Georges County Community Health Mappers

The attendees represented a variety of organizations including many working with YouthREACH Maryland. REACH is an acronym standing for Reach out, Engage, Assist, & Count to end Homelessness. It is an effort to obtain accurate, detailed information on the number, characteristics, and needs of unaccompanied homeless youth in Maryland. Other organizations represented at these workshops included:

  • Maryland's Commitment to Veterans
  • Maryland Department of Planning
  • Prince Georges Community College
  • St Ann's Center for Children, Youth, and Familes
  • Maryland Multicultural Youth Center
  • So Others Can Keep Striving (S.O.C.K.S)
  • Sasha Bruce Youthwork
  • Lifestyles of Maryland.

In the final two hours of the workshops attendees learned how to map the data they collected in both Carto and QGIS. We also had time for a brief discussion about how CHM could be used in their projects. There were a lot of ideas shared about how the technology could help community engagement.

The afternoon workshop attendees feeling accomplished after completing their Carto maps!

The afternoon workshop attendees feeling accomplished after completing their Carto maps!

After the two PG County workshops, CHM traveled across the Chesapeake Bay bridge to Salisbury University on the eastern shore.

The following morning I taught a workshop geared towards social work students at Salisbury University. Attendees went through the CHM workflow and were introduced to FulcrumCarto and QGIS. Below is a map of data collected around the student center in Carto.

Salisbury University Data Collection in Carto

Salisbury University Data Collection in Carto

The workshop concluded with a short introduction to working with data in QGIS.

Salisbury University Data Collection in QGIS

Salisbury University Data Collection in QGIS

That afternoon I'd hoped to catch up with Art Lembo who wrote How Do I Do That In PostGIS? I realized at the last minute that the author of this little book I've had on my bookshelf works at Salisbury University. Unfortunately he was under the weather. FOrtunately I had time to drive to the Delaware shore for a quick beach walk.

The next scheduled workshop for the Community Health Maps team will be at the Teaching Prevention 2017 Conference in Savannah, Georgia. That conference takes place from April 5-7th. If you are interested in learning this technology this workshop will be a great opportunity!

Bird's Eye View Conducts a Training in the South Carolina Lowcountry

Recently Kurt Menke headed to Charleston, South Carolina to train several groups how to map their communities. This was part of the Community Health Maps project with the National Library of Medicine. This region is also known as the ‘lowcountry’ due to the flat, low elevation geography. The training was hosted by the Medical University of South Carolina (MUSC) and included people from Communities in Schools – Charleston (CISC) and the MUSC School of Nursing.

MUSC Community Health Mapping Training at the School of Nursing

First everyone learned how collect GPS field data with iPads. For this we used a new app named iForm. This app was used in lieu of EPI Collect, which no longer supported on iOS.  iForm is an app very similar to the Android app ODK Collect, allowing a custom data collection form to be developed. To practice we collected bike rack locations  and seating areas around the MUSC campus. The afternoon was spent working with everyone’s  data. GPS data points were brought into QGIS and shown against some local Charleston GIS data layers.

MUSC Data Points in QGIS

The points were also uploaded to CartoDB. CartoDB is another new component of the Community Health Mapping workflow. It has become more intuitive than GIS Cloud and worked really well. (Note: There will be a post on using CartoDB soon too.)

The following day I visited CISC’s Derek Toth and three of his students at St. John’s High School on John’s Island, SC. Over a working lunch Mr. Toth showed students how easy it is to collect GPS points with their iPhones. We collecting several points while walking around the campus.

Mapping the St. Johns Campus

Afterwards we went back inside and showed them how to upload the points into CartoDB and make a map. The figure below shows the results of 45 minutes worth of work! Click on the map to open the live version.

St Johns High School Data Points in CartoDB

This spring these three juniors will be leading the charge to map their island!  They will be presenting their work to the National Library of Medicine later this spring. I look forward to seeing their work!

The St. Johns High School Mapping Team from left to right: Jocelyn Basturto, Khatana Simmons, Candace Moorer (MUSC), Corrieonna Roper & Derek Toth (CISC)

Announcement: New Community Health Mapping Blog

Community Health Maps - Information on Low Cost Mapping Tools for Community-based Organizations

Kurt Menke, of Bird's Eye View, is contributing to a new FOSS4G related National Library of Medicine blog: Community Health Maps. The goal of the blog is to provide information about low cost mapping tools that can be used by community based public health organizations.  Perhaps you’ve seen the potential uses of mapping in public health, but are overwhelmed by the technology and/or simply too busy to pursue it.  I hope this blog will facilitate the use of GIS mapping for those that fall into this category.  I also hope to support those already engaged in mapping and enhance their community mapping initiatives, even if they may be using other tools.  The blog will be a mixture of mapping apps/software reviews, best practices, and the experiences of those who have successfully implemented a mapping workflow as part of their work. Training materials developed in 2013 are also available.

Low Cost Tools for Mapping Community Public Health

The past week was spent conducting training sessions on how to use a low cost workflow for public health mapping in minority communities. Trainings were conducted at two sites. The first site was the Urban Indian Health Institute in Seattle, Washington. They are monitoring noise pollution in urban indian populations. The other Papa Ola Lokahi in Honolulu, Hawai'i. They are working on a community public health assessment. The workflow starts with data collection using iPhones/iPads, moves into working with the the data in QGIS and finally data presentation via GIS Cloud.

Taking GPS and decibel readings in Seattle.There is an ever expanding ecosystem of geospatial apps for iOS. For this project we are evaluating EPICollect and GIS Pro. EPICollect is a free app designed to collect point data with a custom form. GIS Pro is a very expesive app. However, with the price comes a very intuitive and robust data collection system. 

An assortment of mapping apps for iPad

Once data is collected QGIS is used to combine the data with other organizational datasets, conduct spatial analyses and prepare maps. GIS Cloud is being used for final online presentation.