[gdal-dev] Creating modified copies of a file

Even Rouault even.rouault at mines-paris.org
Wed Jul 6 13:20:16 EDT 2011


Le mercredi 06 juillet 2011 18:50:56, Cole, Derek a écrit :
> Sorry to follow up so soon. I also tried what is  int he API, using the
> following:
> 
>     char **papszOptions = NULL;
> 
>     papszOptions = CSLSetNameValue( papszOptions, "BLOCKXSIZE", "1024" );
>     papszOptions = CSLSetNameValue( papszOptions, "BLOCKYSIZE", "1024" );
> 
> 
>        poVRTDS = poVRTDriver->CreateCopy( "", poDataset, FALSE, 
> papszOptions, MyTextProgress, message);

Yes that's better. The option array need to be NULL terminated, what 
CSLSetNameValue() does (otherwise you could get nasty crashes). However, the 
BLOCKXSIZE and BLOCKYSIZE options are options of the NITF driver, not the VRT 
driver. Not sure why you are using VRT, I thought you wanted NITF, but I 
haven't followed closely the whole thread

> 
> It seems to have no affect. Is it being passed properly?
> 
> Derek
> ________________________________________
> From: gdal-dev-bounces at lists.osgeo.org [gdal-dev-bounces at lists.osgeo.org]
> on behalf of Cole, Derek [dcole at integrity-apps.com] Sent: Wednesday, July
> 06, 2011 12:39 PM
> To: Even Rouault; gdal-dev at lists.osgeo.org
> Subject: RE: [gdal-dev] Creating modified copies of a file
> 
> What is the proper way to set those creation options?
> 
> I have tried the following:
> 
>        char* papszOptions[] = { "BLOCKXSIZE=1024", "BLOCKYSIZE=1024" };
>        poVRTDS = poVRTDriver->CreateCopy( "", poDataset, FALSE, 
> papszOptions, MyTextProgress, message); poBand =
> poVRTDS->GetRasterBand(1);
>        CPLAssert( poBand->GetRasterDataType() == GDT_Byte );
>        poBand->GetBlockSize( &nXBlockSize, &nYBlockSize );
> 
> the block size variables are both still set to 128 instead of 1024, which
> is the block size of my input file.
> 
> 
> Thanks
> 
> Derek
> 
> 
> ________________________________________
> From: Even Rouault [even.rouault at mines-paris.org]
> Sent: Tuesday, July 05, 2011 6:38 PM
> To: gdal-dev at lists.osgeo.org
> Cc: Cole, Derek
> Subject: Re: [gdal-dev] Creating modified copies of a file
> 
> Le mercredi 06 juillet 2011 00:26:06, Cole, Derek a écrit :
> > Just as an interesting side-note: I tried to do a CreateCopy on one of
> > these files that was 7GB. Using CreateCopy() it took almost 2 hours. When
> > I simply copied to file contents using a cp command (this is CentOS), the
> > copy takes about a minute. I am not sure why that is so terribly slow in
> > GDAL.
> 
> This is very well possible if the block dimensions of the source and target
> are not compatible. You might want to play with the BLOCKXSIZE and
> BLOCKYSIZE creation options.
> 
> Anyway, you cannot simply compare cp and CreateCopy(). CreateCopy() can do
> much smarter things than just cp...
> 
> > Also, I experimented trying to insert a band into an already existing
> > NITF file, but the software spits back an error message that the format
> > does not support it.
> 
> Yes very few formats can support AddBand().
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list