/gdalg

Wrapper for GDAL Streamed Algorithm

Primary LanguageR

gdalg

The goal of gdalg is to construct GDAL Streaming Algorithm pipelines.

WARNING

This is very under-development.

Installation

You can install the development version of gdalg like so:

devtools::install_github("mdsumner/gdalg")

Example

This is a basic example which shows a pipeline to read, filter, reproject a shapefile from a zip url.

library(gdalg)
devtools::load_all()  ## very in-dev
#> ℹ Loading gdalg
dsn <- "/vsizip//vsicurl/https://github.com/wmgeolab/geoBoundaries/raw/main/releaseData/CGAZ/geoBoundariesCGAZ_ADM0.zip"
src <- read(dsn) |> filter(options = c("--where", "\"shapeGroup IN ('NZL', 'AUS')\"" )) |> reproject(options = c("--dst-crs", "EPSG:3577"))

(v <- new(gdalraster::GDALVector, src))
#> C++ object of class GDALVector
#>  Driver : GDAL Streamed Algorithm driver (GDALG)
#>  DSN    : {"type":"gdal_streamed_alg","command_line":"gdal vector pipeline ! read /vsizip//vsicurl/https://github.com/wmgeolab/geoBoundaries/raw/main/releaseData/CGAZ/geoBoundariesCGAZ_ADM0.zip  ! filter --where \"shapeGroup IN ('NZL', 'AUS')\" ! reproject --dst-crs EPSG:3577"}
#>  Layer  : geoBoundariesCGAZ_ADM0
#>  CRS    : GDA94 / Australian Albers (EPSG:3577)
#>  Geom   : POLYGON
gdalraster::plot.OGRFeatureSet(v$fetch(-1), col = scales::alpha(c("firebrick", "dodgerblue"), .5))

## Code of Conduct

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