2

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?

2 Answers 2

3

You can use ogr2ogr from GDAL Utilities to batch convert several shape files to mid/mif. If you use OSGeo4W installer you can easy install GDAL Utilities. A simple script for you to convert all shape to mif/mid in the current directory:

@echo off for %%f in (*.shp) do ( set name=%%~nf ogr2ogr -f "MapInfo File" %name% -dsco FORMAT=MIF %%f )

1

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

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.