Given a data frame of coordinates:
points <- data.frame(x=runif(50), y=runif(50))
and a raster:
rast <- raster(xmn=0, xmx=1, ymn=0, ymx=1, res=0.05)
you can use cellFromXY to find the grid cell associated with each point, and thus the number of unique grid cells.
I had the same question and looked everywhere! Finally a solution - you need to use "TIN interpolation". This video explains it perfectly: https://www.youtube.com/watch?v=PhJ77uHlTJA
It demonstrates other processes as well but the main thing is they used contour line data and created a DEM. Really good explanation as well.
Key tools used:
I'm not familiar with this QGIS plugin, but in Earth Engine, in order to use a feature collection you must either
upload it to become an Earth Engine asset, or
if it is very small, you could write it out in code (i.e. take your QGIS data and turn it into ee.Features using Python code that iterates over the collection in QGIS). The disadvantage of this ...
You can use SQL to generate what you want without any processing
Go to https://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-0-countries/ take the ne_10m_admin_0_countries.shp and create a virtual layer using the following
WHEN "REGION_UN" = 'Asia' THEN St_Area(geometry)
END AS asia,
The approach that worked for me was very straightforward once I figured it out. There may be a better or different approach, but I'll share the solution I came up with in case it is helpful.
(1) Use the rasterize function in package raster to convert the points to pixels that match the resolution of the original raster. If only presence/absence is ...