Description Super classes Methods
UK Geography
UK Geography
ukcovidtools::PassthroughFilesystemCache -> ukcovidtools::DataProvider -> UKGeographyProvider
new()UKGeographyProvider$new(providerController, ...)
getMapList()UKGeographyProvider$getMapList()
getMap()get a map as an sf object
UKGeographyProvider$getMap(mapId, ...)
codeTypethe map you want
getPHEDashboardMap()UKGeographyProvider$getPHEDashboardMap(...)
getIntersection()UKGeographyProvider$getIntersection( inputMapId, inputShape = self$getMap(inputMapId), outputMapId, outputShape = self$getMap(outputMapId), ... )
getContainedIn()UKGeographyProvider$getContainedIn( inputSf, outputShape = self$getMap(outputMapId), outputMapId = NA, inputIdVar = "code", outputIdVar = "code" )
interpolateByArea()interpolate a variable from one set of shapes to another
UKGeographyProvider$interpolateByArea( inputDf, inputMapId, inputShape = self$getMap(inputMapId), inputIdVar = "code", interpolateVar, outputMapId, outputShape = self$getMap(outputMapId) %>% dplyr::group_by(codeType, code, name), outputVars = outputShape %>% dplyr::groups(), aggregateFn = sum )
inputDf- a grouped dataframe containing the statistic to be interpolated
inputShape- an input map,
inputIdVar- an id shared between the grouped data fram and the input map,
interpolateVar- the statistic,
outputShape- an output map which must be grouped by the desired output,
a dataframe containing the grouping columns, the outputIdVar and the interpolated value of interpolateVar
createNeighbourNetwork()create a neighbourhood network from a shapefile
UKGeographyProvider$createNeighbourNetwork( mapId, shape = self$getMap(mapId) %>% dplyr::group_by(code, name), idVar = "code", ... )
mapId- a the ID of the map
shape- a sf object, if not present will be loaded from cache
idVar- the varable containing the coded identifier of the map
an edge list of ids with from and to columns
standardiseMap()standardise all maps to a minimal set of attributes with consistent naming
UKGeographyProvider$standardiseMap(sf, codeCol, nameCol, altCodeCol, codeType)
saveShapefile()save a shapefile to disk in the current working directory
UKGeographyProvider$saveShapefile( mapId, shape = self$getMap(mapId), overwrite = FALSE )
mapId- a mapId - will become the zip filename
-a zip directory
a dataframe containing the grouping columns, the outputIdVar and the interpolated value of interpolateVar
loadAllMaps()warm up caches
UKGeographyProvider$loadAllMaps()
createCatchment()create a catchment area map from
UKGeographyProvider$createCatchment(
supplyShape,
supplyIdVar = "code",
supplyVar,
supplyOutputVars = supplyShape %>% dplyr::groups(),
demandId,
demandShape,
demandIdVar = "code",
demandVar,
growthRates = function(capacityPerDemand, multiplier = 1.1) {
return(rank(capacityPerDemand)/length(capacityPerDemand) * multiplier) },
distanceModifier = function(distanceToSupply) { return(2/(1 +
distanceToSupply/min(0.1, mean(distanceToSupply)))) },
tweakNetwork = self$sources$tweak$DEMOG,
outputMap = TRUE
)supplyShape- a sf object containing a list of the locations of supply points, with a column containing supply capacity, for example NHS hospital sites, with a bed
supplyIdVar- the variable name of the identifier of the supplier or group of suppliers. For example this could be an NHS trust (multiple sites)
supplyVar- the column name of the supply parameter. This could be number of beds in a hospital.
supplyOutputVars- the columns from the input that are to be retained in the output
demandShape- the sf object with the geographical map of the demand surface. For example the geographical distribution of the population served,
demandIdVar- the column name of the unique identifier of the areas,
demandVar- the column name of the demand parameter. This could be the population in each region
growthRates- a function to calculate
distanceModifier- distance modifier
tweakNetwork- a named list containing extra linkages beyond those inferred by the demandShape topology. These are used to add in bridges
outputMap- catch
a dataframe containing the grouping columns, the outputIdVar and the interpolated value of interpolateVar
preview()UKGeographyProvider$preview( shape = self$getMap(mapId), mapId = NA, nameVar = "name", codeVar = "code", poi = NULL, poiNameVar = "name", poiCodeVar = "code" )
plot()UKGeographyProvider$plot(shape = self$getMap(mapId), mapId = NA)
clone()The objects of this class are cloneable with this method.
UKGeographyProvider$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.