Friday 5 July 2019

qgis - Convert SHP to MIF/MID


I am new to GIS and QGIS software.


is there a batch convert function to convert shape files to mif/mid files?


I can do this individually but is time consuming? I have seen similar functions on here to other formats but i cannot convert them for my needs. ie create both mif + mid files.


Is there a plugin?


I use windows 8. My output folder is C:\Data\Submit


I am looking for something simple like this; Exporting several files at same time in QGIS?




Answer



For a single layer, the recipe to export with Python to MIF/MID is the following (deduced from "Dataset Creation Options" of GDAL MapInfo documentation) :


vLayer = iface.activeLayer()
QgsVectorFileWriter.writeAsVectorFormat(vLayer,
'/tmp/' + vLayer.name() + ".mif", "utf-8",
vLayer.crs(), 'Mapinfo File', datasourceOptions='FORMAT=MIF')

You can now combine this with step 5 from your link Export several files at the same time in QGIS


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...