Format of the Cvx BGL Files: Difference between revisions

From FSDeveloper Wiki
Jump to navigationJump to search
Line 60: Line 60:
|-
|-
| 0x00
| 0x00
| 01 02 92 19
| <pre>01 02 92 19
| Magic Number #1
| Magic Number #1
|-
|-
| 0x04
| 0x04
| 38 00 00 00
| <pre>38 00 00 00</pre>
| Header size
| Header size
|-
|-
| 0x08
| 0x08
| EF 82 DF E2
| <pre>EF 82 DF E2</pre>
|  
|  
|-
|-
| 0x0C
| 0x0C
| E8 C7 C6 01
| <pre>E8 C7 C6 01</pre>
|  
|  
|-
|-
| 0x10
| 0x10
| 03 18 15 08
| <pre>03 18 15 08</pre>
| Magic Number #2
| Magic Number #2
|-
|-
| 0x14
| 0x14
| 01 00 00 00
| <pre>01 00 00 00</pre>
| 1 section following this header
| 1 section following this header
|-
|-
| 0x18
| 0x18
| E8 07 02 00
| <pre>E8 07 02 00</pre>
| MinLatitude(Deg) = 46.40625<br/>MaxLatitude(Deg) = 47.8125<br/>MinLongitude(Deg) = -75.0<br/>MaxLongitude(Deg) = -73.125
| MinLatitude(Deg) = 46.40625<br/>MaxLatitude(Deg) = 47.8125<br/>MinLongitude(Deg) = -75.0<br/>MaxLongitude(Deg) = -73.125
|-
|-
| 0x1C
| 0x1C
| E9 07 02 00
| <pre>E9 07 02 00</pre>
| MinLatitude(Deg) = 46.40625<br/>MaxLatitude(Deg) = 47.8125<br/>MinLongitude(Deg) = - 73.125<br/>MaxLongitude(Deg) = -71.25
| MinLatitude(Deg) = 46.40625<br/>MaxLatitude(Deg) = 47.8125<br/>MinLongitude(Deg) = - 73.125<br/>MaxLongitude(Deg) = -71.25
|-
|-
| 0x20
| 0x20
| EA 07 02 00
| <pre>EA 07 02 00</pre>
| MinLatitude(Deg) = 45.0<br/>MaxLatitude(Deg) = 46.40625<br/>MinLongitude(Deg) = -75.0<br/>MaxLongitude(Deg) = -73.125
| MinLatitude(Deg) = 45.0<br/>MaxLatitude(Deg) = 46.40625<br/>MinLongitude(Deg) = -75.0<br/>MaxLongitude(Deg) = -73.125
|-
|-
| 0x24
| 0x24
| EB 07 02 00
| <pre>EB 07 02 00</pre>
| MinLatitude(Deg) = 45.0<br/>MaxLatitude(Deg) = 46.40625<br/>MinLongitude(Deg) = -73.124<br/>MaxLongitude(Deg) = -71.25
| MinLatitude(Deg) = 45.0<br/>MaxLatitude(Deg) = 46.40625<br/>MinLongitude(Deg) = -73.124<br/>MaxLongitude(Deg) = -71.25
|-
|-
| 0x28
| 0x28
| 00 00 00 00
| <pre>00 00 00 00</pre>
|  
|  
|-
|-
| 0x2C
| 0x2C
| 00 00 00 00
| <pre>00 00 00 00</pre>
|  
|  
|-
|-
| 0x30
| 0x30
| 00 00 00 00
| <pre>00 00 00 00</pre>
|  
|  
|-
|-
| 0x34
| 0x34
| 00 00 00 00
| <pre>00 00 00 00</pre>
|  
|  
|}
|}

Revision as of 15:22, 18 July 2014

Introduction

CVX Files can be read by the TmfViewer.exe application provided with the FS SDK. They contain TERRAIN_VECTOR_DB sections. These sections and subsections describe the different layers (roads, railways, water polygons, etc.) along with the geographical coordinates.
In this document, I will often take examples from the cvx2815.bgl file since that is the one I used to figure out the structure of the cxv file and it describes the area I live in. This file is located in: (....)\Microsoft Flight Simulator X\Scenery\0301\scenery.

BGL Common Format

All BGL files share the same generic format. A BGL file is made of a header, sections, subsections and subsection data. Subsections are children of sections. The sections are here to help us locate the subsections in the file. Data specific information is contained in the subsections data and their format is dependent on the section type.
A BGL file always start with a header (Size = 0x38 bytes), followed by a list of section pointers. The number of section pointers is defined in the header.

File Header

The header consists of 0x38 (56) bytes. It contains the number of sections defined in the file as well as the bounding geographical coordinates of the covered squared area.

