Click here to Skip to main content
15,883,847 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Dear all,

Do you know any effective way to convert a directory with several *.mif files to shapefiles? Please note that my files are in *. mif format not mapinfo tab one. A solution to convert all to mapinfo tab then to shapefile is also acceptable.
thanks in advance

Eh237
Posted
Comments
Sergey Alexandrovich Kryukov 14-Mar-13 13:22pm    
Batch?! Well, do you have the code to convert just one? Do you understand that a directory is not a problem at all, no matter how you do it?
—SA
Member 9910835 14-Mar-13 13:41pm    
you may not know there are lots of software converting one easily.for your information QGIS is one of them.
Sergey Alexandrovich Kryukov 14-Mar-13 19:40pm    
What's the problem, then? Do you have at least one working in console?
—SA

You may wish to refer to this thread where someone has done this: http://social.msdn.microsoft.com/Forums/en-US/sqlspatial/thread/0cc4b50e-7dcd-4bbf-982f-3e9346b3dcab[^]
 
Share this answer
 
Comments
Member 9910835 14-Mar-13 14:04pm    
Thanks Marcus. The problem is that I do not have mapinfo software installed on my pc.
For convert only:
for %%i in (.\mid\*.mif) do (
for %%n in (POINT LINESTRING POLYGON MULTIPOLYGON MULTIPOINT MULTILINESTRING) do (
"ogr2ogr" -skipfailures .\shp\%%~ni_%%n.shp %%i -nlt "%%n" -where "OGR_GEOMETRY='%%n'"
)
)

And for add geometry to one shapefile by geometry type:
for %%g in (POINT LINESTRING POLYGON MULTIPOLYGON MULTIPOINT MULTILINESTRING) do (
for %%s in (.\shp\*%%g.shp) do (
if not  EXIST .\all_shp\all_%%g.shp (
"ogr2ogr" -skipfailures .\all_shp\all_%%g.shp %%s
) else (
"ogr2ogr" -skipfailures -update -append .\all_shp\all_%%g.shp %%s -nln all_%%g
)
)
)

.\mid\ - mif file folder, .\shp\ - converted shapefile folder, .\all_shp\ result folder
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900