Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@
^scratch$
^venv$
^build/
COPYRIGHTS
86 changes: 72 additions & 14 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,14 @@ UNDER NO CIRCUMSTANCES SHOULD YOU EVER PUSH TO A REMOTE GIT REPOSITORY
### GDAL Version Conflicts and API Evolution

**GDAL 3.12+ Native Commands:**
- GDAL 3.12.0+ introduced native `gdal pipeline` command
- This conflicts with gdalcli's original `gdal_pipeline()` convenience wrapper function
- **Resolution**: Renamed function to `gdal_compose()`, marked deprecated for 0.5.x removal
- **Rationale**:
- Piping with `|>` is more idiomatic R for composition
- Explicit type specification (`gdal_raster_pipeline()` vs `gdal_vector_pipeline()`) is clearer than type auto-detection
- Function added minimal value over direct function calls
- Users can still pass lists directly: `gdal_raster_pipeline(jobs = list(j1, j2, j3))`

**Deprecated Functions:**
- `gdal_compose()` - Deprecated as of 0.4.x, removal planned for 0.5.x
- Issues warning via `.Deprecated()` on use
- Docs recommend pipe approach instead
- Will remove unless real-world use cases emerge
- GDAL 3.12.0+ introduced native `gdal pipeline` command, available as auto-generated `gdal_pipeline()` function
- Earlier versions of gdalcli had a convenience wrapper `gdal_compose()` (removed in 0.7.0)
- **Recommended approach**: Use pipe operator (`|>`) for composable, idiomatic R pipelines
- **Alternative**: Use explicit type specification with `gdal_raster_pipeline()` or `gdal_vector_pipeline()`

**Deprecated Features (0.7.0+):**
- `gdal_compose()` function - removed (use pipe operator instead)
- Backend `"auto"` mode - specify explicit backend

## CI/CD Workflows

Expand Down Expand Up @@ -246,8 +240,72 @@ auth <- gdal_auth_gcs() # GOOGLE_APPLICATION_CREDENTIALS

# Add to job
job |> gdal_with_env(auth) |> gdal_run()

## GDAL Version Compatibility
GDAL 3.13.0+ introduced parameter naming standardization. Known changes include:
- `dst_crs` → `output_crs` (reproject and related CRS output functions)
- `dataset` → `input` (functions that previously used `dataset` parameter)

GDAL's API continues to evolve; consult GDAL release notes for version-specific parameter changes.

Use `gdal_check_version()` for version-aware code:

```r
# Example: Reproject function (dst_crs → output_crs)
if (gdal_check_version("3.13", op = ">=")) {
job <- gdal_raster_reproject(input = "in.tif", output_crs = "EPSG:4326")
} else {
job <- gdal_raster_reproject(input = "in.tif", dst_crs = "EPSG:4326")
}

# Example: Overview function (dataset → input)
if (gdal_check_version("3.13", op = ">=")) {
job <- gdal_raster_overview_add(input = "in.tif", levels = c(2, 4, 8))
} else {
job <- gdal_raster_overview_add(dataset = "in.tif", levels = c(2, 4, 8))
}
```
```

### Programmatic Command Invocation

`gdal_call()` enables dynamic command invocation by name or function reference, supporting metaprogramming and serialization patterns:

```r
# Dynamic command selection
cmd_name <- paste0("gdal_", input_type, "_", operation)
job <- gdal_call(cmd_name, list(input = "in.tif", output = "out.tif"))

# With modifiers
job <- gdal_call(
"gdal_raster_convert",
list(input = "in.tif", output = "out.tif"),
modifiers = list(
function(x) gdal_with_co(x, "COMPRESS=DEFLATE"),
function(x) gdal_with_config(x, "GDAL_CACHEMAX=512")
)
) |>
gdal_job_run()

# Batch processing
commands <- list(
list("gdal_raster_clip", list(input = "a.tif", output = "a_clipped.tif")),
list("gdal_raster_clip", list(input = "b.tif", output = "b_clipped.tif"))
)
results <- lapply(commands, function(x) {
gdal_call(x[[1]], x[[2]]) |> gdal_job_run()
})

# Discover available commands
all_commands <- gdal_list_callable_commands() # All wrapped commands
raster_only <- gdal_list_callable_commands(type = "raster") # Type filter
cmd_details <- gdal_list_callable_commands(simplify = FALSE) # Include metadata
```

**Key Functions:**
- `gdal_call(what, args = list(), modifiers = NULL)` — Invoke command by name or reference with optional modifiers
- `gdal_list_callable_commands(type = NULL, simplify = TRUE)` — Discover available wrapped GDAL commands; filter by type (raster/vector/vsi/driver/mdim/pipeline)

### Package Options

The package provides an options system via `gdalcli_options()` for controlling default behaviors.
Expand Down
3 changes: 2 additions & 1 deletion .github/versions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"supported": [
"3.11.4",
"3.12.2"
"3.12.2",
"3.13.0"
]
}
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: gdalcli
Title: Frontend for the GDAL (>= 3.11) CLI
Version: 0.6.2
Version: 0.7.0
Authors@R:
person("Andrew", "Brown", role = c("aut", "cre"),
email = "brown.andrewg@gmail.com",
Expand All @@ -19,7 +19,7 @@ Description: An auto-generated R wrapper for the GDAL CLI
to pin a specific version of the GDAL CLI. This package includes auto-generated wrapper
functions and documentation from GDAL (Copyright 1998-2026 Frank Warmerdam, Even Rouault,
and others). See COPYRIGHTS file for details.
License: MIT + file LICENSE + file COPYRIGHTS
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Expand Down
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ export(gdal_auth_gcs)
export(gdal_auth_oss)
export(gdal_auth_s3)
export(gdal_auth_swift)
export(gdal_call)
export(gdal_capabilities)
export(gdal_check_version)
export(gdal_command_help)
export(gdal_compose)
export(gdal_driver_gpkg_repack)
export(gdal_driver_gti_create)
export(gdal_driver_openfilegdb_repack)
Expand All @@ -80,6 +80,7 @@ export(gdal_has_gdalg_driver)
export(gdal_job_get_explicit_args)
export(gdal_job_run)
export(gdal_job_run_with_audit)
export(gdal_list_callable_commands)
export(gdal_list_commands)
export(gdal_load_pipeline)
export(gdal_mdim)
Expand Down Expand Up @@ -173,6 +174,7 @@ export(gdalg_read)
export(gdalg_to_pipeline)
export(gdalg_write)
export(get_jobs)
export(infer_update_intent)
export(is_vsi_path)
export(new_gdal_job)
export(new_gdal_pipeline)
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# gdalcli 0.7.0 (2026-05-09)

- Added update intent feature for pipeline classification. Now code generation auto-detects commands that open files for update (e.g., `gdal_raster_edit`, `gdal_vector_edit`) via `GDAL_INTENT_MAPPINGS.json` with customizable overrides
- Added `gdal_call()` for dynamic/programmatic GDAL command invocation by name or function reference, enabling metaprogramming, serialization, and boilerplate reduction for repetitive command patterns. Includes `gdal_list_callable_commands()` for command discovery with type filtering
- Removed `gdal_compose()` convenience function (deprecated since 0.4.x). Use pipe operator (`|>`) instead: `job1 |> job2 |> job3 |> gdal_job_run()`
- Deprecated backend `"auto"` mode. Specify explicit backend with `options(gdalcli.backend = "processx")` or `"gdalraster"`

# gdalcli 0.6.0 (2026-04-15)

- Authentication methods no longer scan for patterns of related environment variables, only explicitly-set credentials via `gdal_with_env()` are used
Expand Down
Loading