Learn R Programming

osmplotr (version 0.2.0)

list2df_with_data: list2df_with_data

Description

Converts a list of spatial objects to a single data frame, and adds a corresponding 'z' column provided by mapping mean object coordinates onto a spatially interpolated version of 'dat'

Usage

list2df_with_data(map, xy, dat, bg, grid_size = 100, method = "idw")

Arguments

map
A ggplot2 object (used only to obtain plot limits)
xy
List of coordinates of spatial objects
dat
A data surface (which may be irregular) used to provide the z-values for the resultant data frame.
bg
background colour from 'add_osm_surface()', passed here only to confirm whether it is given or missing
grid_size
Size of interpolation grid as taken from 'add_osm_surface()'
method
Either 'idw' (Inverse Distance Weighting as spatstat::idw; default), otherwise uses 'Gaussian' for kernel smoothing (as spatstat::Smooth.ppp)

Value

  • A single data frame of object IDs, coordinates, and z-values