Print and Export - msupino/NavigationApp GitHub Wiki

🇮🇱 עברית

Print and Export

NavAid produces five things you might want to save or print:

  1. A PNG of the map + route, framed for A3 or A4.
  2. A flight plan table, sent to your printer / saved as PDF.
  3. A route file (JSON / GPX / PLN / FDR) you can re-load, share, fly in a sim, or version-control.
  4. A Google Earth tour (KML) you can fly through.
  5. A profile PNG of a saved route or a recording — see GPS track recording.

On a phone, "download" means the share sheet. An Android WebView has no download manager behind an <a download>, so every export in the APK used to be swallowed silently. Files now leave through one path: the browser's own download in a browser, and the system share sheet on a native shell — which is how a file reaches Drive, mail or WhatsApp. Nothing else about the formats changes. (An APK older than that release says so rather than doing nothing.)

1. PNG of the framed map

Setting the frame

  1. Click A4, A3 or A4×2 in the Print section of the toolbar.
  2. Orientation comes from the inline ▭/▯ toggle next to A3 / A4 — click it to flip between landscape and portrait. Default is landscape and the choice persists across reloads.
  3. A dashed page-frame rectangle appears on the map. Drag it to position your route inside it.
  4. Tap the same size button again to clear the frame.

Or skip steps 1-3: with a route drawn, Fit page to route in the print panel picks the smallest sheet that holds the route and centres it. It no longer waits for a size to be chosen by hand — choosing the size is what it does. It stays disabled only when there is no route, or when no sheet is big enough (the panel says which).

📍 Location and a recording take the frame off too (a short message says so): a position on the map is flying, not printing. Pick A4 / A3 again to print.

🗑 Clear map takes the frame with the route: the sheet was chosen to hold that route, so the next flight does not begin inside paper picked for a different one.

A4×2 — an A3 map from two A4 pages

Long routes (e.g. Herzliya → Rosh Pina) fit A3 at 1:250 000 but not a single A4 — and an A3 printer isn't always available. A4×2 draws the A3-size frame, and ⬇ Save PNG slices the rendered A3 into two A4 pages at the same scale (A3 is exactly two A4s):

  • ▭ Landscape frame → two upright portrait A4 pages, side-by-side (LEFT / RIGHT). Print with default settings.
  • ▯ Portrait frame → two landscape A4 pages, stacked (TOP / BOTTOM). Pick Landscape in the print dialog.
  • The files are WYSIWYG — each is exactly its half of the on-screen frame. Each page carries a PAGE n OF 2 label and a dashed cut/tape guide on the shared edge; DPI metadata is set so both print true-size.
  • Files: navigation-A4x2-p1of2-<timestamp>.png and …p2of2….
  • Print both, trim/overlap at the dashed edge, tape → a true A3 chart at 1:250 000.
  • Print with A4×2 opens one print window with both pages, page 1 then page 2, each sized to A4; Save PNG downloads the two files.

Saving

  • Click ⬇ Save PNG.
  • The chart + your route is composited at the chosen layer's maximum practical native tile zoom (e.g. z13 for CVFR), not the on-screen zoom - so the export is print-sharp even if your map view is zoomed out.
  • Export pulls each layer's CORS-enabled export tiles from navaid-tiles.supino.org; OSM and Esri tiles support CORS directly.
  • Print makes the very same image and opens it in a print window sized to the paper, so it comes out at 1:250 000 — the PNG and the print are the same.
  • A progress panel at the foot of the screen shows the tiles fetched (Fetching the map: 464 / 494 tiles · 2 s, with a bar) and then Composing the page…, until the file is saved. Map interaction is locked during the export so tiles and overlays stay aligned. Tiles are fetched 16 at a time, each tried once more if it fails.

Image quality

A three-step Image quality slider in the dialog — Low · Medium · High, Medium by default, remembered on this device:

