Hi everyone,
I would like to listen to your advice on how to clip raster files using GIS boundary files in R. Any comments are welcome!
Thank you,
EJA
Hi everyone,
I would like to listen to your advice on how to clip raster files using GIS boundary files in R. Any comments are welcome!
Thank you,
EJA
Hi there,
I think I got it by using the -terra- and -sf- libraries, and a combination of the basics that are explained here, Clip raster to polygons in sf collection [R sf] - Stack Overflow
I’m glad to hear that you were able to figure it out. Thank you for sharing this solution with the community!
Thank you, Ivan.
I’m new to this type of operations in R, so I bumped into issues here and there. For example, I’m trying to create admin-0 boundaries from the first-level geography boundary files, but in some cases I get an error message saying that an edge X has duplicate vertex with edge Y… I’m trying to figure this out.
While the user support team is unable to provide analytical advice, this does sound like something st_make_valid() may be able to correct by making geometries conform to certain requirements (e.g. no duplicate vertices). I recommend reviewing the documentation to make sure st_make_valid() will do the adjustments that you intend. You may also be interested in using the IPUMS International world map shapefile that nests first and second-level administrative units.
Thank you, Ivan! Implementing st_is_valid() and st_make_valid() is working to solve the issue.
I’ll try to make a short example on how to clip rasters using IPUMS boundaries in a separate post.