COVID-19 realtime US county maps

Following up on the latest articles about this covid-19, in this example we use the awesome NovelCovid API to get data for each state in the US to populate individual state maps with county data. Here’s an example for Alabama:

You can download the export file here.

You will need to add the code below to the custom JS field and change the number in igm_custom_filter_20997 to the ID of your map. And where it says “Alabama” you would need to change it to the state you’re currently displaying.

More detailed will follow below.

function igm_custom_filter_20997(data) {
data.regions = data.regions.filter(function(region){
return region.province == "Alabama";
});
data.regions.map(function(region){
Object.assign(region, region.stats);
});
return data;
}

Setting up Regions

In this map we setup the regions to have a custom data source, an external JSON file generated by the API with the information for all US counties: https://corona.lmao.ninja/v2/jhucsse/counties

COVID-19 realtime US county maps

Setting Up Tooltip and Heatmap information

For the tooltip template, we added the following:

<strong>{county}</strong> <br> Confirmed: {confirmed} <br> Deaths: {deaths}

And in the Heatmap configurations we used the ‘confirmed’ information as the source:

COVID-19 realtime US county maps

Custom Callback

In order to get the information to work properly, we need to write a custom callback function to format the data and only retrieve the data from a specific state. The code used was already mentioned above.

COVID-19 realtime US county maps

Remember to change the “20997” from the code above, with the ID of your map for it to work properly. And change the state name to the one you’re building.

Feel free to leave a comment below if you have any question.

Australia COVID-19 tracker Map

Following up on the examples created before, in this examples we have created for other countries, here’s an example for Australia with real time information about confirmed COVID-19 cases, the new coronavirus outbreak.

You can download the import file.

The data is being fetched from Johns Hopkins University open repository of data for COVID-19. Make sure to credit them in your projects.

To create such a map, you need some custom code to fetch the external content. I have created a gist with the code used for the map above.

COVID-19 is an infectious disease caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2). The disease was first identified in late 2019 in Wuhan, the capital of China’s Hubei province, and has since spread globally, resulting in a coronavirus pandemic, which as the time of this writing, is still ongoing.

If you plan to create a map like the one above and have any questions, feel free to leave a comment below or contact me.