ArcGIS Pro

Visualize US county polygons with latest coronavirus cases in ArcGIS Pro

Johns Hopkins University CSSE’s USA county level coronavirus (COVID-19) hourly data is currently available through ArcGIS Online. These are point data representing center points within each county. I was asked the other day (a) how to bring this data into ArcGIS Pro to visualize them per county polygons and (b) how to keep it updated; and if necessary, do further analysis, reporting etc. using the vast capabilities we have in ArcGIS Pro. In response to that question, I decided to write this blog.

At a high level, the process is pretty straight forward:

Let’s dive in.

Steps to bring coronavirus data to US county polygon layer:

  1. Insert a new map or open an existing one
  2. Add the feature service in a map in ArcGIS Pro
  3. Make a map or scene in your active view.
  4. On the Map tab, in the Layer group, in the Add Data menu, click Data From Path.
  5. Type the following URL.
    https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases_US/FeatureServer/0
  6. Click Add.
  7. Rename the layer Coronavirus Cases.
  8. Add your county layer from your geodatabase
    You can download it from here if you don’t have your own dataset, and store it in a file geodatabase.
    Note: county polygons are in an equal area projection.
  9. Rename it US Counties.
  10. Join Cases layer to the county layer
  11. Select US Counties layer from the Content pane.
  12. Under Feature Layer, on the Data tab, in the Relationship group, in the Join menu, click Add Join.
  13. Fill in the geoprocessing tool using the values from the table below:
    Layer Name or Table View: US Counties
    Input Join Field: FIPS
    Join Table: Coronavirus Cases
    Output Join Field: State/County FIPS Code
  14. Click Run.
  15. Optional: You can remove the Coronavirus Cases layer
  16. Open US Counties layer’s attribute table window or click on a county to open its attributes in a popup window.
    You will see county features are populated with coronavirus cases data such as Confirmed, Recovered, Deaths, Last Update etc.
  17. Symbolize US Counties layer appropriately.
    Note: see Ken Field’s blog post on how to map coronavirus responsibly. I used the color ramp he used in the blog.
  18. Since the join is dynamic in nature, every time your map refreshes, it draws with the latest updates from the feature service.

Problems with this approach

There are basically three problems with this approach:

  1. Performance: Every time the layer redraws, it pulls data from the feature service. These additional calls made over the internet cause the map to draw slower than expected depending on your internet speed and loads on the server hosting the feature service.
  2. Unnecessary downloads: Since data gets updated every hour, it is unnecessary to make calls to retrieve the same data from an ArcGIS Online server in between.
  3. Reliability: In case you have internet outage or network issues, your map won’t draw anything.

Solution (part 1): download data to your local geodatabase

  1. Open Feature Class to Feature Class geoprocessing tool.
  2. Use Coronavirus Cases layer as Input Features.
  3. Set Output Location to the same database where you have your US County dataset.
  4. Click Run.
  5. Once it finishes successfully, follow steps from above to join this local version of coronavirus cases with your US county layer.
  6. Since both datasets are stored in the same geodatabase, join happens at the database level and performance is much better than joins occurring at application level.

Solution (part 2): keep it updated every hour

It is great that at this point, you got your data copied in your local geodatabase and you should see pretty fast drawing. But how do you keep your data updated? Luckily, ArcGIS Pro 2.5 allows geoprocessing tools to be scheduled to run at a later time or with recurrence.

Since Feature Class to Feature Class or Copy Features geoprocessing tool overwrites existing (or creates new) feature class, running one of these tools in the scheduler will fail as existing feature class gets locked while being used. For this reason, instead of overwriting an existing feature class, we will delete all rows for coronavirus cases using Truncate Table tool, and populate new ones from the feature service using Append tool.

  1. Open Truncate Table tool
  2. Select the coronavirus case dataset/layer you downloaded in the previous section
    Note: use the one that is stored in your machine (or within your network), not the one that points to the feature service
  3. Instead of clicking on Run, click on the arrow button next to it to bring up a split menu and select Schedule to run it every hour.
  4. Open Append tool
  5. Copy/paste the feature service URL, from the very first section, in the Input Datasets.
  6. Select the coronavirus case dataset you downloaded in the previous section as the Target Dataset.
  7. Repeat step#3 to run this every hour, maybe a few seconds after Truncate Table tool runs.

Instead of running them separately, you can include both of these tools in a geoprocessing model to run them in sync, and schedule the model to run every hour.

You can download the model that I used from here.

https://www.arcgis.com/home/item.html?id=2d8173094b604f9b83c765ac6c98b3a4

I hope you have found this helpful in some way, and stay safe and healthy.

 

I’d like to thank James Portolese @ CBRE EA whose question led me write this blog.

About the author

Tanu is a product engineer on Esri Mapping Team focusing on map service, print service, and ArcGIS Pro. He also works on spatio-temporal analysis, spatial aggregation and real-time data. Tanu’s background includes a masters in Urban Planning from University of Akron, Ohio, USA and a bachelor degree from Khulna University, Bangladesh, and worked as GIS Coordinator in City of West Springfield, and GIS Specialist in a hydrology modeling center in Bangladesh before joining Esri.

Connect:

Leave a Reply

Please Login to comment
Dunn, Jeremy
Dunn, Jeremy

Tanu

Great Blog, very well presented and very very useful. Just one question the scheduler tool section. I don’t have ArcPro 2.5 so I assume this is the reason why I don’t see the Run and Scheduler button that you describe and show.

I can schedule in a script, so no problem but having the scheduler in the tool is very useful.

Many thanks. Great Blog.

Regards.

Jeremy.

Dunn, Jeremy
Dunn, Jeremy

Tanu,

One more question. There is no data for Queens and Kings Counties in New York for the feature service you have referenced is there anyone at esri that knows why this is ?

Regards.

Jeremy.

Next Article

Jeffrey Sachs discusses the critical roles of GIS and storytelling in solving global challenges

Read this article