3

I am used to working with MapInfo when using TAB files, however am in the process of learning how to use QGIS instead. One snag I have hit is that when rows in a table are deleted, the empty rows still exist within the table (as can be seen easily by opening the TAB in MapInfo). You cannot see the empty rows in QGIS but they are there.

Usually, in MapInfo, one would simply go to Table > Maintenance > Pack Table...

My question is: can you pack a table in QGIS?

I am using QGIS Desktop 3.10.13

[I have found that saving the file as a new file gets rid of the empty/deleted rows, but this is not practical]

2
  • 4
    Switch to a modern storage format like GeoPackage?
    – Ian Turton
    May 19, 2021 at 15:26
  • I also recommend to use GeoPackage and save a copy into MapInfo format if needed. What happens is probably that QGIS/GDAL does not physically remove rows from the .DAT file but marks them as deleted because that is fast. The .DAT file is a dBaseIII file wiki.gis.com/wiki/index.php/MapInfo_TAB_format and the use of "deleted" tag is correct for dBase.
    – user30184
    May 19, 2021 at 16:59

1 Answer 1

4

MapInfo TAB is a legacy format. If possible, I would advise you to switch to a different format. Even if it is shapefile.

To put simply, QGIS does not have a quick way to pack the tables like MapInfo does. However, QGIS can write to a new .TAB file quite readily. This new .tab file will have no empty rows, hence will be packed. Then it is simply a matter of removing the old files.

If switching to a new format doesnt suit you, I would suggest one of two solutions.

  1. writing a simple pyqgis script which will save the layer as .tab with the same name and delete the old file.

  2. Use the "Batch Vector Layer Saver" plugin if you have lots of MapInfo files and you can save them all at once as new packed files. The plugin can be tricky with multiple geometries in the same layer. So use with caution.

  3. Use MapInfo to pack the tables. You can write scripts in MapInfo to quickly pack the tables too. I dont recommend this because it involves using MapInfo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.