The MGL navidata format, explained

What is inside a NAVIDATA.EWD file. Version 5, as verified by this project.

Contents
  1. Overview
  2. Where this description comes from
  3. Basics: numbers, positions, strings, dates
  4. File layout
  5. The three kinds of pointer
  6. Header
  7. Waypoints
  8. Waypoint Allocation Table
  9. Airport index and airport info
  10. Airspace
  11. Obstacles
  12. How the EFIS reads the file
  13. Corrections to MGL's draft specification

1. Overview

A navidata file is a single binary file holding everything the EFIS knows about the aviation world outside your own user waypoints: airports with their runways and radio frequencies, navaids, fixes, airspace and obstacles. MGL EFIS systems load it from the SD card; MGL Central can create, import and edit it.

The file is built for a small embedded computer. Instead of a database, it is a set of sections of fixed-size records, plus small lookup tables that let the EFIS jump straight to the part it needs (for example, “waypoints near longitude 88° W”) without reading the whole file.

SectionHoldsLooked up by
HeaderCounts, section locations, date, AIRAC cycleAlways read first
WaypointsEvery point: airports, navaids, fixes (position, name, type, frequency or elevation)Longitude, via the WAT
Waypoint Allocation Table (WAT)Where each 1° longitude band of waypoints startsLongitude
Airport indexAirport identifiers, sorted, with a pointer to each airport's detailsIdentifier (binary search)
Airport infoFrequencies and runways per airportFrom the index or the airport's waypoint
AirspaceAirspace outlines, limits and names10° × 10° map tiles
ObstaclesTowers, turbines, buildings… with heights and lighting1° × 1° grid cells

The header also has slots for airways, SIDs, STARs and holding patterns, but MGL never defined a format for them. Open-data files set them to zero.

2. Where this description comes from

MGL's written specification is an unfinished draft (March 2014) and is wrong in several places. This description was checked against, in order of authority:

  1. Real MGL files (navidataUS.ewd (from Michigan Avionics), navidataZA.ewd (from MGL Avionics), and files re-saved by MGL Central). When the bytes disagree with a document, the bytes win.
  2. MGL's “rainier”, the format's author, in the MGL forum thread “NAVIDATA format spec question”.
  3. The G4 firmware source, which shows how the EFIS actually reads each field.
  4. The draft PDF, “MGL Avionics Navidata file format, version 5”.

Every difference from the draft is listed in section 13.

3. Basics: numbers, positions, strings, dates

ItemHow it's storedExample
IntegersLittle-endian (least significant byte first). 8, 16 or 32 bits, signed or unsigned.496 = bytes F0 01 00 00
Latitude / longitudeSigned 32-bit, in units of 1/180,000 of a degree (0.02 arc-seconds, about 0.6 m). North and east are positive.N45°59′30″ = 45.9917 × 180000 = 8278500
Fixed string ShortString[N]1 length byte, then a field of exactly N bytes; unused bytes are padding. Takes N+1 bytes.Short name: ShortString[6] = 7 bytes
Variable string1 length byte, then exactly that many bytes.Frequency descriptions, airspace names
DateUnsigned 32-bit seconds since 1 January 2000, 00:00.
Elevation (airports, runways, airport waypoints)Feet plus 1000, so the value stays positive below sea level.809 ft stored as 1809

4. File layout

Sections appear in this order in files written by MGL Central and by this tool. The EFIS finds each one through the pointers in the header, so the order itself isn't required.

offset 0     +---------------------------------------------+
             | Header                          496 bytes    |
offset 496   +---------------------------------------------+
             | Airport index  (size + 20-byte records)      |
             +---------------------------------------------+
             | Airport info   (frequencies + runways)       |
             +---------------------------------------------+
             | Airspace       (648-tile directory + records)|
             +---------------------------------------------+
             | Obstacles      (grid header + bins + records)|
             +---------------------------------------------+
             | Waypoints      (52-byte records)             |
             +---------------------------------------------+
             | WAT            (361 x 8 bytes = 2,888 bytes) |
             +---------------------------------------------+

5. The three kinds of pointer

A pointer is a number saying where something is in the file. The format measures pointers from three different starting points, and mixing them up is the most common way to produce a broken file.

