Global

Members

aisData

Global AIS datas
Source:

aisLayer

Global layer group to manage AIS markers
Source:

gpsMarker

The current GPS marker
Source:

gpsPolyline

The polyline showing the GPS track
Source:

gpsTrack

Array of GPS coordinates for the track
Source:

Methods

addMarker(competitor, index)

Add a marker to competitor
Parameters:
Name Type Description
competitor Object with at least name, lat, lon
index number of competitor.
Source:

addPOI(lat, lon)

Adds a Point of Interest (POI) at the specified latitude and longitude. This function prompts the user to enter a name for the POI using SweetAlert, then adds it to the `POIs` list and places a marker on the map.
Parameters:
Name Type Description
lat number Latitude of the POI.
lon number Longitude of the POI.
Source:

addPorts(geoFileopt)

Load French maritime ports from a GeoJSON file and display them as circle markers on top of the existing Leaflet map.
Parameters:
Name Type Attributes Default Description
geoFile string <optional>
"geo/Port_Maritime_FRA.geojson"
Source:

addWaypoint(lat, lon)

Adds a new waypoint at the specified latitude and longitude. This function appends a new waypoint to `myWayPoints`. If it is the first waypoint, it also updates the boat's heading toward this point.
Parameters:
Name Type Description
lat number Latitude of the new waypoint.
lon number Longitude of the new waypoint.
Source:

additionalInit() → {void}

Perform additional initialization once the base map is ready. This function: - Updates the boat selector UI and adds initial markers for all competitors. - Creates layer groups for isochrones, orthodromic routes and last points. - Sets up various Leaflet event handlers (zoom, move, viewreset, dblclick, mousemove). - Installs a long-press handler on touch devices to open the context menu. - Updates the status bar and coordinates display. - Draws polygons, waypoints, POIs, marks and meters. - Starts periodic GPS and AIS polling if enabled. It assumes that the global `map` object is already initialized (Leaflet map or windy.map).
Source:
Returns:
Type
void

adjustIsoStep()

adjust isoStep value of routparam object return true if value has been changed, false otherwise new isoStep value is choosen in order that: new >= routeParam.isoStep and new >= t = duration / MAX_N.
Source:

aisDump(aisData)

Display AIS data in a Swal2 modal as a spreadsheet-like table.
Parameters:
Name Type Description
aisData Array.<Object> Array of AIS objects to display.
Source:

backWard()

Moves the boat one step backward along its track. Calls `move()` with a negative step value to shift the boat to the previous waypoint.
Source:

bestVmg()

calculate best VMG (Velocity Made Good) when wind is front
Source:

bestVmgBack()

calculate best VMG (Velocity Made Good) when wind is back
Source:

buildBodyRequest(reqType, competitors, myWayPoints, routeParam) → {string}

Builds the request body for sending data to the server.
Parameters:
Name Type Description
reqType string The type of request.
competitors Array List of competitor boats.
myWayPoints Array List of waypoints as [latitude, longitude].
routeParam Object Object containing route parameters.
Source:
Returns:
The formatted request body.
Type
string

button4POI(poi)

Create string that will be shown in POI popup
Parameters:
Name Type Description
poi Object The poi.
Source:

changeParam(routeParam)

Opens a SweetAlert2 modal with two tabs to modify route parameters.
Parameters:
Name Type Description
routeParam Object The object containing route parameters.
Source:

(async) chooseDumpFile(dir)

Choose a file then launch dumpFile
Parameters:
Name Type Description
dir string
Source:

(async) chooseFile(dir, currentFile, byName) → {Promise.<(string|null)>}

Choose a file
Parameters:
Name Type Description
dir string
currentFile string
byName boolean sort by name if true, by date otherwise
Source:
Returns:
le nom du fichier ou null si annulé
Type
Promise.<(string|null)>

(async) chooseGrib(directory, grib)

choose a grib file then launch gribInfo
Parameters:
Name Type Description
directory string
grib string name
Source:

(async) chooseMapMode(formerVal) → {Promise.<number>}

Ask the user which map mode to use (Windy / OSM / Local GeoJSON) using a SweetAlert2 select dialog. The parameter `formerVal` corresponds to the previously selected mode: 0 → MAP_MODE.WINDY 1 → MAP_MODE.OSM 2 → MAP_MODE.LOCAL If `formerVal` is not valid, the default selection will be 0 (Windy).
Parameters:
Name Type Description
formerVal number | string Previous selection value (0, 1, or 2), number or string.
Source:
Returns:
A promise resolving to the selected map mode.
Type
Promise.<number>

(async) choosePolar(directory, current)

choose a polar then launch polarInfo
Parameters:
Name Type Description
directory string
current string polar name
Source:

clearRoutes()

Clears all routes, waypoints, and markers from the map. This function resets the waypoints list, removes all layers and polylines, and clears markers for the destination and computed routes.
Source:

closeContextMenu()