Offset Number of bytes Description
0x00 4 - DWORD Magic Number #1 – Must be 0x01, 0x02, 0x92, 0x19
0x04 4 - DWORD Header size : 0x38
0x08 4 - DWORD Unknown – Maybe a timestamp
0x0C 4 - DWORD Unknown – Maybe a timestamp
0x10 4 - DWORD Magic Number #2 – Must be 0x03, 0x18, 0x05, 0x08
Maybe to identify the FS version
0x14 4 - DWORD The number of sections following this header.
0x18 32 Array[8] of unsigned integers (DWORD).
Each value describes the bounding coordinates of a squared subarea.

Even if 8 slots are provided, it is not necessary to have all 8 values filled. The list stops at the first null (0x00000000) value.
I don’t know what these subareas are used for.
To compute the bounding coordinates, please see Annexe A.
To get the bounding coordinates of the square area covered by the file, just keep the minimal and maximal values of each bounding coordinates.



Example

For example, in cvx2815.bgl :

Offset Values Description
0x00
01 02 92 19
| Magic Number #1
|-
| 0x04
| <pre>38 00 00 00
Header size
0x08
EF 82 DF E2
0x0C
E8 C7 C6 01
0x10
03 18 15 08
Magic Number #2
0x14
01 00 00 00
1 section following this header
0x18
E8 07 02 00
MinLatitude(Deg) = 46.40625
MaxLatitude(Deg) = 47.8125
MinLongitude(Deg) = -75.0
MaxLongitude(Deg) = -73.125
0x1C
E9 07 02 00
MinLatitude(Deg) = 46.40625
MaxLatitude(Deg) = 47.8125
MinLongitude(Deg) = - 73.125
MaxLongitude(Deg) = -71.25
0x20
EA 07 02 00
MinLatitude(Deg) = 45.0
MaxLatitude(Deg) = 46.40625
MinLongitude(Deg) = -75.0
MaxLongitude(Deg) = -73.125
0x24
EB 07 02 00
MinLatitude(Deg) = 45.0
MaxLatitude(Deg) = 46.40625
MinLongitude(Deg) = -73.124
MaxLongitude(Deg) = -71.25
0x28
00 00 00 00
0x2C
00 00 00 00
0x30
00 00 00 00
0x34
00 00 00 00

You’ll notice that only 4 subareas are defined (on a possibility of 8) and the last 4 available slots are empty (Value = 0)
So the bounding coordinates of the area covered by cvx2815.bgl are:

MinLatitude(Deg) = 45.0
MaxLatitude(Deg) = 47.8125
MinLongitude(Deg) = -75.0
MaxLongitude(Deg) = -71.25

Sections

Following the header, at offset 0x38, there are as many sections as defined at offset 0x14 of the header. Each section has a size of 20 bytes and has the following structure:

Relative Offset Number of bytes Description
0x00 4 - DWORD Section type: one of the following values:
  • None = 0x0
  • Copyright = 0x1
  • Guid = 0x2
  • Airport = 0x3
  • Nav = 0x13
  • Ndb = 0x17
  • Marker = 0x18
  • Boundary = 0x20
  • Waypoint = 0x22
  • Geopol = 0x23
  • SceneryObject = 0x25
  • AirportNameIndex = 0x27
  • VorIcaoIndex = 0x28
  • NdbIcaoIndex = 0x29
  • WaypointIcaoIndex = 0x2A
  • ModelData = 02B
  • AirportSummary = 0x2C
  • Exclusion = 0x2E
  • TimeZone = 0x2F
  • TerrainVectorDb = 0x65
  • TerrainElevation = 0x67
  • TerrainLandClass = 0x68
  • TerrainWaterClass = 0x69
  • TerrainRegion = 0x6A
  • PopulationDensity = 0x6C
  • AutogenAnnotation = 0x6D
  • TerrainIndex = 0x6E
  • TerrainTextureLookup = 0x6F
  • TerrainSeasonJan = 0x78
  • TerrainSeasonFeb = 0x79
  • TerrainSeasonMar = 0x7A
  • TerrainSeasonApr = 0x7B
  • TerrainSeasonMay = 0x7C
  • TerrainSeasonJun = 0x7D
  • TerrainSeasonJul = 0x7E
  • TerrainSeasonAug = 0x7F
  • TerrainSeasonSep = 0x80
  • TerrainSeasonOct = 0x81
  • TerrainSeasonNov = 0x82
  • TerrainSeasonDec = 0x83
  • TerrainPhotoJan = 0x8C
  • TerrainPhotoFeb = 0x8D
  • TerrainPhotoMar = 0x8E
  • TerrainPhotoApr = 0x8F
  • TerrainPhotoMay = 0x90
  • TerrainPhotoJun = 0x91
  • TerrainPhotoJul = 0x92
  • TerrainPhotoAug = 0x93
  • TerrainPhotoSep = 0x94
  • TerrainPhotoOct = 0x95
  • TerrainPhotoNov = 0x96
  • TerrainPhotoDec = 0x97
  • TerrainPhotoNight = 0x98
  • FakeTypes = 0x2710
  • IcaoRunway = 0x2711

Subsections

Subsection for section of type Terrain_Vector_DB

Subsection Header

Entity Structure

Segment Structure

Method 1

Method 2

Example

Annexe A