Opened 12 years ago

Closed 12 years ago

#4580 closed enhancement (wontfix)

A new Delete method for the GDALDriver class.

Reported by: antialize Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords:
Cc:

Description

We have a program where we sometimes want to abort a computation (if something went wrong or what not). If you have a GDALDataset it would seem natural to "delete" it on abortion and then ask the GDALDriver to delete the file. However for large datasets the "delete" operation can take up to several hours since it will mindlessly fill the remainder of the dataset with nodata.

I propose to add a new Delete method on the GDALDriver class, that would take a GDALDataset as an agrument. Which would close the dataset immediately without writing anything to disk, and then delete the files.

If there is support for this feature, I am willing to supply a patch.

Change History (4)

comment:1 by Even Rouault, 12 years ago

Are you talking about geotiff ? If so, you can create them with the SPARSE_OK=TRUE creation option that will avoid filling the blocks with nodata.

comment:2 by antialize, 12 years ago

We are talking about more or lessly all formats, that sparse flag does indeed work for geotiff, but there does not seem to be a simular argument for e.g img. What we are looking for is a general way to get rid of an unwanted GDALDataset as fast as possible.

comment:3 by Even Rouault, 12 years ago

It would help to have a more broader view of which formats really cause problems to determine if a general solution is really needed, or if only a few drivers would need to be improved. For example, does the problem really occur with IMG ? (my quick scanning of the code does not point to an obvious place where the raster will be fully initialized at dataset closing, but I might be wrong)

comment:4 by antialize, 12 years ago

Resolution: wontfix
Status: newclosed

After further testing it appears that the IMG driver or any of the other tested drivers (bil, mpr and bt) are not affected, so the SPARCE_OK flag seems sufficient for our case.

Note: See TracTickets for help on using tickets.