PointerMeasured fromExample
Header section pointersStart of the file. The draft says “after the header”; that's out of date.Airport index at 496
Airport index → airport infoEnd of the header: add 496.KOSH: stored 775982, record at 776478
Inside an airport recordA local starting point in that record (see section 9).Frequency and runway tables

Waypoint records have one more link, AirportInfoReference, measured from the start of the airport info section.

OffsetFieldMeaning
0FileIDThe text NAVIDATA
8Vendor0 = open, unencrypted data. Other values are copy-protected commercial data.
12NaviDataDateWhen the file was made
16–407Magic numbers, 32 serialsCopy protection; all zero for open data
408–411Sections / encryption / version10 / 0 / 5
412–423Airports: count, index pointer, info pointer
424–431Airspaces: count, pointer
432–455Airways, SIDs, STARsAll 0 (format never defined)
456–463Obstacles: count, pointerIf the count is 0 the pointer is meaningless and must be ignored.
464–475Waypoints: count, pointer, WAT pointer
476–483Start / end datesValidity period; may be 0
484CycleStr4-character AIRAC cycle, e.g. 2610; may be blank
488–495Holding patterns0

7. Waypoints

Every point the EFIS can show or navigate to is a waypoint record, including airports and navaids. The airport sections only add extra detail for airport-type waypoints. Each record is 52 bytes:

OffsetSizeFieldMeaning
04Latitude1/180,000 degree
44Longitude1/180,000 degree
84DataFieldDepends on the type (below)
121TypeBits 0–6: waypoint type. Bit 7: steering allowed.
137ShortNameIdentifier, up to 6 characters (KOSH, OSH, BUOYE)
2028LongNameDescription, up to 27 characters
484AirportInfoReferenceFor airports: where its airport info record is, from the start of the airport info section. 0 for everything else.
If AirportInfoReference is missing, MGL Central still shows the airport, but its frequency and runway panels come up empty.

Waypoint types

CodeTypeCodeType
0WAYPOINT12VOR/DME
1AIRPORT13VORTAC
2MAJOR AIRPORT14FAN MARKER
3SEAPLANE BASE15VOR
4AIRFIELD16REP-PT (reporting point)
5PRIVATE AIRFIELD17, 18LFR, UHF-NDB
6ULTRALIGHT FIELD20–22M-NDB/DME, LOM, LMM
7INTERSECTION23, 24LOC/SDF, MLS/ISMLS
8HELIPORT25OTHER NAV
9TACAN26–30Route actions (altitude/speed change, notify); not map points
10, 11NDB/DME, NDB

What DataField holds

TypesDataField
0–6, 8 (waypoints and airports)Elevation in feet + 1000
7 (intersection)Unused
VHF navaids (VOR, VOR/DME, VORTAC, TACAN…)Frequency in kHz: 113.200 MHz = 113200
NDB family (NDB, NDB/DME, LOM…)Frequency in Hz: 329 kHz = 329000
16 (REP-PT)Frequency of the associated navaid, if any

8. Waypoint Allocation Table (WAT)

The WAT lets the EFIS find the waypoints in a longitude band without reading them all. It has 361 entries of 8 bytes, one per degree of longitude from 180° W to 180° E. Each entry holds a count and a start index.

Example: if band 92 has count 1,250 and start 40,100, waypoints 40,100 to 41,349 all lie between 88° W and 89° W.

9. Airport index and airport info

Airport index

Starts right after the header (offset 496) with a 4-byte number giving the index size in bytes, then one 20-byte entry per airport, sorted by identifier so the EFIS can binary-search it.

OffsetSizeFieldMeaning
01KindAirport type (waypoint types 1–8)
17IdentifierUp to 6 characters
84PtrAirport info record location, from the end of the header (add 496)
128Latitude, LongitudeAirport position

Airport info record

Each airport's details: a 20-byte fixed part, then its frequencies, then its runways.

OffsetSizeFieldMeaning
04RunwaysPointerWhere the runway table starts, measured from the frequency base (this record + 20)
44DataPointer“Other data”, or 0 (undocumented; not written by this tool)
82AltitudeElevation, feet + 1000
10–123CountsNumber of frequencies, runways, other data
133SparePadding
164WaypointPointerLink back to the airport's waypoint

