`emis_grid.Rd`

`emis_grid`

allocates emissions proportionally to each grid
cell. The process is performed by intersection between geometries and the grid.
It means that requires "sr" according with your location for the projection.
It is assumed that spobj is a Spatial*DataFrame or an "sf" with the pollutants
in data. This function returns an object of class "sf".

emis_grid(spobj = net, g, sr, type = "lines", FN = "sum")

spobj | A spatial dataframe of class "sp" or "sf". When class is "sp" it is transformed to "sf". |
---|---|

g | A grid with class "SpatialPolygonsDataFrame" or "sf". |

sr | Spatial reference e.g: 31983. It is required if spobj and g are not projected. Please, see http://spatialreference.org/. |

type | type of geometry: "lines" or "points". |

FN | Character indicating the function. Default is "sum" |

When spobj is a 'Spatial' object (class of sp), they are converted into 'sf'. Also, The aggregation of data is done with data.table functions.

{ data(net) g <- make_grid(net, 1/102.47/2) #500m in degrees names(net) netsf <- sf::st_as_sf(net) netg <- emis_grid(spobj = netsf[, c("ldv", "hdv")], g = g, sr= 31983) round(sum(netg$ldv)) == round(as.numeric(sum(net$ldv))) round(sum(netg$hdv)) == round(as.numeric(sum(net$hdv))) plot(netg["ldv"], axes = TRUE) plot(netg["hdv"], axes = TRUE) netg <- emis_grid(spobj = netsf[, c("ldv", "hdv")], g = g, sr= 31983, FN = "mean") plot(netg["ldv"], axes = TRUE) plot(netg["hdv"], axes = TRUE) }#> Number of lon points: 23 #> Number of lat points: 19 #>#>#> Sum of street emissions 2095073 #> Sum of gridded emissions 2095073#>#> Sum of street emissions 2095073 #> Sum of gridded emissions 2095073