4

I try to convert a mapinfo tab-file containing textobjects wich are positioned and rotated in mapinfo into a shapefile or something similar without loosing all information. All information is located in the mapfile and the attribute table is empty. Just opening the tab-file in Qgis gives a point with an id containing NULL - the text-value lies inside the geometry and the same happens when trying to open the file as an exported mid/mif(thought the point geometry is not really the same).

When opening the mif-file in a texteditor it looks like

"label"
x1 y1 x2 y2
Font (font and color info)
Angle 0.8
Justify Center

where the x1y1 and x2y2 is the bbox (bottom left and top right points) of the text, angle is the bbox rotation and the text itself is contained inside the "label".

Can I somehow create a polygon from the bbox values and the angle and attach the label and the angle as attributes somehow?

1
  • If you are able to use MapInfo Universal Translator, you can translate your layers to DWG. Then you should import this DWG in QGIS. In the finish you will get your text in .gpkg format retaining symbology of text objects (including the colour, orientation and size of font). This approach is good enough.
    – KVO
    Sep 23, 2021 at 4:50

2 Answers 2

4

You can add two new columns to your table using Table > Maintenance > Table Structure: TEXT Char(100) and ANGLE Float

Then use Table > Update Column to read certain values from the spatial object into these columns. Angle: Use this expression: ObjectGeography(OBJ, 7) Text: Use this expression: ObjectInfo(OBJ, 3)

To change your text object into an MBR you can run this statement from the MapBasic window (Options > Show MapBasic Window): Update MYTABLE Set OBJ = MBR(OBJ)

Do remember to create a copy of your table before overwriting your text object with the MBR

2

QGIS doesn't label with bounding boxes. It needs one point to position the label. Therefore, you could calculate the mean between the two points.

For the angle: Does Mapinfo use radians or degrees for rotation? (It's not clear from the example at least.) If the value is in radians, you'll have to convert it to degrees.

Set the positioning to "on point". That should give quite similar results to what was originally shown in Mapinfo.

1
  • MapInfo Pro uses an math angle where 0 is to the east and then it grows counter-clockwise Nov 15, 2023 at 13:23

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.