Frequencies follow at the frequency base: a table of 16-bit pointers (from the frequency base), then the records. Each record is the frequency in Hz (4 bytes), a type of up to 4 characters (TWR, GND, CTAF, ATIS…) and a variable-length description.

Runways follow at RunwaysPointer: a table of 16-bit pointers measured from the start of the runway table, then 36-byte records:

OffsetSizeFieldMeaning
02DesignationEncoded pair, see below
2, 42 + 2Length, WidthFeet
62BearingTrue bearing 0–359°, or 0xFFFF if none
89SurfaceShort text, e.g. ASPH, CONC, TURF
173SparePadding
208Threshold 1Latitude and longitude of the first end
284Threshold 2Offset from threshold 1 (16-bit latitude, 16-bit longitude)
324Altitude 1, 2Threshold elevations, feet + 1000

Runway designation

Encoded valueKindShown as
0x0009Number and reciprocal09/27
0x2009 / 0x3009Parallel, first end Left / Right09L/27R, 09R/27L
0x7009Water runway09W/27W
0x6001HelipadH1
0x80000x8007Compass-point water laneN/S, NE/SW…

For parallel runways the reciprocal swaps L and R: 07L pairs with 25R.

10. Airspace

The world is divided into 648 tiles of 10° × 10° (36 columns × 18 rows, starting at 90° N, 180° W). The section starts with a marker (0xFFFF0001) and one pointer per tile. Each tile holds a linked list of the airspaces that touch it, plus 5° of overlap on each side, so the EFIS only reads the tiles around the aircraft. An airspace that spans several tiles is stored once per tile.

Each airspace record has:

Type codesMeaning
1–12Advisory, ADIZ, ARTCC, ACC, buffer, control area (Class C), control zone (Class D), FIR, OCA, radar area, TCA (Class B), UIR
32–38Alert, danger, MOA, prohibited, restricted, temporary reserved, warning

Altitude limits pack a unit code in the low 3 bits and the value in the rest: 0 = surface / unlimited, 1 = feet MSL, 2 = feet AGL, 3 = flight level, 4 = ground, 5 = by NOTAM, 6 = undefined.

11. Obstacles

Obstacles are stored in a grid of 1° × 1° cells covering the area that has obstacles.

When a file has no obstacles, MGL Central still writes a fixed empty grid (385,580 bytes) with a negative width and height. This tool writes the same thing so MGL Central reads it the same way.

12. How the EFIS reads the file

From the MGL iEFIS G4 firmware source:

LimitEffect
20,000 nearby waypointsThe EFIS loads waypoints within about ±10° of the aircraft into a list of at most 20,000, then sorts it for the nearest list. Because the file is sorted west to east, anything beyond 20,000 (the eastern part) is never loaded. Primary navidata, SNAVI.EWD and user waypoints share the list, in that order.
800 points per airspaceLonger outlines are cut off at 800 points.
Map memory (about 10 MB)Decoded airspace shares it with the vector map; once it's full, further airspaces aren't loaded.
Declutter settingsEach waypoint type is shown only at the zoom levels the pilot enables. Intersections and reporting points are usually shown only close in.
File sizeNo practical limit. Obstacles and waypoints are read from the card as needed.

13. Corrections to MGL's draft specification

AreaDraft saysReal files
Header section pointersFrom the end of the headerFrom the start of the file
Header sizeNot stated496 bytes
Obstacle pointer when count is 0ValidMeaningless; ignore it
Airport indexRecords start at the sectionA 4-byte size comes first
Index → airport info pointerUnclearFrom the end of the header (+496)
Airport fixed part13 bytes20 bytes (3 spare + WaypointPointer)
Airport and runway elevationsFeetFeet + 1000
Frequency pointers32-bit16-bit
Frequency descriptionFixed 50 charactersVariable length
Runway pointersFrom the frequency baseFrom the start of the runway table
Runway record33 bytes36 bytes (3 spare)
Waypoint record48 bytes52 bytes (+ AirportInfoReference)
WAT empty bandsNot statedStart index 0