Saturday, 19 December 2015

convert - Opening layers with multiple geometry types in QGIS


I recently had some difficulties opening some MapInfo TAB vector layers in QGIS because each MapInfo layer contained two different geometry types: point and line. The MapInfo layers had originally been converted from AutoCAD DWGs. When opening in QGIS, only the point features appeared and not the linear features.



Is there a way for QGIS to open both geometries of a mixed-geometry layer or to convert or save them into two separate-geometry layers?


Failing either of those, is there a way to specify which geometry type should be opened (in my case, I was interested in the lines and not the points)?



Answer



You can split the file into the different types using OGR2OGR:


ogr2ogr -f "MapInfo File" -where "OGR_GEOMETRY = 'Point'" yourfile_Point.Tab yourmultigeomfile.TAB

ogr2ogr -f "MapInfo File" -where "OGR_GEOMETRY = 'LineString'" yourfile_lines.Tab yourmultigeomfile.TAB

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...