Closes the existing context menu if it is present on the page. This function removes the context menu from the document if it exists, preventing multiple menus from stacking.
Source:

condenseTimeStamps(timeStamps) → {string}

Condense list of time stamps in concise way
Parameters:
Name Type Description
timeStamps Array.<number>
Source:
Returns:
Type
string

consistentDataGrib()

Check consistency between Grib metadatas and datas
Source:

coordStatus()

display information about point (lat, lon)
Source:

createProgressBar(maxValue) → {HTMLProgressElement}

Creates and displays a centered progress bar on the screen. The progress bar is styled to be centered with a gray background and an orange fill. It automatically injects CSS styles the first time it is called.
Parameters:
Name Type Description
maxValue number The maximum value for the progress bar (i.e., the total number of steps).
Source:
Returns:
The created and appended progress element.
Type
HTMLProgressElement

dateToStr(date) → {string}

Converts a Date object to a formatted string: "YYYY-MM-DD HH:MM".
Parameters:
Name Type Description
date Date The Date object to format.
Source:
Returns:
The formatted date string.
Type
string
Example
const now = new Date();
const formatted = dateToStr(now);
console.log(formatted); // "2025-03-29 14:30"

deleteAllPOIs(POIs)

Deletes all POIs from the map, memory and localStorage.
Parameters:
Name Type Description
POIs Array The array of POIs to delete (will be emptied).
Source:

deleteCompetitor(competitor)

Deletes a competitor from the global competitors array. Removes their marker from the map and updates localStorage.
Parameters:
Name Type Description
competitor Object The competitor object to delete.
Source:

deleteCompetitorByName(name)

Delete a competitor by name (used from HTML).
Parameters:
Name Type Description
name string Name of the competitor to delete.
Source:

deletePOI(index)

Deletes a POI by its index in the array. Removes it from the map, from the array, and from localStorage.
Parameters:
Name Type Description
index number Index of the POI to delete
Source:

dispAllCompetitors(result)

Displays a table to compare competitors.
Parameters:
Name Type Description
result Array result - The table with duration info.
Source:

dispBestTimeHistogram(result, start, -tInterval)

Displays a histogram of the best times based on the given report.
Parameters:
Name Type Description
result Array result - The table with duration info.
start Date start - Date of start
-tInterval number Time in seconds between each tentatives
Source:

displayMarks(map, marks)

Add emoji markers for marksVR onto a Leaflet map. - Places at (lat0, lon0) - Shows ONLY the symbol on map (no tooltip) - On click, opens a popup with the `name` (if present) Uses/replaces map._marksLayer to allow redraws.
Parameters:
Name Type Description
map L.Map
marks array
Source:

displayStatRoute(routeData)

Show a SweetAlert2 modal with the route stats (donut chart + summary table).
Parameters:
Name Type Description
routeData Object
Source:

displayWayPoints(competitors, wayPoints)

Displays waypoints and computed distances/courses for each competitor. For each competitor, this function builds a table that includes, for each leg between waypoints: the index, lat/lon, orthodromic course and distance, and loxodromic course and distance. Totals for distances are shown at the bottom in bold red.
Parameters:
Name Type Description
competitors Array.<Object> Array of competitors, each having at least `name`, `lat`, `lon`.
wayPoints Array.<Array.<number>> Array of waypoints, each being [lat, lon].
Source:

dmsToDecimal(dms) → {number}

