Skip to content

Commit 5f2177c

Browse files
committed
Merge branch 'main' of github.com:r-spatial/sf
2 parents bb4e140 + 340c5c6 commit 5f2177c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/stars.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,11 @@ void CPL_write_gdal(NumericMatrix x, CharacterVector fname, CharacterVector driv
557557
poDriver->GetMetadataItem(GDAL_DCAP_CREATECOPY) != NULL) {
558558
GDALDriver *memDriver = GetGDALDriverManager()->GetDriverByName("MEM");
559559
GDALDataset *memDS;
560-
if ((memDS = memDriver->Create(fname[0], dims[0], dims[1], dims[2], eType,
561-
create_options(options).data())) == NULL)
560+
if ((memDS = memDriver->Create(fname[0], dims[0], dims[1], dims[2], eType, NULL)) == NULL)
562561
stop("cannot create copy in memory"); // #nocov
563-
if ((poDstDS = poDriver->CreateCopy(fname[0], memDS, FALSE, NULL, NULL, NULL)) == NULL) {
562+
options.push_back("APPEND_SUBDATASET=YES");
563+
if ((poDstDS = poDriver->CreateCopy(fname[0], memDS, FALSE,
564+
create_options(options).data(), NULL, NULL)) == NULL) {
564565
GDALClose(memDS);
565566
stop("cannot CreateCopy from memory dataset");
566567
} else

0 commit comments

Comments
 (0)