Skip to contents

Write a spatial file with gdal

Usage

write_geo(
  dataset,
  path,
  conn = cached_connection(),
  driver = "GeoJSON",
  layer_creation_options = "WRITE_BBOX=YES"
)

Arguments

dataset

a remote tbl object from open_dataset, or an in-memory data.frame.

path

a local file path or S3 path with write credentials

conn

duckdbfs database connection

driver

driver, see https://duckdb.org/docs/stable/extensions/spatial/gdal

layer_creation_options

to GDAL, see https://duckdb.org/docs/stable/extensions/spatial/gdal

Details

NOTE: at this time, duckdb's pre-packaged GDAL does not support s3 writes, and will produce a "Error: Not implemented Error: GDAL Error (6): Seek not supported on writable /vsis3/ files". Use to_geojson() instead.

Examples

if (FALSE) { # interactive()
local_file <-  system.file("extdata/spatial-test.csv", package="duckdbfs")
load_spatial()
tbl <- open_dataset(local_file, format='csv')
write_geo(tbl, "spatial.geojson")
}