[gdal-dev] Driver oddity

Ari Jolma ari.jolma at gmail.com
Sat Mar 7 05:09:28 PST 2015


The GDAL and OGR drivers are now basically the same but separate ones in 
Swig bindings, maybe it has something to do with this oddity.

When I open GDAL driver "Memory", it does not advertise capability 
DCAP_RASTER and CreateDataset silently fails.

When I open GDAL driver "MEM", it advertises capability DCAP_RASTER and 
CreateDataset returns a valid object.

When I open MEM driver and then Memory driver, both behave similarly.

Both MEM and Memory are listed as GDAL drivers.

Cheers,

Ari

first run:

perl x.pl Memory
DCAP_CREATE => YES
DCAP_OPEN => YES
DCAP_VECTOR => YES
DMD_CREATIONFIELDDATATYPES => Integer Integer64 Real String Date 
DateTime Time IntegerList Integer64List RealList StringList Binary
DMD_LONGNAME => Memory
OGR_DRIVER => YES


DCAP_CREATE => YES
DCAP_OPEN => YES
DCAP_VECTOR => YES
DMD_CREATIONFIELDDATATYPES => Integer Integer64 Real String Date 
DateTime Time IntegerList Integer64List RealList StringList Binary
DMD_LONGNAME => Memory
OGR_DRIVER => YES

second run:

perl x.pl MEM
DCAP_CREATE => YES
DCAP_OPEN => YES
DCAP_RASTER => YES
DMD_CREATIONDATATYPES => Byte Int16 UInt16 Int32 UInt32 Float32 Float64 
CInt16 CInt32 CFloat32 CFloat64
DMD_CREATIONOPTIONLIST => <CreationOptionList>   <Option 
name='INTERLEAVE' type='string-select' default='BAND'> 
<Value>BAND</Value> <Value>PIXEL</Value> </Option></CreationOptionList>
DMD_LONGNAME => In Memory Raster
Geo::GDAL::Dataset=HASH(0xd020a0)

DCAP_CREATE => YES
DCAP_OPEN => YES
DCAP_RASTER => YES
DMD_CREATIONDATATYPES => Byte Int16 UInt16 Int32 UInt32 Float32 Float64 
CInt16 CInt32 CFloat32 CFloat64
DMD_CREATIONOPTIONLIST => <CreationOptionList>   <Option 
name='INTERLEAVE' type='string-select' default='BAND'> 
<Value>BAND</Value> <Value>PIXEL</Value> </Option></CreationOptionList>
DMD_LONGNAME => In Memory Raster
Geo::GDAL::Dataset=HASH(0xd77df0)

the program:

use Geo::GDAL;

$driver = shift @ARGV;

$d = Geo::GDAL::Driver($driver);
$m = $d->GetMetadata;
for my $k (sort keys %$m) {
     print "$k => $m->{$k}\n";
}
$s = $d->Create();
print $s,"\n";

print "\n";
$d = Geo::GDAL::Driver('Memory');
$m = $d->GetMetadata;
for my $k (sort keys %$m) {
     print "$k => $m->{$k}\n";
}
$s = $d->Create();
print $s,"\n";



More information about the gdal-dev mailing list