futility

The goal of futility is just a friendly wrapper around GDAL’s utility libraries.

Examples include gdal_grid

Installation

You can install the development version of futility from GitHub with:

# install.packages("devtools")
# devtools::install_github("hypertidy/futility")
install.packages("futility", repos = c('https://hypertidy.r-universe.dev', 'https://cloud.r-project.org'))

Example

This is a basic example, compare to the triangulation interpolation in the geometry package.

library(futility)
library(guerrilla)
xyz <- quakes[c("long", "lat", "depth")]
x1 <- tri_fun(xyz[,1:2], xyz[,3, drop = TRUE], 
              grid = raster::raster(raster::extent(range(xyz[,1]), range(xyz[,2])), res = .1))
library(raster)
#> Loading required package: sp
plot(x1)         
x0 <- gdal_grid(xyz, dimension = dim(x1)[2:1], extent = c(range(xyz[,1]), range(xyz[,2])))
#> [1] "/tmp/Rtmp2UK5Pw/file9972323c578f6.vrt"
#> Warning in CPL_gdalgrid(source, destination, options, oo, quiet): GDAL Message 1: Cannot open   <OGRVRTDataSource>
#>     <OGRVRTLayer name="znachluwpx997234651c0f8">
#>         <SrcLayer>znachluwpx997234651c0f8</SrcLayer>
#>         <SrcDataSource>/tmp/Rtmp2UK5Pw/znachluwpx997234651c0f8.csv</SrcDataSource>
#>         <GeometryType>wkbPoint</GeometryType>
#>         <LayerSRS>WGS84</LayerSRS>
#>         <GeometryField separator="," encoding="PointFromColumns" x="x" y="y" z="z"/>
#>     </OGRVRTLayer>
#> </OGRVRTDataSource>
ximage::ximage(x0, asp = 1)

I originally t wrote this as a way to check the timings, of the disussion in this issue ‘Extreme performance regression in gdal_grid with method linear’. Looks like there’s a problem with results outside the convex hull ….

Code of Conduct

Please note that the futility project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.