[Qgis-user] Problem correctly reading Mapinfo TIF and TAB files into QGIS
David Addy
david_addy at lineone.net
Sat Dec 28 04:48:51 PST 2013
Hi Bo Victor,
Thanks for your reply to my enquiry. The two files referred to in the
discussion are attached.
I hope that this helps you.
I do not know how to make these generally available to the whole QGIS list,
so I am sending them to you off list.
Best wishes,
David
David Addy
10 Northgate Avenue
Bury St Edmunds
Suffolk
IP32 6BB
Telephone 01284 704247
Mobile 07766 178 459
Are you interested in the local history of West Suffolk? If so, try my local
history site at:-
http://www.stedmundsburychronicle.com/index.htm
And including new for 2014, a picture gallery of our area during the Great
War, 1914-1919
http://www.stedmundsburychronicle.com/galleryww1/galleryww1home.htm
From: Bo Victor Thomsen [via OSGeo.org]
[mailto:ml-node+s1560n5095673h13 at n6.nabble.com]
Sent: 28 December 2013 09:33
To: David Addy
Subject: Re: Problem correctly reading Mapinfo TIF and TAB files into QGIS
Nick -
Could you make a couple of "problem" and "no problem" tiff/tab files
available ?
Regards
Bo Victor Thomsen
Aestas-GIS
Denamrk
Den 27-12-2013 19:31, David Addy skrev:
> In this area of the UK, a number of local authorities use Mapinfo for
their
> Archaeology and Record Office services. This often involves reading
> historical maps in order to compare with current conditions on the ground.
> All such maps are calibrated within Mapinfo, and are usually in the form
of
> .TIF files accompanied by a .TAB file giving the georeferencing data. As
> these departments are constantly under budgetary pressure there are many
> applications where the use of QGIS could result in considerable cost
> savings. However, it is necessary that existing maps should be easily read
> by QGIS and correctly located,
> without a cumbersome file conversion process.
> An example of such maps is the 1880s First Series 1:2500 scale county
> Ordnance Survey maps for Suffolk. At this scale it takes a large number of
> tiles to cover a whole county. In a sample dozen of such maps around Bury
St
> Edmunds, only four were correctly located by QGIS. My mapping friend Nick
> Hopton has kindly addressed this problem to the GDAL forum, using two
sample
> tiles, one of which works in QGIS and the other does not. The discussion
on
> this is reproduced below, and appears to come down to the size of the
error
> found by GDAL in its attempted transformation. AS this error seems to be
> acceptable within Mapinfo, I do not quite understand why it cannot work
> equally well within QGIS.
> Obviously this must be a critical issue for all Mapinfo users who would
like
> to adopt QGIS, but find that this problem causes their evaluations to fail
> at the first hurdle. Like myself, these users are not experts in the
> technical details of map projections, nor the problems of making pre-1936
> maps fit within today's UK Ordnance Survey OSGB36 Grid References.
> However, we need to know whether anyone knows how to persuade QGIS/GDAL
to
> locate these tiles in the correct place please?
>
> --------------------------------------------------
> PROBLEM PREVIOUSLY ADDRESSED TO GDAL FORUM:
>
> A friend, a relative newcomer to GIS, is having problems loading some of
the
> TIFs created with Mapinfo into QGIS. Each TIF has a TAB file and in some
> cases the TAB file is interpreted correctly and in other cases the TAB
file
> is (apparently) not recognised.
> I think this might be a problem with Gdal rather than a problem with QGIS.
> Taking just two of the TIFs, the output from gdalinfo when run on
> 33044061.TIF indicates that things are working as they should. However,
when
> gdalinfo is run on 33044071.TIF the spatial data in its TAB file is not
> recognised. See the listings below.
>
> The strange thing is that all of the TIFs can successfully be converted
from
> TIF to GeoTIFF using gdalwarp. (But it is important to my friend that he
> should be able to open Mapinfo raster images directly.)
>
> Any ideas?
>
> Regards,
> Nick.
>
>
> Contents of 33044061.TAB:
> ------------------------
> !table
> !version 300
> !charset WindowsLatin1
>
> Definition Table
> File "33044061.tif"
> Type "RASTER"
> (582429,263569) (1,7594) Label "Pt 1",
> (582372,265177) (1,0) Label "Pt 2",
> (584784,265263) (11335,1) Label "Pt 3",
> (584841,263655) (11335,7594) Label "Pt 4"
> CoordSys Earth Projection 8, 79, "m", -2, 49, 0.9996012717, 400000,
> -100000
> Units "m"
>
> Results of running gdalinfo on 33044061.TIF:
> -------------------------------------------
> nick at nick-6150M2MA:~/Desktop/tabstuff$ gdalinfo 33044061.TIF
> Warning 1: TIFFFetchNormalTag:ASCII value for tag "ImageDescription"
> contains null byte in value; value incorrectly truncated
> during reading due to implementation limitations
> Driver: GTiff/GeoTIFF
> Files: 33044061.TIF
> Size is 11335, 7594
> Coordinate System is:
> PROJCS["unnamed",
> GEOGCS["unnamed",
> DATUM["OSGB_1936",
> SPHEROID["Airy 1930",6377563.396,299.3249646],
> TOWGS84[375,-111,431,-0,-0,-0,0]],
> PRIMEM["Greenwich",0],
> UNIT["degree",0.0174532925199433]],
> PROJECTION["Transverse_Mercator"],
> PARAMETER["latitude_of_origin",49],
> PARAMETER["central_meridian",-2],
> PARAMETER["scale_factor",0.9996012717],
> PARAMETER["false_easting",400000],
> PARAMETER["false_northing",-100000],
> UNIT["Meter",1]]
> GeoTransform =
> 582371.785312838, 0.2128106799708935, 0.007506419931892793
> 265177.0453393974, 0.007597130759524194, -0.2117600570261751
> Metadata:
> TIFFTAG_IMAGEDESCRIPTION=
> TIFFTAG_XRESOLUTION=300
> TIFFTAG_YRESOLUTION=300
> TIFFTAG_MINSAMPLEVALUE=0
> TIFFTAG_MAXSAMPLEVALUE=1
> TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
> Image Structure Metadata:
> COMPRESSION=CCITTFAX4
> INTERLEAVE=BAND
> MINISWHITE=YES
> Corner Coordinates:
> Upper Left ( 582371.785, 265177.045) ( 0d40'19.83"E, 52d15'14.75"N)
> Lower Left ( 582428.789, 263568.939) ( 0d40'19.71"E, 52d14'22.68"N)
> Upper Right ( 584783.994, 265263.159) ( 0d42'27.09"E, 52d15'14.63"N)
> Lower Right ( 584840.998, 263655.053) ( 0d42'26.92"E, 52d14'22.57"N)
> Center ( 583606.392, 264416.049) ( 0d41'23.39"E, 52d14'48.66"N)
> Band 1 Block=512x512 Type=Byte, ColorInterp=Palette
> Image Structure Metadata:
> NBITS=1
> Color Table (RGB with 2 entries)
> 0: 255,255,255,255
> 1: 0,0,0,255
> nick at nick-6150M2MA:~/Desktop/tabstuff$
>
> Contents of 33044071.TAB:
> ------------------------
> !table
> !version 300
> !charset WindowsLatin1
>
> Definition Table
> File "33044071.tif"
> Type "RASTER"
> (584841,263655) (1,7576) Label "Pt 1",
> (584784,265263) (1,0) Label "Pt 2",
> (587197,265349) (11335,1) Label "Pt 3",
> (587254,263740) (11335,7576) Label "Pt 4"
> CoordSys Earth Projection 8, 79, "m", -2, 49, 0.9996012717, 400000,
> -100000
> Units "m"
>
> Results of running gdalinfo on 33044071.TIF:
> -------------------------------------------
> nick at nick-6150M2MA:~/Desktop/tabstuff$ gdalinfo 33044071.TIF
> Warning 1: TIFFFetchNormalTag:ASCII value for tag "ImageDescription"
> contains null byte in value; value incorrectly truncated
> during reading due to implementation limitations
> Driver: GTiff/GeoTIFF
> Files: 33044071.TIF
> Size is 11335, 7576
> Coordinate System is `'
> GCP Projection =
> PROJCS["unnamed",
> GEOGCS["unnamed",
> DATUM["OSGB_1936",
> SPHEROID["Airy 1930",6377563.396,299.3249646],
> TOWGS84[375,-111,431,-0,-0,-0,0]],
> PRIMEM["Greenwich",0],
> UNIT["degree",0.0174532925199433]],
> PROJECTION["Transverse_Mercator"],
> PARAMETER["latitude_of_origin",49],
> PARAMETER["central_meridian",-2],
> PARAMETER["scale_factor",0.9996012717],
> PARAMETER["false_easting",400000],
> PARAMETER["false_northing",-100000],
> UNIT["Meter",1]]
> GCP[ 0]: Id=Pt 1, Info=
> (1,7576) -> (584841,263655,0)
> GCP[ 1]: Id=Pt 2, Info=
> (1,0) -> (584784,265263,0)
> GCP[ 2]: Id=Pt 3, Info=
> (11335,1) -> (587197,265349,0)
> GCP[ 3]: Id=Pt 4, Info=
> (11335,7576) -> (587254,263740,0)
> Metadata:
> TIFFTAG_IMAGEDESCRIPTION=
> TIFFTAG_XRESOLUTION=300
> TIFFTAG_YRESOLUTION=300
> TIFFTAG_MINSAMPLEVALUE=0
> TIFFTAG_MAXSAMPLEVALUE=1
> TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
> Image Structure Metadata:
> COMPRESSION=CCITTFAX4
> INTERLEAVE=BAND
> MINISWHITE=YES
> Corner Coordinates:
> Upper Left ( 0.0, 0.0)
> Lower Left ( 0.0, 7576.0)
> Upper Right (11335.0, 0.0)
> Lower Right (11335.0, 7576.0)
> Center ( 5667.5, 3788.0)
> Band 1 Block=512x512 Type=Byte, ColorInterp=Palette
> Image Structure Metadata:
> NBITS=1
> Color Table (RGB with 2 entries)
> 0: 255,255,255,255
> 1: 0,0,0,255
> -------------------------------------------------------------------
>
>
> FRANK WARMERDAM REPLIED:
>
>
> Nick,
>
> I haven't tried the .TAB files locally, but I see they are both resulting
in
> georeferencing info. The one is expressed as a
>
> geotransform with rotation and shear while the other is expressed as
ground
> control points.
>
> I believe that the .TAB reader attempts to compute a geotransform from the
> points in the TAB and if it can do so with minimal
>
> error then that is what is returned - a solution easier to utilize in QGIS
> and other applications.
>
> If the control points do not represent a clean affine transformation for
the
> image then it falls back to returning them as
>
> ground control points which relatively few applications can utilize
> directly.
>
> One "solution" is to run gdalwarp to transform the image that isn't
> currently working so well into a north up affine
>
> transformation style image.
> eg.
>
> gdalwarp 33044071.TIF 33044071_northup.TIF
>
> This warp will be done using the control points (ironically also using a
> best fit first order polynomial).
>
> The code responsible for the decision is this from
gdal/gcore/gdal_misc.cpp:
>
>
> /* -------------------------------------------------------------------- */
>
> /* Try to convert the GCPs into a geotransform definition, if */
>
> /* possible. Otherwise we will need to use them as GCPs. */
>
> /* -------------------------------------------------------------------- */
>
> if( !GDALGCPsToGeoTransform( nCoordinateCount, asGCPs,
padfGeoTransform,
>
> FALSE ) )
>
> {
>
> if (pnGCPCount && ppasGCPs)
>
> {
>
> CPLDebug( "GDAL",
>
> "GDALLoadTabFile(%s) found file, wasn't able to derive
a\n"
>
> "first order geotransform. Using points as GCPs.",
>
> pszFilename );
>
>
>
>
> *ppasGCPs = (GDAL_GCP *)
>
> CPLCalloc( sizeof(GDAL_GCP),nCoordinateCount );
>
> memcpy( *ppasGCPs, asGCPs, sizeof(GDAL_GCP) *
nCoordinateCount
> );
>
> *pnGCPCount = nCoordinateCount;
>
> }
>
> }
>
> else
>
> {
>
> GDALDeinitGCPs( nCoordinateCount, asGCPs );
>
> }
>
> I suspect if you change the FALSE to TRUE in the arguments to
> GDALGCPsToGeoTransform() you wlil always get an affine
>
> transform even when it is not a very good fit.
>
>
>
> --
> View this message in context:
http://osgeo-org.1560.x6.nabble.com/Problem-correctly-reading-Mapinfo-TIF-an
d-TAB-files-into-QGIS-tp5095647.html
> Sent from the Quantum GIS - User mailing list archive at Nabble.com.
> _______________________________________________
> Qgis-user mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
_____
If you reply to this email, your message will be added to the discussion
below:
http://osgeo-org.1560.x6.nabble.com/Problem-correctly-reading-Mapinfo-TIF-an
d-TAB-files-into-QGIS-tp5095647p5095673.html
To unsubscribe from Problem correctly reading Mapinfo TIF and TAB files into
QGIS, click here
<http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscr
ibe_by_code&node=5095647&code=ZGF2aWRfYWRkeUBsaW5lb25lLm5ldHw1MDk1NjQ3fC0xMD
E0NDY0Nzc2> .
<http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_vi
ewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.Basic
Namespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.
NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_e
mails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> NAML
33044061.TAB (422 bytes) <http://osgeo-org.1560.x6.nabble.com/attachment/5095677/0/33044061.TAB>
33044061.TIF (591K) <http://osgeo-org.1560.x6.nabble.com/attachment/5095677/1/33044061.TIF>
33044071.TAB (422 bytes) <http://osgeo-org.1560.x6.nabble.com/attachment/5095677/2/33044071.TAB>
33044071.TIF (1M) <http://osgeo-org.1560.x6.nabble.com/attachment/5095677/3/33044071.TIF>
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-correctly-reading-Mapinfo-TIF-and-TAB-files-into-QGIS-tp5095647p5095677.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20131228/e6769cea/attachment.html>
More information about the Qgis-user
mailing list