3

In the newer versions of QGIS it's possible to export a layer as a Mapinfo Tab file and include the Feature Symbology. Does anyone know if you can access this as part of the 'Save Vector Features To File' algorithm or PyQGIS?

symbology export

1 Answer 1

2

Apply the symbologyExport=QgsVectorFileWriter.FeatureSymbology parameter when writing and it will keep its symbology when opened in MapInfo.

from os.path import abspath
from qgis.utils import iface 

_vlayer = iface.activeLayer()

_writer = QgsVectorFileWriter.writeAsVectorFormat(
    layer=_vlayer,
    fileName=abspath("D:/test_file.tab"),
    fileEncoding="utf-8",
    driverName="MapInfo File",
    symbologyExport=QgsVectorFileWriter.FeatureSymbology
    )
3
  • have you checked it with a point layer?
    – KVO
    May 21 at 14:10
  • it doesn't seem to work with points but it does work with polygons. Haven't checked lines yet. That's a pain, as it will read MapInfo point symbology into QGIS
    – Prosper
    May 22 at 7:43
  • I have asked a question about it 2 years ago. It is here: gis.stackexchange.com/questions/388797/…
    – KVO
    May 27 at 12:41

Your Answer

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

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