I am working on a project where I map conflict data (csv format, geometry type = points) on polygons (kml files). Both layers are data.frames and share the same CRS (+proj=longlat +datum=WGS84 +no_defs).
The mapping seems to work (see code) however, I receive the following warning message:
"although coordinates are longitude/latitude, st_intersects assumes that they are planar"
I assume this warning appears because the CRS of the two layers is unprojected. Could that be the case and if yes, how can I project it?
Please find attached a screenshot of my workspace and I am sharing the three files (csv, kml and script) here: https://www.dropbox.com/sh/eisoxjbyojevlzs/AABW6A0GjELt1pOJXb-Ajhb1a?dl=0
Here is the script that I used:
library(dplyr) library(sf) library(lwgeom) library(tmap) library(raster) library(pryr) # load KML files (project polygons) project1233 <- st_read("KML_1233.kml") # Read CSV file (conflict data, points) conflictData <- read.csv("GED_20200103_copy2.csv") # Convert the CSV data frame to an sf object conflictData_sf <- st_as_sf(conflictData, coords = c("longitude", "latitude"), crs = 4326) # Map conflict data with project data conflictMap <- st_join(conflictData_sf, project1233) # Plot the data plot(st_geometry(project1233)) plot(conflictData_sf, add = TRUE, pch = 16, col = "red")
Thanks for your help,