Converts a coordinate in DMS format to decimal degree".
Parameters:
Name Type Description
dms string The coordinate in DMS format (e.g., "46°24'33"N").
Source:
Returns:
The decimal degrees equivalent of the DMS input.
Type
number

downloadTextFile(filename, content)

Download a text file
Parameters:
Name Type Description
filename string
content string
Source:

downloadTextFile(filename, content)

Download a text file
Parameters:
Name Type Description
filename string
content string
Source:

drawGribLimits(Grib) → {Array}

Draw grib limits
Parameters:
Name Type Description
Grib Object limis
Source:
Returns:
. Bounds of grib
Type
Array

drawOrtho(competitors, myWayPoints)

Draws both theorthodromic (great-circle) routes for a given competitor and waypoints. This function extracts the competitor's starting position, and prepares the orthodromic route.
Parameters:
Name Type Description
competitors Object competitor is an object containing at least name, lat, lon.
myWayPoints Array.<Array.<number>> Array of waypoints as [latitude, longitude] pairs.
Source:

(async) drawPolygons(map, targetLayeropt) → {Promise.<L.LayerGroup>}

Fetch polygons from the API and draw them on a Leaflet map. Expects the server response to be an array of polygons, where each polygon is an array of [lat, lon] points.
Parameters:
Name Type Attributes Description
map L.Map Leaflet map instance.
targetLayer L.LayerGroup | L.FeatureGroup <optional>
Optional layer group to hold polygons. If not provided, a new LayerGroup is created.
Source:
Returns:
Resolves to the layer group containing the polygons.
Type
Promise.<L.LayerGroup>

drawPolyline(coords, color)

Draws a polyline on the map using Leaflet.
Parameters:
Name Type Description
coords Array.<Array.<number>> An array of coordinates where each element is a tuple [latitude, longitude].
color string The color of the polyline.
Source:

drawWind() → {void}

Render wind barbs on the custom Leaflet canvas layer. This function draws a wind field using GRIB data on a canvas placed inside a dedicated Leaflet pane. The canvas is automatically resized and aligned with the current map viewport using geographic bounds (map.getBounds()). For each GRIB grid point, the function: 1. Converts the (lat, lon) coordinate to a Leaflet layer point. 2. Transforms it into the local canvas coordinate system. 3. Applies optional thinning to avoid overdraw at low zoom levels. 4. Draws a wind barb symbol representing U/V wind components. The canvas always stays visually below popups and markers, but above the base map. Wind symbols update automatically when the map moves or zooms. Requirements: - `windCanvas` must be appended to a Leaflet pane via `map.createPane()`. - `dataGrib` must provide `getUVGW(timeIndex, latIndex, lonIndex)`. - `gribLimits` describes grid geometry (lat/lon steps, bounds, sizes). - `drawWindBarb(ctx, x, y, u, v)` must be defined elsewhere. Behavior: - Skips drawing points outside the visible map bounds. - Performs screen-space culling (one barb per 25px grid by default). - Reduces the number of barbs depending on map zoom (via `getWindStride()`). Called automatically from: `map.on('moveend zoomend resize', drawWind)`
Source:
Returns:
Type
void

drawWindBarb()

Draw a wind barb symbol at (x, y). u, v are wind components in m/s (u: east-west, v: north-south). speedMS in m/s is used to compute knots for barbs.
Source:

dumpFile(dir, fileName)

Display raw text file and allow download
Parameters:
Name Type Description
dir string
fileName string
Source:

dumpIsoDesc(route) → {void}

Displays a table of isochrone descriptors from a routing result using SweetAlert2. The table includes the following fields for each isochrone: nIsoc, WayPoint, size, first, closest, bestVmc, biggestOrthoVmc, focalLat (DMS), and focalLon (DMS).
Parameters:
Name Type Description
route Object The JSON object containing isochrone descriptors under `_isodesc`.
Source:
Returns:
Type
void

dumpIsoc(route) → {void}

Displays a table of isochrones from a routing result using SweetAlert2. The table includes the following fields for each point in isochrone: lat, lon, id, father, Index prefixed by the isochrone number
Parameters:
Name Type Description
route Object The JSON object containing isochrones under `_isoc`.
Source:
Returns:
Type
void

dumpRoute(routeData)

Displays a detailed table of the boat's route data in a modal. The table includes step index, latitude, longitude, timestamp, sail number, motor status, speed over ground (SOG), true wind angle (TWA), true wind speed (TWS), gust speed, and wave height.
Parameters:
Name Type Description
routeData Object The complete dataset containing route information.
Source:

epochToStrDate(epoch) → {string}

Convert epoch time (seconds) to a local date string.
Parameters:
Name Type Description
epoch number Epoch time in seconds.
Source:
Returns:
Formatted local datetime.
Type
string

esc()

Escape to HTML
Source:

fPenalty(shipIndex, type, tws, energy, staminaK) → {number}

Compute the penalty in seconds for a manoeuvre type in Virtual Regatta. Depends on true wind speed (tws) and energy. Also computes the stamina coefficient.
Parameters:
Name Type Description
shipIndex number Index of the ship in ship parameters.
type number Type of manoeuvre (0, 1, or 2).
tws number True wind speed in knots.
energy number Current energy (0 to 100).
staminaK object stamina coefficient.
Source:
Returns:
Penalty time in seconds, or -1 if the type is invalid.
Type
number

fPointLoss(shipIndex, type, tws, fullPack) → {number}

Compute the point loss for a manoeuvre in Virtual Regatta. Depends on true wind speed (tws) and whether the full pack is active.
Parameters:
Name Type Description
shipIndex number Index of the ship in ship parameters.
type number Type of manoeuvre (0, 1, or 2).
tws number True wind speed in knots.
fullPack boolean Whether the full pack option is active.
Source:
Returns:
Point loss.
Type
number

fTimeToRecupOnePoint(tws) → {number}

Compute the time in seconds needed to recover one energy point, depending on true wind speed.
Parameters:
Name Type Description
tws number True wind speed in knots.
Source:
Returns:
Time in seconds to recover one energy point.
Type
number

feedback(apiUrl)

Displays a feedback form using SweetAlert2 and sends the data as plain text.
Parameters:
Name Type Description
apiUrl string The API endpoint where the feedback will be sent.
Source:

fetchAisPosition()

Fetches the current AIS information from the local server. Uses a timeout to prevent hanging if the server is unresponsive.
Source:

fetchGpsPosition()

Fetches the current GPS position from the local server. Uses a timeout to prevent hanging if the server is unresponsive.
Source:

(async) finalUpdate(boatName)

Update display after getting server response.
Parameters:
Name Type Description
boatName String boatName - the name of boat or competitor.
Source:

findBounds(wayPoints)

Determines the bounding box for a given set of waypoints. This function calculates the minimum and maximum latitude/longitude values to define the bounding box that encloses the route.
Parameters:
Name Type Description
wayPoints Array.<Array.<number>> An array of waypoints as [latitude, longitude] pairs.
Source:

findMaxSpeed()

calculate max and twa at max values
Source:

findNearestPort(lat, lon) → {Object}

Finds the nearest port to the given latitude and longitude. Uses the `orthoDist()` function to compute the orthodromic (great-circle) distance. If the coordinates are outside the defined bounding box, returns LE_POULIGUEN as default.
Parameters:
Name Type Description
lat number Latitude in decimal degrees.
lon number Longitude in decimal degrees.
Source:
Returns:
An object containing the ID and name of the nearest port.
Type
Object

findTimeAround()

return iTInf and iTSup in order t : gribLimits.timeStamps[iTInf] <= t <= gribLimits.timeStamps[iTSup]
Source:

forWard()

/** Moves the boat one step forward along its track. Calls `move()` with a positive step value to shift the boat to the next waypoint.
Source:

formatDuration(seconds) → {string}

Formats a duration given in seconds into a human-readable string.
Parameters:
Name Type Description
seconds number The duration in seconds.
Source:
Returns:
- The formatted duration as "X Days HH:MM:SS".
Type
string

formatDurationShort(seconds) → {string}

Formats a duration given in seconds into a human-readable string.
Parameters:
Name Type Description
seconds number The duration in seconds.
Source:
Returns:
- The formatted duration as "HH:MM:SS".
Type
string

formatLocalDate(date) → {string}

Formats a date into a human-readable string with the weekday, date, and local time. Example output: "Saturday, 2025-03-08 22:44 Local Time"
Parameters:
Name Type Description
date Date The date object to format.
Source:
Returns:
The formatted date string.
Type
string

generatePolarPlotly(data, sailData, legend)

draw with plotty information about polar
Parameters:
Name Type Description
data Object polar information
sailData Object sail polar information
legend Object sail polar legend
Source:

getDateFromIndex(index) → {Date}

Give the date associated with index
Parameters:
Name Type Description
index number Inde
Source:
Returns:
The date should consider the case with waypoints that influence time
Type
Date

getGreatCirclePath(lat0, lon0, lat1, lon1, nopt) → {Array.<Array.<number>>}

Computes the great-circle path (orthodromic route) between two geographical points. This function calculates a series of intermediate points along the shortest path between two locations on the Earth's surface, using spherical interpolation.
Parameters:
Name Type Attributes Default Description
lat0 number Latitude of the starting point, in degrees.
lon0 number Longitude of the starting point, in degrees.
lat1 number Latitude of the destination point, in degrees.
lon1 number Longitude of the destination point, in degrees.
n number <optional>
100 Number of intermediate points to compute along the path.
Source:
Returns:
The great-circle path as an array of coordinate pairs [latitude, longitude].
Type
Array.<Array.<number>>

getLocalUtcOffsetInSeconds() → {number}

Returns the current local time offset from UTC in seconds. This function calculates the difference between the local time and Coordinated Universal Time (UTC), taking into account daylight saving time if applicable.
Source:
Returns:
The offset in seconds. Positive if local time is ahead of UTC, negative if behind.
Type
number

(async) getMarks(map)

Fetch marks from the API and initialize marks Expects the server response to be an array of marks, where each mark is an object {what, name, id, lat0, lon0,, lat1, lon1, status}
Parameters:
Name Type Description
map L.Map Leaflet map instance.
Source:

getParam()

get a subset of parameters on server, after launching fetch request to server initialize associated values
Source:

getSerializablePOIs()

Extract subset of POI information (no marker) useful for state management
Source:

getServerInit()

Get Grib name from server, fit map in grib bounds and display init Info
Source:

getTextColorFromLuminance(luminance) → {string}

Returns a suitable text color ("black" or "white") for a given background luminance. This ensures good readability based on the brightness of the background color.
Parameters:
Name Type Description
luminance number A number between 0 (darkest) and 255 (brightest),luminance of the background color.
Source:
Returns:
"white" if the background is dark, "black" otherwise.
Type
string

goBegin()

Resets the boat's position to the beginning of its track. This function sets the index to 0 and moves the boat to the first waypoint, ensuring time and position are updated accordingly.
Source:

goEnd()

Moves the boat to tthe end its track. Calls `move()` with final index to mùove the boat the the end of track.
Source:

gribCheck()

request Grib check from server
Source:

(async) gribInfo(directory, current)

display meta information about remote grib file update gribLimits object
Parameters:
Name Type Description
directory string
current string grib name
Source:

(async) gribLoad(dir, model, gribName, nTime, nLat, nLon) → {Promise.<{values: Float32Array, getUVGW: function(number, number, number): {u:number, v:number, g:number, w:number}, indexOf: function(number, number, number): number, nLat: number, nLon: number, nTime: number, nShortName: number, shortnames: string}>}

Loads GRIB wind data from the server using a POST request, retrieves the binary response (u, v, g, w components), and returns utilities to access the data. The server returns a variable number of components per grid point depending on the `X-Shortnames` HTTP header. Supported combinations are: - "uv" → 2 components - "uvg" → 3 components - "uvw" → 3 components - "uvgw" → 4 components The binary payload is decoded into a Float32Array in the following fixed order: u, v, (g if present), (w if present)
Parameters:
Name Type Description
dir string Directory containing the GRIB file (ignored if `model` is provided).
model string | null Weather model identifier (e.g., "GFS"), or `null` to load a GRIB file from disk.
gribName string Name of the GRIB file (used only when `model === null`).
nTime number Number of time steps in the GRIB dataset.
nLat number Number of latitude points in the grid.
nLon number Number of longitude points in the grid.
Source:
Throws:
If the HTTP request fails or returns a non-200 status.
Type
Error
Returns:
Resolves to an object containing: - **values**: the raw Float32Array of decoded binary GRIB data. - **getUVGW(t, iLat, iLon)**: retrieves {u, v, g, w} at a given grid position. - **indexOf(t, iLat, iLon)**: returns the base index in the Float32Array. - **nLat**, **nLon**, **nTime**: grid dimensions. - **nShortName**: number of components per point (2, 3, or 4). - **shortnames**: exact shortname string from the HTTP header.
Type
Promise.<{values: Float32Array, getUVGW: function(number, number, number): {u:number, v:number, g:number, w:number}, indexOf: function(number, number, number): number, nLat: number, nLon: number, nTime: number, nShortName: number, shortnames: string}>

(async) gribMetaAndLoad(directory, current)

download meta information about remote grib file update gribLimits object launch download binary grib datas
Parameters:
Name Type Description
directory string
current string grib name
Source:

(async) handleRequest(requestBody)

Launch HTTP request using fetch, with the request body .
Parameters:
Name Type Description
requestBody String requestBody - the request body.
Source:

hasName(name) → {boolean}

Check if a name is non-empty after trimming.
Parameters:
Name Type Description
name string
Source:
Returns:
Type
boolean

(async) helpInfo()

Display help Info Retrieve some info from server
Source:

importCSV(file, competitors)

Imports competitor positions from a Virtual Regatta Dashboard CSV file. - Matches competitors from the given list by name (fuzzy match). - Extracts coordinates (lat/lon) and other sailing data (TWS, speed, sail, etc.). - Displays a confirmation table in a SweetAlert2 popup. - If confirmed, updates the corresponding competitors' `lat` and `lon`.
Parameters:
Name Type Description
file File The CSV file selected by the user.
competitors Array The current list of competitors to update.
Source:

initMapAccordingToMode() → {void}

Initialize the map depending on the chosen mode. Modes are defined in the global `MAP_MODE` enum: - MAP_MODE.WINDY: use Windy API (online), map is provided by Windy. - MAP_MODE.OSM: use Leaflet with OpenStreetMap and OpenSeaMap layers. - MAP_MODE.LOCAL: use Leaflet with a local GeoJSON land polygons layer. For OSM and LOCAL, this function creates the Leaflet map and then calls `additionalInit()` to setup generic layers and event handlers. For WINDY, it delegates to `loadWindyAndInit()`.
Source:
Returns:
Type
void

initMapGeoJson(containerId) → {void}

Initialize a Leaflet map using a local GeoJSON file as a land "base layer" instead of remote OpenStreetMap / OpenSeaMap tiles. The created Leaflet map is stored in the global `map` variable and a canvas pane for wind rendering (`windPane` + `windCanvas`) is added on top of the map. The GeoJSON file is loaded from `geo/land_polygons.geojson` and used to draw land polygons; the view is then fitted to the GeoJSON bounds.
Parameters:
Name Type Description
containerId string DOM element id that will host the Leaflet map.
Source:
Returns:
Type
void

initMapOSM(containerId) → {void}

Initialize a Leaflet map using OpenStreetMap as base layer and OpenSeaMap seamarks as overlay. The created Leaflet map is stored in the global `map` variable and a canvas pane for wind rendering (`windPane` + `windCanvas`) is added on top of the map.
Parameters:
Name Type Description
containerId string DOM element id that will host the Leaflet map.
Source:
Returns:
Type
void

initServer()

Re-init one server
Source:

interpolate()

interpolate
Source:

interpolateSpeeds()

interpolate speeds
Source:

lastStepDurationFormatted(durationArray) → {string}

Formats an array of durations (in seconds) into a single string separated by commas.
Parameters:
Name Type Description
durationArray Array.<number> An array of durations in seconds.
Source:
Returns:
A comma-separated string of formatted durations.
Type
string

latLonToStr(lat, lon) → {string}

Converts latitude and longitude to a formatted string. DMS (Degrees, Minutes, Seconds) string ex: 45°28'30 S" or DM (Degrees, Minutes) ex: 45°28.5 S' string or DD (Decimal Degrees) ex: 45.48° S string or BASIC ex -45.48 (with sign if negative)
Parameters:
Name Type Description
lat number The latitude in decimal degrees.
lon number The longitude in decimal degrees.
Source:
Returns:
The coordinates formatted as a DMS string (e.g., "48°51'24\"N, 2°21'03\"E").
Type
string

launchRouting()

Displays a SweetAlert2 modal for routing configuration. Loads current values from routeParam and allows reset to defaults.
Source:

loadAppState()

Loads competitors and polarName from localStorage, if available. Recreates dynamic Leaflet objects like markers and polylines.
Source:

loadWindyAndInit() → {void}

Dynamically load the Windy libBoot script and initialize the Windy API. Once the script is loaded, this function: - Calls `windyInit(options, ...)`, - Stores the Windy API object in the global `windy`, - Retrieves the Leaflet map and store (`windy.map`, `windy.store`) into globals, - Normalizes the timestamp and subscribes to timestamp changes, - Calls `additionalInit()` to perform generic map setup (markers, layers, events...). If the script cannot be loaded (offline or network issue), a SweetAlert error is shown.
Source:
Returns:
Type
void

loxoCap(lat0, lon0, lat1, lon1) → {number}

Computes the initial loxodromic (rhumb line) bearing from one point to another.
Parameters:
Name Type Description
lat0 number The latitude starting point
lon0 number The longitude starting point
lat1 number The latitude destination point
lon1 number The longitude destination point
Source:
Returns:
Initial bearing in degrees from 0 to 360.
Type
number

loxoDist(lat0, lon0, lat1, lon1) → {number}

Calculates the loxodromic (rhumb line) distance between two points.
Parameters:
Name Type Description
lat0 number The latitude starting point
lon0 number The longitude starting point
lat1 number The latitude destination point
lon1 number The longitude destination point
Source:
Returns:
Distance in nautical miles.
Type
number

(async) manageCompetitors(competitors)

Displays a modal to manage a list of competitors, allowing editing, adding, and removing entries.
Parameters:
Name Type Description
competitors Array An array of competitors, where each entry is [name, lat, lon, colorIndex].
Source:

meteoGram(lat, lon, data)

Display a meteogram with wind, gust and waves using SweetAlert2 and Plotly.
Parameters:
Name Type Description
lat number Latitude in degrees of the queried point.
lon number Longitude in degrees of the queried point.
data Object Meteo data object returned by the server.
Properties
Name Type Description
isSea boolean True if point is sea.
isSeaTolerant boolean True if point is sea tolerant.
inWind boolean True if point is inside wind domain.
inCurrent boolean True if point is inside current domain.
epochGribStart number Epoch time (seconds) of first row.
meteoArray Array.<Array.<number>> Rows of [u, v, g, w].
Source:

meters(map)

Initialize the orthodromic measuring tool on a Leaflet map. - Press 'M' to toggle measure mode on/off. - Click to add waypoints. - Draws great-circle (orthodromic) path between waypoints. - Shows cumulative distance (km + NM) and last leg initial bearing.
Parameters:
Name Type Description
map L.Map The Leaflet map instance.
Source:

move(firstTrack, n)

Moves the boat along its track by a given step. This function updates the boat's position based on the given track and step count. It adjusts the index within valid bounds, updates the boat's marker position, and updates the Windy map timestamp accordingly.
Parameters:
Name Type Description
firstTrack Array.<Array.<number>> The array of waypoints, where each waypoint is [latitude, longitude].
n number The step count to move forward (positive) or backward (negative).
Source:

newCompetitor()

Adds a new competitor with user input for name and selecting color by click.
Source:

orthoCap(lat0, lon0, lat1, lon1) → {number}

Computes the initial orthodromic (great-circle) bearing from one point to another. This function calculates the initial heading (bearing) in degrees required to travel from the first point (lat0, lon0) to the second (lat1, lon1) along a great-circle route.
Parameters:
Name Type Description
lat0 number The latitude starting point
lon0 number The longitude starting point
lat1 number The latitude destination point
lon1 number The longitude destination point
Source:
Returns:
The initial bearing in degrees, ranging from 0 to 360°.
Type
number

orthoDist(lat0, lon0, lat1, lon1) → {number}

Calculates the orthodromic (great-circle) distance between two points.
Parameters:
Name Type Description
lat0 number The latitude starting point
lon0 number The longitude starting point
lat1 number The latitude destination point
lon1 number The longitude destination point
Source:
Returns:
Distance in nautical miles.
Type
number

parDump()

display parameter file, after launching fetch request to server
Source:

playAnim()

Moves the boat continuously along its track.
Source:

polarInfo(polarName)

Provide information about polar file
Parameters:
Name Type Description
polarName string name of polar
Source:

popup4Comp(poi)

Create string that will be shown in boat (compertitor) popup
Parameters:
Name Type Description
poi Object The poi.
Source:

(async) promptForCreds()

SweetAlert2 prompt for credentials
Source:

refreshMarker(competitor, index)

Recreate a marker for competitor
Parameters:
Name Type Description
competitor Object with at least name, lat, lon
index number of competitor.
Source:

removeCompetitor(index)

Removes a competitor from the list, ensuring at least one remains.
Parameters:
Name Type Description
index number The index of the competitor to remove.
Source:

renderMarksTable(marksArray, decimals) → {string}

Render marks as a simple HTML table.
Parameters:
Name Type Description
marksArray Array.<MarkVR>
decimals number
Source:
Returns:
Type
string

(async) replay()

Replay the routing request: 1. Displays an empty input box to paste a query manually. 2. Parses the input into `routeParam`, `myWayPoints`, and `competitors`. 3. Triggers the `request()` function.
Source:

request()

Prepare routing API call. Depending on routeParameter, select between requestBestTime, requestAllCompetitors or requestOne
Source:

(async) requestAllCompetitors()

Constructs and prepares the request body for a routing API call. Request for all boats, at startTime.
Source:

(async) requestBestTime()

Constructs and prepares the request body for a routing API call. Request for only one boat, at different time defined by routeParam.
Source:

(async) requestOne()

Constructs and prepares the request body for a routing API call. Request for anly one boat, one time
Source:

(async) requestTwo()

Constructs and prepares the request body for two outing API call. First is an estimation with big time step Second is with timestep as requested by user Request for only one boat, one time
Source:

resetWaypoint()

Resets all waypoints and clears related map elements. This function removes all stored waypoints, clears the loxodromic and orthodromic routes, and removes the destination marker if it exists.
Source:

saveAppState()

Saves the current state of competitors and polarName to localStorage. Only simple serializable fields are stored (name, lat, lon, color).
Source:

setBoat(competitor, lat, lon)

Updates the boat's position to the specified latitude and longitude. This function moves the selected competitor to the given coordinates, updates its map marker, and redraws the orthodromic route. If waypoints exist, it also updates the boat's heading.
Parameters:
Name Type Description
competitor Object is an object containing at least name, latitude, longitude.
lat number New latitude of the boat.
lon number New longitude of the boat.
Source:

showAIS(aisData)

Show AIS targets on the Windy map, replacing previous ones.
Parameters:
Name Type Description
aisData Array.<Object> Array of AIS data objects.
Source:

showBoatPosition(gpsData, gpsData["alt M"]opt)

Displays the current GPS position on the map. Updates the marker, popup, and the track polyline.
Parameters:
Name Type Attributes Description
gpsData Object The GPS data in JSON format.
Properties
Name Type Description
lat number Latitude in decimal.
lon number Longitude in decimal.
time string UTC time string.
gpsData["alt M"] number <optional>
Altitude in meters (optional).
gpsData.sog number Speed over ground.
gpsData.cog number Course over ground.
gpsData.numSat number Number of satellites.
Source:

showContextMenu(e)

Displays a custom context menu at the mouse click position. This function retrieves the latitude and longitude from the event, creates a new context menu element, and positions it based on the mouse's screen coordinates.
Parameters:
Name Type Description
e Object The event object containing the click position and map coordinates.
Properties
Name Type Description
latlng Object The latitude and longitude of the clicked point.
Properties
Name Type Description
lat number The latitude of the clicked location.
lng number The longitude of the clicked location.
originalEvent Object The original DOM event containing screen coordinates.
Properties
Name Type Description
clientX number The X coordinate of the click event on the screen.
clientY number The Y coordinate of the click event on the screen.
Source:

showDestination(lat, lon)

Add destination at the specified latitude and longitude.
Parameters:
Name Type Description
lat number Latitude of the destination.
lon number Longitude of the destination.
Source:

showGpxRoute()

getch GPX server route
Source:

showInitMessage()

Get Grib name from server, fit map in grib bounds and display init Info UNUSED
Source:

showLastPointInfo()

show information around last point on map
Source:

showMarks(marks)

Show the marks array in a SweetAlert2 modal as a table.
Parameters:
Name Type Description
marks Array.<MarkVR>
Source:

showPOI(POIs)

Show points of interest
Parameters:
Name Type Description
POIs Array List of POIs.
Source:

showPolarTable(data)

dump polar information about polar
Parameters:
Name Type Description
data Object polar information
Source:

showRoute(The, Name)

Show route in color associated to the competitor
Parameters:
Name Type Description
The Object route
Name string of boat (idem competitor)
Source:

showRouteReport(routeData)

Displays a graphical representation of the route data using Plotly.
Parameters:
Name Type Description
routeData Object The dataset containing route information.
Source:

showWayPoint(wayPoints)

Show point waypoints and destination Give the right direction to boats toward first waypoint if requested
Parameters:
Name Type Description
wayPoints Array List of waypoints as [latitude, longitude].
Source:

simplify(coords, tolerance) → {Array.<Array.<number>>}

Simplifies a list of coordinates by removing points that are too close to each other. This uses a simple radial distance simplification method.
Parameters:
Name Type Description
coords Array.<Array.<number>> Array of coordinates [latitude, longitude].
tolerance number The distance tolerance for simplification (in degrees).
Source:
Returns:
A simplified array of coordinates.
Type
Array.<Array.<number>>

stamina()

Opens a SweetAlert2 modal acting as a live stamina & penalty calculator for Virtual Regatta. This function creates a well-aligned UI with: - A dropdown for boat type. - Sliders for TWS and Energy with value display. - A Full Pack checkbox. - Calculated recovery time. - A table showing Time To Manoeuvre and Energy Point Lossed for Tack, Gybe, and Sail. Updates are live on any user interaction.
Source:

statChanges(track) → {Object}

Calculates the number of sail changes and tack/gybe transitions (amure changes) from a given sailing track. A sail change is detected when the `sail` value changes between two consecutive steps. An amure change is detected when the sign of the True Wind Angle (`twa`) changes, indicating a tack or gybe (crossing the wind).
Parameters:
Name Type Description
track Array.<Array.<number>> The sailing track, where each entry is an array containing [lat, lon, dist, sog, twd, tws, hdg, twa, g, w, stamina, sail, motor].
Source:
Returns:
An object with the number of sail changes and amure changes detected in the track.
Type
Object

statRoute(track, containerId) → {Object}

Analyze a sailing track and render a pie/donut chart of time spent on each point of sail.
Parameters:
Name Type Description
track Array Array of points, each point shaped like: [indexWp, lat, lon, time, dist, sog, twd, tws, hdg, twa, g, w, stamina, sail, motor]
containerId string DOM element id where the Plotly chart will be drawn
Source:
Returns:
stats - Raw stats including time buckets and totalTime
Type
Object

stopAnim()

Stops boatsboat
Source:

switchTab(event, tabId)

Handles tab switching inside the Swal modal.
Parameters:
Name Type Description
event Event The click event.
tabId string The ID of the tab to activate.
Source:

symbolFromWhat(what) → {string}

Return the symbol (emoji) to use for a given `what`. Falls back to 'x' for Invisible/unknown.
Parameters:
Name Type Description
what string
Source:
Returns:
Type
string

symmetrizeData()

Symetries polar data
Source:

totalDistWayPoints()

calculate distance from boat to destination through waypoints
Source:

updateAllBoats()

Common part of goBegin, backWard and forWard. This function calls move for all relevant competitors
Source:

updateBindPopup()

Update bind popup
Source:

updateBoatSelect()

Updates the boat selection logic after competitors are added/removed. Adjusts routeParam.iBoat accordingly to ensure a valid selection.
Source:

updateDMS()

Set DMS Degree Minute Second Display style update global DMSType variable
Source:

updateHeading(firstTrack)

Updates the boat's heading based on its current and next position. This function calculates the bearing (heading) between the current position and the next point in the track, and updates the boat's marker rotation.
Parameters:
Name Type Description
firstTrack Array.<Array.<number>> The array of waypoints, where each waypoint is [latitude, longitude].
Source:

updateIconStyle()

Updates the icon rotation based on the boat's heading. This function checks if a marker exists and retrieves its heading attribute. If the icon does not already have a rotation applied, it modifies the CSS `transform` property to rotate the marker according to its heading.
Source:

updateRouteDisplay(selectedTimestamp)

Updates the boat's position and marker based on the selected timestamp from Windy. This function calculates the corresponding index in the route data based on the selected timestamp, updates the boat's position, and moves the marker accordingly.
Parameters:
Name Type Description
selectedTimestamp number The selected timestamp (in seconds) from Windy's timeline.
Source:

updateStatusBar(routeopt)

Updates status bar information and calculates bounds. If no route is provided, it updates general parameters such as the polar name and GRIB file.
Parameters:
Name Type Attributes Default Description
route Object | null <optional>
null The route object containing navigation data, or `null` to update global info.
Source:

updateToolsVisibility()

Give visibility to tool bars only when route is active.
Source:

updateWindyMap(route, isocArrayopt)

Updates the Windy map by displaying the calculated route and optional isochrones.
Parameters:
Name Type Attributes Default Description
route Array.<Array.<number>> The main sailing route as an array of coordinate pairs [latitude, longitude].
isocArray Array.<Array.<number>> <optional>
[] An optional array of isochrones, where each isochrone is a list of coordinate pairs.
Source: