Further to my Post yesterday I've done a bit of research and thought I
would share my discoveries
re binary NTv2 Grid shift files:
The following code reads the header to the Grid shift file and simply
prints it in the MapInfo window.
Basically each record in the header section is composed of an 8 byte string
identifier and an 8 byte value.
Integers in Grid shift files are 8 bytes long but the last 4 bytes are
padded out with null values and
are just there to make the record up to 16 bytes
Most of this information I gleaned from the software manual for Land
Victoria's GDAit programme which
you can download from their site here in Australia.
Thanks also Jakob for pointing me in the right direction with his digest of
binary posts. That clarified a few
thing regarding variable size etc.
Dim MyFile as string
Dim MyFloat as float
Dim MyInteger1 as Integer
Dim MyInteger2 as Integer
Dim MyString as string * 8 ' all strings are 8 bytes
Dim MyString2 as string * 8
Dim i as integer
Myfile = FILEOPENDLG("C:\Program Files\GDAit\Data","","gsb","Select Grid
File")
Open file Myfile For Binary Access Read As #1
Onerror Goto Escape
Print chr$(12)
'Read first 3 records which are in the format of a string indentifier and
an integer.
'Integers in an NTv2 Grid Shift file are expressed two lots of four bytes
with the
'last four bytes simply being null value padding that we can ignore
For i = 1 to 3
Get #1,,MyString
Get #1,,MyInteger1
Get #1,,MyInteger2 'padding don't need this
Print MyString + " " + str$(MyInteger1)
Next
'Next four records are in the format of a string indentifier and a string
value
For i = 1 to 4
Get #1,,MyString
Get #1,,MyString2
Print MyString + MyString2
Next
'Next four records are the format of a string identifier and a double
integer value.
'The double integer values (float in Mapbasic terms) define the coordinate
extents
'of the Grid file
For i = 1 to 4
Get #1,,MyString
Get #1,,MyFloat
Print MyString + " " + str$(MyFloat)
Next
Escape:
Close file #1
Regards
Steve McArthur
GIS Manager
Warren King and Company
Tel: (08) 9274 2535 - Mobile: 0418 925 118
Fax: (08) 92742545
Email: [EMAIL PROTECTED]
_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.