You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
n<-1000pts0<- cbind(runif(n, -180, 180), runif(n, -80, 80))
in_crs<-"OGC:CRS84"out_crs<-"EPSG:3857"pts<-reproj::reproj_xy(pts0, out_crs, source=in_crs)
## grid specification (bounds, shape)## we could be tidier about the extent, but I'm not sure how the py was intended to user-input thisex<- c(range(pts[,1]), range(pts[,2]))
dm<- c(200, 200) ## again, could be aspect ratioed of the data but just go for it## the rasterio transform point to grid partcell<-vaster::cell_from_xy(dm, ex, pts)
## we're not sparse nowcnt<-matrix(tabulate(cell, nbins= prod(dm)), dm[2L], byrow=TRUE)
## now we need something to write a tifvapour::vapour_create("file.tif", extent=ex, dimension=dm, projection=out_crs, n_bands=1, overwrite=TRUE)
## I think the current orientation is the write fun might be a mistake ... or at least needs docvapour::vapour_write_raster_block("file.tif", t(cnt), offset= c(0, 0), dimension=dm, band=1, overwrite=TRUE)
## now, get the info and plotinfo<-vapour::vapour_raster_info("file.tif")
dat<-whatarelief::elevation(source="file.tif", extent=info$extent, dimension=info$dimension, projection=info$projection)
ximage::ximage(dat, extent=info$extent, asp=1)
points(pts)
https://gist.github.com/vincentsarago/b00f50f8b66ab5ccbd4449f6a1bd8b71#file-rasterize_point-py-L79
from this tweet (they missed the IDW part, but still very useful code for me) https://twitter.com/_VincentS_/status/1597971755939016710?s=20&t=ZpcAHSd0zMVO8K0iAZjq0Q
The text was updated successfully, but these errors were encountered: