I'm currently working with a shapefile that does not contain explicit latitude and longitude coordinates. My goal is to filter out areas with latitudes above 60 degrees. I want to delete the small area in the lower right corner, but I don't have the latitude and longitude. Can anyone suggest a code to achieve this?
The shapefile look like this:
This is my current code:
shapefile_path <- "/Users/langbai/Desktop/lcsd000b16a_e/lcsd000b16a_e.shp"
shapefile_data <- st_read(shapefile_path)
convex_hulls_inset <- convex_hulls_with_farms %>%
filter(lat < 60)
shapefile_inset <- shapefile_data %>%
filter(st_coordinates(st_centroid(geometry))[, 2] < 80)
\<-
? you can always split thegeometry
column usingst_coordinates()
. this allows you to filter for any lon/lat you want. though you may want to be careful when using this on line/polygon geometries.