Mapping

Overview Structs

Overview Functions

Structs

GEMS.AgeMapType
AgeMap <: MapPlot

A map that shows the average age per region.

GEMS.AttackRateMapType
AttackRateMap <: MapPlot

A map that shows the fraction of individuals that got infected at least one time per region. The region code (AGS) is taken from the individuals' household location, not the location of infection.

GEMS.CaseFatalityMapType
CaseFatailityMap <: MapPlot

A map that shows the fraction of infections that led to death time per region.

GEMS.GeolocatedType

Supertype for all simulation settings which directly contain individuals and are geolocated.

GEMS.InfectionMapType
InfectionMap <: SimulationPlot

A simulation plot type for generating an infection map.

GEMS.HouseholdSizeMapType
HouseholdSizeMap <: MapPlot

A map that shows the average household size per region.

GEMS.MapPlotType

Supertype for all maps that go into single-run simulation reports

GEMS.PopDensityMapType
PopDensityMap <: MapPlot

A map that shows the population density per region.

GEMS.SinglesMapType
SinglesMap <: MapPlot

A map that shows the fraction of single-person households per region.

Functions

GEMS.gemsmapFunction
gemsmap(data; type = :nothing, level = 3, plotargs...)

Generates a geographical map of a desired type. Just pass the name of the map-type as a Symbol (must be exactly the same as the respective SimulationPlot-struct). The data argument mus be either a Simulation object (used to map model-related features such as average household sizes per region) or a ResultData object (used to map simulation-result-related features such as the attack rate per region). Most of the maps that can be generated also take the level argument that converts the AGSs to the desired geographical resolution: states (level = 1), counties (level = 2) or municipalities (level = 3).

Parameters

  • data: Simulation or ResultData object.
  • type = :nothing (optional): Map type (instantiates a map with the exact same struct name).
  • level = 3 (optional): Desired geographical resolution: states (level = 1), counties (level = 2) or municipalities (level = 3)
  • plotargs... (optional): Any argument that the plot() function of the Plots.jl package can take.

Returns

  • Plots.Plot: Map using the Plots.jl package's struct.

Examples

Given that you have a simulation with geolocalized settings (available in the predefined models accessible via the German state codes. e.g., "SH" for the northern-most state of "Schleswig-Holstein"), you can plot the average age per region on a map like this:

sim = Simulation(population = "SH")
gemsplot(sim, type = :AgeMap)

If you want to change the resolution to counties, try:

sim = Simulation(population = "SH")
gemsplot(sim, type = :AgeMap, level = 2)

All gemsmaps can be nested and combined with any plot of the Plots.jl package or gemsplots:

using Plots
plot(
    gemsmap(sim, type = :AgeMap),
    gemsplot(rd, type = :TickCases)
)

Map Types

TypeInput ObjectDescriptionPlot-Specific Parameters
:AgeMapSimulationAverage age per region.
:AttackRateResultDataFraction of people who got infected per region.
:CaseFatalityMapResultDataFraction of infections that led to death per region.
:HouseholdSizeMapSimulationAverage household size per region.
:PopDensityMapSimulationPopulation density per region.
:SinglesMapSimulationFraction of single-person households per region.

Note: Maps that use infection data (e.g., the AttackRate) use the individuals' household location to map the data, not the loction of infection.

Some Useful Keyword Arguments

Here are some examples of the Plots.jl package's keyword arguments that you can also pass to the gemsmap() function and might find helpful:

  • clims = (0, 1): Setting the color bar range between 0 and 1
  • colorbar = false: Disabling the colorbar
  • size = (300, 400): Resizing the map plot
  • title = "My Subtitle": Adding a subtitle
  • plot_title = "My New Title": Changing the map title

Please consult the Plots.jl package documentation for a comprehensive list

GEMS.agsmapFunction
agsmap(df::DataFrame, level::Int64; plotargs...)

Returns a Plot.js plot with shapes of German states, counties, or municipalities. The input dataframe df requires two columns. The first column needs to be named ags and has to be a vector of AGS structs (Amtlicher Gemeindeschlüssel). The second column needs to be a vector of numerical values which are used to color-code the map. The level argument defines wether the map plots states (level = 1), counties (level = 2) or municipalities (level = 3). Note that the AGS in the dataframe must thus also be of the same geographic resolution. The optional plotargs... are passed to the plot object. Please lookup the Plots.jl package for more information about what arguments can be used to customize a plot.

Parameters

  • df::DataFrame: DataFrame with ags-named column that contains AGS structs and a second column with numerical values.
  • level::Int64: Map resolution. states (level = 1), counties (level = 2) or municipalities (level = 3)
  • plotargs... (optional): Any argument that the plot() function of the Plots.jl package can take.

Returns

  • Plots.Plot: Plot using the Plots.jl package's struct.
agsmap(df::DataFrame; plotargs...)

Wrapper for the agsmap function that infers the correct geographical resolution (level) from the input dataframe. Please lookup the agsmap(df, level; plotargs...) function's docstring for more information.

GEMS.generate_mapFunction
generate_map(coords::DataFrame, dest::AbstractString; region = [], plotempty::Bool = false)

Generates a GMT map and stores it into the folder specified in dest. The coords DataFrame must provide at least a lat- and a lon-column specifying latitude and longitude data pairs. The region parameter expects an array of four integer values providing the outer bounds of the map according to [min_lon, max_lon, min_lat, max_lat]. If no region parameter is passed, the bounds are taken from the lan/lon range provided in the coords data with a %-padding according to MAP_PADDING defined in constants.jl . With the plotempty flag you can force to plot a map without any data points.

Parameters

  • coords::DataFrame: Dataframe with lat and lon column
  • dest::AbstractString: Storage location for the generated map
  • region = [] (optional): four-item region vector defining the map limits in lat/lon min/max pairs (look up GMT.jl package to learn about regions)
  • plotempty::Bool = false (optional): Allows to plot an empty map if no data points are given

Returns

  • GMTWrapper: Custom struct containing the storage location of the generated map
GEMS.germanshapesMethod
germanshapes(level::Int64)

Returns the Shapefile.Table object read from the respective shapefile. Downloads the file if it is not already locally available. Lookup constants.jl to find remote location of the shapefile. The level argument defines wether the state- (level = 1), county- (level = 2) or municipality- (level = 3) shapes are returned.

Returns

Shapefile.Table{Union{Missing, Shapefile.Polygon}}: Shapefile data. Lookup Shapefile.jl package for documentation.

GEMS.maptypesFunction
maptypes()

Returns a list of all map types that can be used for the gemsmap() function.

GEMS.prepare_map_df!Function
prepare_map_df!(df::DataFrame; level::Int = 3)

Input df requires the format that can go into the agsmap() function. This means, at least two columns, the first one being an AGS column called ags and a second column with numerical values. The level argument converts the AGSs to the desired geographical resolution: states (level = 1), counties (level = 2) or municipalities (level = 3)

Returns

  • DataFrame: Adapted dataframe with desired AGS resolution in first column.
GEMS.region_rangeMethod
region_range(coords::DataFrame)

returns outer bound lat/lon for map plotting based in the provided coordinates dataframe. Adds a padding as specified in MAP_PADDING in constants.jl