get_intersection_fractions | R Documentation |
Intersect two shape files/spatial files, return proportions used to downscale or aggregate data based on calculated areas. The function will return a sf data frame with additional columns including the areas for the spatial boundaries and the intersection. Two ratios are returned which can be used to downscale data or aggregate data as required.
get_intersection_fractions(
shpfile_1 = "temporary_output/tl_2019_us_state.shp",
shpfile_2 = "temporary_output/glu_boundaries_moirai_combined_3p1_0p5arcmin.shp",
area_field_1 = "state_area",
area_field_2 = "basin_area",
default_crs = 4326,
out_csv = NULL,
out_shape_file = "gcamusa_state_glu_intersections.shp",
shape_file_cols = c("glu_id", "NAME", "GEOID"),
write_other_files = FALSE
)
shpfile_1 |
character. A full path with file name and extension to the input polygon shapefile |
shpfile_2 |
character. A full path with file name and extension to the input polygon shapefile |
area_field_1 |
character.Name of column with area calculated for shapefile 1 |
area_field_2 |
character.Name of column with area calculated for shapefile 2 |
out_csv |
character. A full path with file name and extension for the output CSV file |
shape_file_cols |
vector. The names to be selected when returning the shape file. |
to_crs |
int. The EPSG number of a projected coordinate reference system. Must be projected and not geographic due to assumptions that sf::st_intersection makes when using geographic systems. Default is EPSG:4326, WGS 84 |
shape_file |
character. The name of the shapefile to be returned |
data.frame
Kanishka Narayan (kanishka.narayan@pnnl.gov)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.