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.

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

Source

OpenstreetMap data avaliable https://www.openstreetmap.org/ and https://download.geofabrik.de/

See also

Examples

roads <- osmar::get_osm(osmar::complete_file(), source = osmar::osmsource_file(paste(system.file("extdata", package="EmissV"),"/streets.osm.xz",sep="")))
#> Warning: number of columns of result is not a multiple of vector length (arg 1)
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"))
#> Grid information from: C:/Users/Schuch/Documents/EmissV/inst/extdata/wrfinput_d03
roadLength <- lineSource(roads,d3,as_raster=TRUE)
#> using length as emission variable #> Number of lat points 51 #> Number of lon points 51
#> Linking to GEOS 3.6.1, GDAL 2.2.3, PROJ 4.9.3
#> although coordinates are longitude/latitude, st_intersection assumes that they are planar
sp::spplot(roadLength, scales = list(draw=TRUE), ylab="Lat", xlab="Lon",main="Length of roads", sp.layout=list("sp.lines", road_lines))