Skip to content

Commit 32fc0cc

Browse files
authored
Merge pull request OSGeo#11968 from ctoney/mem_creation_opt
MEM: set IMAGE_STRUCTURE metadata for INTERLEAVE=BAND and document the creation option
2 parents feef15d + 1a067ba commit 32fc0cc

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

autotest/gdrivers/mem.py

+4
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ def test_mem_4():
250250
cs == expected_cs[i]
251251
), "did not get expected checksum for band %d after fill" % (i + 1)
252252

253+
assert (
254+
ds.GetMetadataItem("INTERLEAVE", "IMAGE_STRUCTURE") == "BAND"
255+
), "did not get expected INTERLEAVE value"
256+
253257
ds = None
254258

255259

autotest/utilities/test_gdalalg_raster_info.py

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def test_gdalalg_raster_info_mdd_all():
113113
j = json.loads(output_string)
114114
assert j["metadata"] == {
115115
"": {"AREA_OR_POINT": "Area"},
116+
"IMAGE_STRUCTURE": {"INTERLEAVE": "BAND"},
116117
"MY_DOMAIN": {"foo": "bar"},
117118
"DERIVED_SUBDATASETS": {
118119
"DERIVED_SUBDATASET_1_NAME": "DERIVED_SUBDATASET:LOGAMPLITUDE:",

doc/source/drivers/raster/mem.rst

+8-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,14 @@ or
9090
Creation Options
9191
----------------
9292

93-
There are no supported creation options.
93+
|about-creation-options|
94+
This driver supports the following creation option:
95+
96+
- .. co:: INTERLEAVE
97+
:choices: BAND, PIXEL
98+
:default: BAND
99+
100+
Set the interleaving to use
94101

95102
The MEM format is one of the few that supports the AddBand() method. The
96103
AddBand() method supports DATAPOINTER, PIXELOFFSET and LINEOFFSET

frmts/mem/memdataset.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,8 @@ MEMDataset *MEMDataset::Create(const char * /* pszFilename */, int nXSize,
14041404

14051405
if (bPixelInterleaved)
14061406
poDS->SetMetadataItem("INTERLEAVE", "PIXEL", "IMAGE_STRUCTURE");
1407+
else
1408+
poDS->SetMetadataItem("INTERLEAVE", "BAND", "IMAGE_STRUCTURE");
14071409

14081410
/* -------------------------------------------------------------------- */
14091411
/* Create band information objects. */

0 commit comments

Comments
 (0)