Sign in to follow this  
Guest

TMF/BGL File Format

Recommended Posts

Firstly, as this is my first post as an Avsim member, let me just say a quick hello to everyone. I am a 48-year-old Brit who has been simming since FS5. I am somewhat belatedly learning a bit of programming and I am maybe half-way through writing something to facilitiate the production of mesh terrain from DEMs which I hope to be able to share with you in a couple of months or so.It is in this connection that I'm approaching the forum for some help. I need to learn a lot more than I already know about the format for elevation TMFs and BGLs (uncompressed), particularly the structure of the tables at the end of the file. I have a copy of a document dated 14 July 2001 written by Christian Stock which has been very helpful but I am sure that in the ensuing year and a half he and others will have made a lot more progress in unravelling the mysteries.I have not been able to locate an update. Can anyone help? I have placed on my webspace an annotated copy of this document with my own observations - if you'd care to take a look it's athttp://www.swwtrad.freeserve.co.uk/tmfdoc.docMy hope is that I will be able to include a TMF/BGL reader/writer in my project (which will be freeware). Any assistance/information would be greatly appreciated.David MillerTorquayUK

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi David,You should have helped my 1.5 years ago!!!Yes, indeed, the headers I have completely cracked now (there are still some numbers I don't have a clue about but they seem irrelevant). Your comments about the data section are correct as far as I can see, but I haven't ever bothered to disect the data section 100%.The last table is a quad-tree look-up table. The format is just strange. You get these FF FF FF FF 00 00 00 00 entries, and the numbered ones. The numbers themselves don't mean anything (some do, but that's not the prime purpose) it actually is the order that is important! You will find that the order encodes the LOD quadrant number in the data section. Some values in there probably also encode if the data is compressed or not.I simply quit decoding the tmf format. I don't see the point at this stage. Everything I want to do, I can do with either of the resample versions. I can also have a look at the contents with TMFViewer. The only real use of reading the format would be if we can figure out the compression algorithm. I can hack into my own uncompressed files and extract the data if I need to.If you really want to write a better graphical resample tool (which would be great to have), I can give you some valuable info. There is actually a tmfdoc2, which contains a bit more general info (without any binary code though), and I'm currently writing a tmfdoc3, which also doesn't contain any binary info, but has some other very detailed info.If you just want to edit source data, Photoshop does the job rather well. But then again, having a fully working resampler with a graphical component and edit capapbilities (and maybe even a choice of resample methods, etc), would of course be a blast to have. Quite a big project though...Cheers, Christian

Share this post


Link to post
Share on other sites

Wow, I wasn't expecting to hear from the man himself :-) Yes, you're right, I should have helped out earlier but I felt out of my depth.I'd certainly appreciate any information you can pass on, Christian. You just can't have too much knowledge!A fully featured graphical resampler is what I am aiming at. When I began doing meshes I found the available DEM data files too big for most purposes and at that stage I didn't even know how to go about cutting a tile from a large raster. Also I was uncomfortable with the command-driven SDK tools and struggled somewhat. I figured that I would not be alone in this.I found Martin Wright's FSTerrain which allows you to cut a tile from the 1Km DEMs by typing in bounds information, and I thought how nice it would be if you could do this just by drawing a rectangle on the map with a mouse. I had to learn a great deal - I couldn't even program a video recorder at that time.I got a C manual and a Petzold, ignored the wife for a couple of months and made some progress, but I never finished it. Now I have come back to it and, I think, gotten rather carried away with it.As it stands it will read binary DEMs and the USGS text-based 1 Degree DEMs, allowing the user to see the contents using a choice of colour-mapping options. Given a LOD value it will overlay a grid so that you can visually see the alignment of LOD boundaries around your chosen area of interest. It will save out a DEM based on a rectangle which you drag out with the mouse, and that rectangle can be snapped to LOD boundaries to ensure you have all the data the resampler requires and none gets 'dropped'. It reads and writes 'inf' files, reads off coordinates and altitudes under the mouse in units chosen by the user and allows point-and-click editing of the underlying data.It can resample to any given resolution, but one still needs to process the result through the SDK tools since I cannot write a TMF/BGL. This makes my resampler seem pointless, but it offers some control over the resampling process. Secifically, the user can choose the resampling algorithm (at the moment I'm trying to understand one that was specifically developed for topological data) and he can mark specific points (eg mountain peaks) as 'fixed'. The resampler will then ensure that the full values appear in the output file as close as possible to their original location instead of being 'averaged out' or discarded altogether during resampling. It's better to have a rugged peak a little out of position than to have a rolling hill with Autogen houses on it!I can in fact read an uncompressed TMF at the moment (mainly thanks to your own efforts) and map it to screen, but I have to use a convoluted way of determining the order the LOD 'tiles' appear in the complete image because I don't yet understand how the look-up table works. If the user simply wants to edit a few points I can simply overwrite the original data and save out, but if he wants to change bounds or resample altogether I cannot handle it at present. Nor can I determine anything about bounds and coordinates from the TMF.Sorry this post is so long but I wanted to explain how far down the road I am and where I am hoping to go. When I get all the elevation stuff done I may turn my attention to land classes, etc. I take it you have my email address if you can let me have anything you think will help. The more I know the better :-)Many thanks once againDavid

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this