spCFmap: Interactive mapping for coarse-to-fine spatial modelling

View source: R/spCFmap.R

spCFmapR Documentation

Interactive mapping for coarse-to-fine spatial modelling

Description

Opens a Shiny web app for mapping CFSM results over a basemap. The function has two modes:

Usage

spCFmap(mod = NULL, crs = NULL, launch = TRUE, ...)

Arguments

mod

Optional fitted model returned by cf_lm, cf_glm, cf_dglm or cf_downscale. If omitted, the full data-upload and model-fitting application is launched.

crs

Coordinate reference system of the coordinates that were passed to the model: an EPSG code (e.g. 4326 or "EPSG:4326") or a proj/WKT string, used to place the results on the longitude/latitude basemap. Give 4326 when the model was fitted on raw longitude/latitude, and the code of the projected system (e.g. 28992, 27700, 25832) when it was fitted on projected coordinates; an EPSG code assumes the coordinates are in the unit of that system, so rescaled coordinates (metres divided by 1000, say) need a proj string such as "+proj=utm +zone=32 +datum=WGS84 +units=km". There is deliberately no default: coordinates carry no unit of their own, and guessing would silently place the map in the wrong part of the world, so crs must be supplied whenever mod is given. It is ignored when mod is omitted, since the application asks for the coordinate reference system interactively – there, EPSG:4326 (longitude/latitude) is the default offered for uploaded files, while the bundled demo data sets preselect their own systems.

launch

Logical; if TRUE (default) run the app, otherwise return the Shiny app object without launching.

...

Passed to runApp (e.g. port, host, launch.browser). Unused when launch = FALSE.

Details

spCFmap()

Without mod, the full application is launched: models (cf_lm, cf_glm, cf_dglm, cf_downscale) are fitted inside the app from demo data (meuse, a space-time air-quality set, and an areal downscaling set) or from user CSV / GeoJSON uploads, and predictions can be exported as CSV or GeoJSON.

spCFmap(mod, crs)

With a fitted model, a small app maps that model directly. The layer (predictive mean / SD, covariate effect, or a scale-wise spatial component), colour scaling, and - for space-time or downscaling fits - the time range or bandwidth range are chosen interactively.

Value

If launch = TRUE, the value returned by runApp (invisibly); otherwise a shiny.appobj.

See Also

cf_lm, cf_glm, cf_dglm, cf_downscale, sp_scalewise

Examples

## Not run: 
spCFmap()                       # full app, opens in the browser
spCFmap(launch.browser = FALSE) # print the local URL instead

m <- cf_lm(y = y, x = x, x0 = x0, coords = coords, coords0 = coords0,
           mod_hv = cf_lm_hv(y = y, x = x, coords = coords))
spCFmap(m, crs = 28992)         # map an already-fitted model

## End(Not run)


spCF documentation built on Oct. 5, 2026, 5:07 p.m.