1

I`m trying to Add Vector Layer-> Open Mapinfo File enter image description here

It's ok with map because it opened perfectly in Mapinfo application. What is the problem and how to fix it? I need georeferenced raster in qgis.

  • MapInfo is storing the metadata of the raster image into .tab file which is in that usage a small text file. For adding rasters into QGIS you must add a raster file, not vector as in your screenshot. Also, select .png file when you add image to QGIS, not tab as you are used to do with MapInfo. I am not sure if QGIS can read the metadata from .tab but try and see. – user30184 Feb 9 '16 at 12:43
  • Thanks a lot! It now open png but they are not georeferenced, i.e. all of my rasters lay in unpropriate place one on the another. Their scale is not good too. At the other hand Mapinfo opens these georeferenced rasters perfectly. Is there any simple way to reference my rasters in apropriate area? – E Bobrov Feb 9 '16 at 13:13
  • GDAL library which QGIS is using can't read the georeferencing from .tab for png format. It may be able to do that with jpeg gis.stackexchange.com/questions/88640/…. Tab is plain text and contains a few ground control points which are usually at the corners of the image. Copy the contents of your .tab into your question and somebody may help with a script that converts .tab into .tfw which is another plain text file for georeferencing. – user30184 Feb 9 '16 at 13:32
  • Perfect job! Searching in the internet took me to the wonderfull solution: convert georefernced .jpeg .tab pairs to the tif. My QGIS already has the tool to help: Raster->Projections->Warp(Reproject). Input file - .jpeg, output - .tif. Output .tif files are georeferenced properly. Also we can reproject in batch mode to proccess whole directory with .jpeg-.tab pairs. Thanks a lot and have a nice day! – E Bobrov Feb 9 '16 at 14:52
2

A Mapinfo TAB file for a raster looks like this:

!table
!version 300
!charset WindowsLatin1

Definition Table
  File "4430.tif"
  Type "RASTER"
  (647250.000,234000.000) (0,0) Label "Pt 1",
  (648000.000,233500.000) (3000,2000) Label "Pt 2",
  (648000.000,234000.000) (3000,0) Label "Pt 3",
  (647250.000,233500.000) (0,2000) Label "Pt 4"
  CoordSys NonEarth Units "m"
  Units "m"
RasterStyle 1 50
RasterStyle 2 50

1st solution: create a gcp file (a simple text file) for QGIS Georeferencer plugin like this (for the TAB above):

mapX,mapY,pixelX,pixelY,enable
647250.000,234000.000,0,0,1
648000.000,233500.000,3000,2000,1
648000.000,234000.000,3000,0,1
647250.000,233500.000,0,2000,1

Open the Georeferencer plugin in QGIS, load the GCP file (search for the icon) and do the transformation.

2nd solution, generate world (pnw, pgw, tfw, etc.) file from the tab. You can easily calculate the six parameters of an affine transformation from the values in the TAB file. AFAIK Mapinfo handles rectified images (rows are parallel to the axis of the coordinate system). For the previous TAB file (tif image) the following twf file should be used:

0.25
0.00
0.00
0.25
647250.125
233999.875

First row is the resolution of the raster in x (east) direction:

(648000 - 647250) / 3000 e.g. (xmax - xmin) / pixel_width

The second and third row shear, always 0 for rectified images.

fourth row is the negativ resolution of the raster in y (north) direction:

(234000.000 - 233500.000) / 2000 e.g. (ymin - ymax) / pixel_height

The fifth row is the x coordinate of center of the upper left pixel (x_resolution is in the first row of tfw file):

647250.000 + 0.25 / 2 e.g. xmin + x_resolution / 2

The sixth row is the y coordinate of center of the upper left pixel(y_resolution is in the fourth row of tfw file) :

234000.000 - 0.25 / 2 e.g. ymax + y_resolution / 2

Copy the raster (in our sample 4430.tif) and the world file (in our case (4430.tfw) into the same folder and open it in QGIS as a raster.

These processes preserves the projection of the original raster. In the second case (which I would prefer) the name of the two files (tif and tfw) must be the same.

0

The answer is to use .jpeg-.tab georeferenced pairs and then convert them to the tif files that will be georeferenced too because info in tab is converting and storing in tif automatically. The convertation is easy in QGIS (gdalwarp command): Raster->Projections->Warp(Reproject). Input file - .jpeg, output - .tif. Also we can reproject in batch mode to proccess whole directory with .jpeg-.tab pairs. Have a nice day!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.