[File] [PATCH] of Magdir/map for MapInfo Interchange Format *.mif
Jörg Jenderek
joerg.jen.der.ek at gmx.net
Tue Nov 26 13:27:33 UTC 2019
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
some days ago i had to handle some ImageMagick bitmaps which have
sometimes filename extension mif. When searching on my systems for
non ImageMagick bitmaps with same file name extension i found a few
Geographic maps with MapInfo Interchange Format. When running file
command version 5.37 on such samples and similar test examples such
maps are described generic as text.
Some information about MapInfo Interchange Format (MIF) can be found
on Wikipedia site. So i add this URL by comment line like:
# URL: https://en.wikipedia.org/wiki/MapInfo_Interchange_Format
On that site a link to interchange_file.pdf about MapInfo Data
Interchange Format is listed. Instead i use site on the National
Archives of UK as reference. This is expressed by comment line:
# Reference: http://www.nationalarchives.gov.uk/pronom/x-fmt/231
According to PDF such mif files should start with string VERSION.
There nothing is said about case.
For comparison reason i run other utilities.
The droid tool { found at http://droid.sourceforge.net/ } recognize
these files by PUID x-fmt/231 as "ESRI MapInfo Export File".
The file identifier tool TrID (see
http://mark0.net/soft-trid-e.html) describes the examples as "MapInfo
Interchange Format" by definition mif-mapinfo.trid.xml.
According to these other tools also other cases are possible like
Version in example E_VIC18.MIF. According to trid first letter must
be upcased V, whereas DROID also accepts all low cased variant like
test-lowcase.mif.~. DROID also does not care about letter at offset
5. So it also accepts string like versi0n. So i look for such mif
files by first magic line
0 string/c Version
To skip ASCII files like version.txt with text "VERSION 650 can be
found in MapInfo Interchange Format" i add second test according to
DROID. So look after version for string Charset with different cases
and display identifying message by line
>12 search/4/c charset MapInfo export File
The mif files are files with map information exported/imported by
many applications because it contains just plain text. Because every
one can generate maps with help of text editor i choose a user
defined mime type expressed by line
!:mime text/x-mapinfo-mif
File name extension is shown by line
!:ext mif
Afterward show version number n, which is stored as string.
Sometimes the string consist of 3 letters like 650, but sometimes 3
space characters are before such version like in example
E_VIC18.MIF. So show this version without spaces by line
>>8 string/T x \b, version %.5s
The Charset clause specifies which character set was used to create
text in the table. For example: Specify “WindowsLatin1” to indicate
that the file was created using the Windows US & Western Europe
character set; specify “MacRoman” to specify the Macintosh US &
Western Europe character set; or specify “Neutral” to avoid
converting the text into another character set. So show this
information by line
>>&0 string/T x \b, charset %s
After applying the above mentioned modifications by patch
file-5.37-map-mif.diff then i get an output like:
version.txt: ASCII text, with CRLF line
versionLONG.mif.~: ASCII text, with CRLF line
versi0n.mif: ASCII text, with CRLF line
test-lowcase.mif.~: ASCII text, with CRLF line
x-fmt-231-signature-id-393.mif: ISO-8859 text, with no line
x-fmt-231-signature-id-392.mif: ISO-8859 text, with no line
x-fmt-231-signature-id-391.mif: ISO-8859 text, with no line
x-fmt-231-signature-id-390.mif: ISO-8859 text, with no line
E_VIC18.MIF: MapInfo export File,
version 780, charset "WindowsLatin1"
E_ACT_18.MIF: MapInfo export File,
version 600, charset "WindowsLatin1"
SOSR_2011_AUST.mif: MapInfo export File,
version 650, charset "Neutral"
I hope my diff file can be applied in a future version of
file utility.
With best wishes
Jörg Jenderek
- --
Jörg Jenderek
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCXd0oPQAKCRCv8rHJQhrU
1jLgAJ4hJCaxoMRUyjipTst3lOAk4o/OyACeOGdnuTkf6C/Wn5e7mJBlhDdPV9w=
=8gCd
-----END PGP SIGNATURE-----
-------------- next part --------------
--- file-5.37/magic/Magdir/map.old 2019-04-30 04:02:04 +0000
+++ file-5.37/magic/Magdir/map 2019-11-26 13:04:57 +0000
@@ -329,3 +329,23 @@
>>>>5 byte x \b%d,
>>>>6 leshort x product ID %04d)
+# URL: https://en.wikipedia.org/wiki/MapInfo_Interchange_Format
+# Reference: http://www.nationalarchives.gov.uk/pronom/x-fmt/231
+# From: Joerg Jenderek
+# Note: MIF files are sometimes accompanied by MapInfo data (.MID) file
+# start with string like Version with different cases and o is maybe other char
+0 string/c Version
+# followed by space~20h
+#>7 ubyte 0x20 \b, space after version
+# look after version for string Charset with different cases to skip ASCII text
+>12 search/4/c charset MapInfo export File
+# by DROID called ESRI MapInfo Export File
+# by TrID called MapInfo Interchange Format
+#!:mime text/plain
+!:mime text/x-mapinfo-mif
+!:ext mif
+# version string like: "400" " 600" "650" " 780"
+>>8 string/T x \b, version %.5s
+# value of charset like: "WindowsLatin1" "Neutral" "MacRoman"
+>>&0 string/T x \b, charset %s
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.37-map-mif.diff.sig
Type: application/octet-stream
Size: 95 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20191126/31501d3f/attachment.obj>
More information about the File
mailing list