lineSource: Distribution of emissions by lines

Description Usage Arguments Source See Also Examples

View source: R/lineSource.R

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

1
2
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

gridInfo and rasterSource

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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))

EmissV documentation built on May 2, 2019, 7:16 a.m.