Skip to content

Produce smaller dbf files by auto detecting field size

Closed
No due date
Closed Jun 20, 2026

Currently, all shapefiles are produced with lengthy field length defaults, which for very large files can lead to unneccessarily large dbf files.

20/06 / 2026. This would be a great feature to have, but .dbf is a fixed width record format. We can overwrite the field array descriptors easily (we write the .dbf header twice already). But should a field width be changed, all the records already written at a previous width, will need to be rewritten at a new width. So the whole approach would need to be changed from incremental writes to disk to atomic writes (copying the entire file after every new record is added), or storing all the records in memory adn only writing them to disk when .close is called (e.g when Writer as a context manager is exited). James.

50% complete

List view