lineSource: Distribution of emissions by lines

View source: R/lineSource.R

lineSourceR Documentation

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 = FALSE,
  type = "info",
  gcol = 100,
  grow = 100,
  variable = "length",
  verbose = TRUE
)

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

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

verbose

display additional information

Value

a raster object containing the spatial distribution of emissions

Source

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

See Also

gridInfo and rasterSource

Examples


# loading a shapefile with osm data for sao paulo metropolitan area
roads <- sf::st_read(paste0(system.file("extdata",package="EmissV"),"/streets.shp"))
d3    <- gridInfo(paste0(system.file("extdata", package = "EmissV"),"/wrfinput_d03"))

# calculating only for 2 streets
roadLength <- lineSource(roads[1:2,],d3,as_raster=TRUE)

# to generate a quick plot
raster::plot(roadLength,ylab="Lat", xlab="Lon",main="Length of roads")
# lines(road_lines)




Schuch666/EmissV documentation built on July 19, 2023, 10:36 a.m.