Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for big-endian nvt2 grid file #345

Closed
bastik opened this issue Jan 23, 2016 · 1 comment
Closed

add support for big-endian nvt2 grid file #345

bastik opened this issue Jan 23, 2016 · 1 comment

Comments

@bastik
Copy link

bastik commented Jan 23, 2016

There are binary ntv2 grid files in little-endian and in big-endian. Currently, proj.4 assumes all files are little-endian and fails otherwise.

The code to switch the endianness of the binary data is already there. But the trigger, when to switch, can be improved to match that of the nvt2 data.

The type of the ntv2 file can be detected from the first 16 bytes:

$ xxd -l 16 ntf_r93.gsb  # little endian
0000000: 4e55 4d5f 4f52 4543 0b00 0000 0000 0000  NUM_OREC........
$ xxd -l 16 ntf_r93_b.gsb  # big endian
0000000: 4e55 4d5f 4f52 4543 0000 000b 0000 0000  NUM_OREC........

The number of overview header records is always 11, which is also hardcoded in pj_gridinfo_init_ntv2. Therefore one can check if byte 9 to 12 equals the integer 11 encoded in LE or BE.

kwrobot pushed a commit to aashish24/gdal-svn that referenced this issue Jan 24, 2016
@bastik
Copy link
Author

bastik commented Feb 4, 2016

Thanks, it is working for me!

@bastik bastik closed this as completed Feb 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant