Learn R Programming

EmissV (version 0.665.3.0)

lineSource: Distribution of emissions by lines

Description

Create a emission distribution from 'sp' or 'sf' spatial lines data.frame or spatial lines.

There 3 modes available to create the emission grid: - using gridInfo function output (defoult) - using the patch to "wrfinput" (output from real.exe) file or "geo" for (output from geog.exe) - "sf" (and "sp") uses a grid in SpatialPolygons format

The variable is the column of the data.frame with contains the variable to be used as emissions, by defoult the idstribution taken into acount the lench distribution of lines into each grid cell and the output is normalized.

Usage

lineSource(
  s,
  grid,
  as_raster = F,
  verbose = T,
  type = "info",
  gcol = 100,
  grow = 100,
  variable = "length"
)

Arguments

s

SpatialLinesDataFrame of SpatialLines object

grid

grid object with the grid information or filename

as_raster

output format, TRUE for raster, FALSE for matrix

verbose

display additional information

type

"info" (default), "wrfinput", "geo", "sp" or "sf" for grid type

gcol

grid points for a "sp" or "sf" type

grow

grid points for a "sp" or "sf" type

variable

variable to use, default is line length

See Also

gridInfo and rasterSource

Examples

Run this code
# NOT RUN {
roads <- osmar::get_osm(osmar::complete_file(),
                        source = osmar::osmsource_file(paste(system.file("extdata",
                        package="EmissV"),"/streets.osm.xz",sep="")))
road_lines <- osmar::as_sp(roads,what = "lines")
roads <- sf::st_as_sf(road_lines)

d3    <- gridInfo(paste0(system.file("extdata", package = "EmissV"),"/wrfinput_d03"))

roadLength <- lineSource(roads,d3,as_raster=TRUE)
sp::spplot(roadLength, scales = list(draw=TRUE), ylab="Lat", xlab="Lon",main="Length of roads",
           sp.layout=list("sp.lines", road_lines))
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab