Skip to content

Developing Interactive Map-Based Displays

In July 2021, Australia's New South Wales state identified several geographic zones with higher COVID-19 transmission rates, implementing heightened concerns. With the nation's approach centered on minimizing COVID-19 transmission, these locations were subject to increased scrutiny and precautions.

Developing Interactive Spatial Data Representations
Developing Interactive Spatial Data Representations

Developing Interactive Map-Based Displays

In response to the COVID-19 pandemic, Australia implemented stricter public health orders and restrictions, including lockdown measures that affected various jurisdictions. This news article will guide you through creating an interactive map using Python, GeoPandas, and Folium, which visualises discontinuance rates by geographic regions.

Step 1: Prepare your geographic data and discontinuance rate data

First, load the shapefile or GeoJSON containing your geographic regions (e.g., states, counties) using GeoPandas. Next, load your discontinuance rate data (e.g., CSV) that associates each geographic region with its discontinuance rate.

Step 2: Merge the discontinuance rate data with the GeoDataFrame

Join your discontinuance rates to the GeoDataFrame on a common key (e.g., region name or ID).

Step 3: Create a Folium map and add a Choropleth layer

Initialize a Folium map centered on the geographic region of interest. Use to visualise discontinuance rates by colouring the regions. Add tooltips or popups for interactivity (showing exact discontinuance rates).

Step 4: Save or display the map

Save or display the map as an HTML file.

Here is an example Python code workflow illustrating these steps:

```python import geopandas as gpd import pandas as pd import folium from folium.features import GeoJsonTooltip

m.save("discontinuance_map.html") ```

Additional Notes:

  • The parameter in must match the property name in your GeoDataFrame's geometry feature properties (often the region identifier).
  • You can customise colour schemes, opacity, popups, and layers as needed.
  • This method uses Leaflet.js via Folium, which is interactive in any modern browser.
  • You can use GeoPandas for spatial joins or geometry-based filtering before plotting if required.

If you want to plot lines or additional layers, Folium supports and with toggling as well. For example, you could overlay boundaries or lines representing special regions.

This approach corresponds to standard practice in Python geospatial visualization combining GeoPandas and Folium for interactive choropleth maps.

To use Folium in Google Colab, required packages can be installed and imported as shown.

The discontinuance rates are shown in a colour scale in 5 quantiles. The level of opacity in the map allows the suburbs in the base layer to be seen underneath the top layer. The Python code creates the base layer of the map, which opens at the center coordinates of the State of New South Wales.

The impact of these lockdown measures was felt on spending and incomes of residents.

In this context, data and cloud computing technology play a crucial role in the creation of the interactive map. The discontinuance rate data, typically in a CSV format, is loaded and merged with the geographic data stored in a shapefile or GeoJSON using GeoPandas, a data-and-cloud-computing tool. Additionally, the Folium library, a technology for creating interactive maps, is used to visualize the discontinuance rates by coloring the regions and to add tooltips or popups for interactivity.

Read also:

    Latest