My goal is to sample some coordinates that ly exactly in the center of a Landsat pixel. For this sampling, i use the clHs Unfortunately, my exported .gpx coordinates are not located in pixel-center, fortunately, they are in the right location. It is not necessary sind clHs computed indexes , with whom one my select the specified sampling site from the Original SpatialPointDataFrame(spdf)
library(rgdal) library(raster) library(clhs) library(maptools) x<-c(1540560,1540020,1540920,1543530) y<-c(4153320,4164360,4157880,4161810) coords = cbind(x, y) sp = SpatialPoints(coords) data <- data.frame(name=c("w24","W1","W2","W3")) spdf = SpatialPointsDataFrame(coords, data) proj4string(spdf)<-CRS("+init=epsg:32628") transformed <- spTransform(spdf, CRS("+init=epsg:4326")) td <- file.path(getwd(), "Points.gpx") writeOGR(obj=transformed,layer ='name' , dsn=td, driver='GPX',dataset_options = "GPX_USE_EXTENSIONS=yes")
I Copied the Results into GoogleEarthEngine and made a Visualisation.