lineSource | R Documentation |
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 = FALSE,
type = "info",
gcol = 100,
grow = 100,
variable = "length",
verbose = TRUE
)
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 |
a raster object containing the spatial distribution of emissions
OpenstreetMap data avaliable https://www.openstreetmap.org/ and https://download.geofabrik.de/
gridInfo
and rasterSource
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.