Page (1:250 000) Low Medium High
A4 ~197 dpi ~295 dpi ~394 dpi
A3 ~197 dpi ~295 dpi ~394 dpi
No page chosen 1× the screen (96 dpi) 1.5× (144 dpi) 2× (192 dpi)
  • High draws from the chart's sharpest tiles (z13 for CVFR and Navigation), Medium at three quarters of that, Low at half — from a level coarser, a quarter of the tiles, so it is quick.
  • The limit is the largest image the browser can hold: Safari (iPhone / Mac) about 16.7 M pixels, the APK / Android 32 M (a phone's memory), a computer 48 M. A page larger than that is scaled down smoothly, never a whole level coarser. So on Safari an A3 at High is about 288 dpi.
  • A rotated map is cut from an upright square of map that contains the page — largest around 45°, back to the page itself at 90° — so where that square meets the limit, quality drops a little: on a computer only an A3 at High (394 at 0° and 90°, ~347 at 45°); on Safari more.
  • A High A3 takes about 15 s and the PNG is about 37 MB.

Quality notes

  • The export preserves the on-screen map bearing and restores interaction when done.
  • The Map opacity slider is applied to the exported base map; route labels, notes, Navigation Waypoints, and Airfields remain full opacity.
  • Optimized for a black-and-white printer (a checkbox in the dialog, remembered on this device): the chart is printed in pale grey and the route in black on white — white kites, labels, waypoints and notes with black text and borders; black waypoint rings, airfields, VORs and frequency callouts; the way home in light grey so it stays told apart from the way out. On a mono printer the colours of the normal print turn into similar greys that sink into the chart; this keeps the route standing out. It applies to the saved PNG and to Print alike; the map on screen stays in colour.
  • Enabled Show Navigation Waypoints, Show Airfields, and route frequency callouts are included in the PNG overlay.
  • The View-section Legend is interface chrome and is not included in PNG export.
  • flight-maps.com tile requests are clipped to the published chart bounds. HTTP 404 tiles outside coverage are skipped silently as blank chart area; real failures still trigger a warning.

2. Flight plan print

See Flight Plan. The Print button on the modal sends the table to your printer / OS print-to-PDF. Only the plan prints — not the app around it — with its ETA column and the last-light / opening-hours lines.

Nav log (PDF) opens the print dialog directly (in the Android app, Android's own print); it no longer opens a separate tab.

CSV export

The Flight Plan modal also has a CSV button that downloads the same table as a spreadsheet file, named flight-plan-<timestamp>.csv.

  • One row per leg, with the same columns as the on-screen table.
  • Written as UTF-8 with a leading byte-order mark (BOM) so Hebrew column headers and waypoint names open correctly in Excel.
  • CRLF line endings and standard CSV quoting for cells containing commas, quotes, or newlines.

3. Route files (JSON / GPX / PLN / FMS / FDR)

  • ⬇ Export is a format dropdown — pick one and the file downloads, then the dropdown resets to its placeholder:
    • JSON — route-<timestamp>.json with the entire route + notes (NavAid native).
    • GPX — route-<timestamp>.gpx with one <rtept> per waypoint and per-leg altitude as <ele> (metres).
    • PLN — route-<timestamp>.pln, an MSFS / FSX flight plan (AceXML). One <ATCWaypoint> per waypoint (Airport type at known airfields, User elsewhere), a DMS <WorldPosition>, and departure / destination metadata. AppVersionMajor is 12 so Microsoft Flight Simulator 2024 accepts the file.
    • FMS — route-<timestamp>.fms, an X-Plane 12 flight plan (v11/1100 text format) with the current AIRAC cycle. Recognised airfields keep their ICAO identifiers; reporting points are written as coordinate waypoints, because they may not exist in X-Plane's own navigation database.
    • FDR — route-<timestamp>.fdr, an X-Plane flight-data-recorder replay track.
  • ⬆ Import — load JSON, GPX, or PLN (dispatched by file extension):
    • JSON — strict validation: all documented fields are required and correctly typed, legs.length must equal waypoints.length - 1, extras allowed.
    • GPX — reads <rtept> points.
    • PLN — reads each ATCWaypoint's DMS WorldPosition (decimal lat,lng accepted as a fallback), names waypoints from ICAOIdent.
    • File size is capped at 2 MB before parsing.
    • An opened route replaces the one on the map, and NavAid asks first — in its own dialog, only when there is a plan to lose (waypoints or notes). Saying no leaves the map untouched. The same question now guards every door a route arrives through: this Open, a saved route from the library, a route shared over Follow Me, and an exercise file opened into the planning form.
  • If a saved localStorage["navaid.route"] blob is invalid or corrupt, NavAid warns and preserves the original value instead of overwriting it with empty state.

JSON schema (simplified)

{
  "waypoints": [
    { "lat": 32.084, "lng": 34.778, "name": "TLV" }
  ],
  "legs": [
    { "inboundAltitude": 3000, "outboundAltitude": 3000, "flightSpeed": 90,
      "inLabel":  { "a": 0, "p": 44 },
      "outLabel": { "a": 0, "p": -44 } }
  ],
  "notes": [
    { "lat": 32.55, "lng": 35.55, "text": "climb 4500ft",
      "color": "#ffd84a", "shape": "rect" }
  ]
}

Per-leg flightSpeed (kt) and inboundAltitude / outboundAltitude (ft MSL) live on the leg, not the waypoint. inLabel / outLabel are leg-marker offsets - a (along the leg) and p (perpendicular distance in px) - used by the renderer.

4. Google Earth KML

  • ✈️ Open route in Google Earth writes a .kml containing a gx:Tour.
  • The camera uses planned per-leg altitudes as MSL (absolute). If all leg altitudes are blank, it uses the 800 ft AGL/field-elevation fallback and may use relativeToGround.
  • The route line and waypoints are clamped to the ground.
  • Camera tilt is fixed at 70°.
  • Open the saved file in Google Earth Pro (desktop) for the tour; mobile clients accept the file but don't always play gx:Tour.

See Google Earth for the full step-by-step guide, KML schema, and troubleshooting.

⚠️ **GitHub.com Fallback** ⚠️