Simulation Instruments

Home›All functions›Map and video

Map and video

Simulation Instrument Studio 1

map_add

Simulation Instrument Studio 1

Overloads

map_add(x,y,width,height,source,zoom)

A map node. It draws tiles for a lat, lon, and zoom.

Parameters

#NameTypeDescription
1xNumberThis is the most left point of the canvas where your map should be shown.
2yNumberThis is the most top point of the canvas where your map should be shown.
3widthNumberThe map width in pixels.
4heightNumberThe map height in pixels.
5base_layerStringThe openstreetmap base layer to use. See available base layers below. Use 'nil' if you don't want any base layer at all.
6zoomNumberThe openstreemap zoom level. This value can normally range from 1 (whole earth) to 16 (closest to earth). This value is dependent on the base layer source type defined above.

Base layers

TagNameZoom
OSM_STANDARDOpenStreetMap1–17
OSM_CYCLECycle map1–17
OSM_TRANSPORTTransport map1–17
OSM_HUMANITARIANHumanitarian map1–17

Example

-- Moving map, cycle layer, zoomed to a city
chart = map_add(0, 0, 400, 300, "OSM_CYCLE", 11)
Photo slot: shots/map_add.png

map_add_nav_canvas_layer

Simulation Instrument Studio 1

Overloads

map_add_nav_canvas_layer(map_id, nav_type, x, y, width, height, draw_callback)

A map node. It draws tiles for a lat, lon, and zoom.

Parameters

#NameTypeDescription
1map_idNumberThe map_id to add the layer to. A map_id can be fetched by using function map_add.
2nav_typeStringThe NAV type to query, see the NAV types page.
3xNumberThe x pixel offset of where the canvas should be shown.
4yNumberThe y pixel offset of where the canvas should be shown.
5widthNumberThe desired width of the canvas.
6heightNumberThe desired height of the canvas.
7draw_callbackStringThis function will be called on a redraw of the canvas.

Example

-- Draw our own range ring on the map
rings = map_add_nav_canvas_layer(chart, function()
    _circle(200, 150, 60)
    _stroke("#7eb6ff", 2)
end)
Photo slot: shots/map_add_nav_canvas_layer.png

map_add_nav_img_layer

Simulation Instrument Studio 1

Overloads

map_add_nav_img_layer(map_id, nav_type, filename, x, y, width, height)

A map node. It draws tiles for a lat, lon, and zoom.

Parameters

#NameTypeDescription
1map_idNumberThe map_id to add the layer to. A map_id can be fetched by using function map_add.
2nav_typeStringThe NAV type to show in this layer, see the NAV types page.
3filenameNumberThe filename of the image to show at every NAV point.
4xNumberThe x pixel offset of where the image should be shown. This is relative to the NAV point itself.
5yNumberThe y pixel offset of where the image should be shown. This is relative to the NAV point itself.
6widthNumberThe desired width of the image.
7heightNumberThe desired height of the image.

Example

chart = map_add(0, 0, 400, 300, "OSM_STANDARD", 10)
map_goto(chart, 44.88, -93.22)

-- A mark on every airport
airports = map_add_nav_img_layer(chart, "AIRPORT", "airport.png", -8, -8, 16, 16)
Photo slot: shots/map_add_nav_img_layer.png

map_add_nav_txt_layer

Simulation Instrument Studio 1

Overloads

map_add_nav_txt_layer(map_id, nav_type, nav_param, style, x, y, width, height)

A map node. It draws tiles for a lat, lon, and zoom.

Parameters

#NameTypeDescription
1map_idNumberThe map_id to add the layer to. A map_id can be fetched by using function map_add.
2nav_typeStringThe NAV type to show in this layer, see the NAV types page.
3nav_paramStringThe NAV param to use. This can be NAME, LONGITUDE or LATITUDE.
4styleStringThe style to use for the text.
5xNumberThe x pixel offset of where the text should be shown. This is relative to the NAV point itself.
6yNumberThe y pixel offset of where the text should be shown. This is relative to the NAV point itself.
7widthNumberThe desired width of the textbox.
8heightNumberThe desired height of the textbox.

Example

-- ICAO under each airport mark
labels = map_add_nav_txt_layer(chart, "AIRPORT", "ICAO", "size:11; color:white; halign:center;", -20, 10, 40, 16)
Photo slot: shots/map_add_nav_txt_layer.png

map_baselayer

Simulation Instrument Studio 1

Overloads

map_baselayer(layer_id, source)

A map node. It draws tiles for a lat, lon, and zoom.

Parameters

#NameTypeDescription
1layer_idNumberMap identifier. This number can be obtained by calling map_add.
2sourceStringThe openstreetmap base layer to use. See map_add for available base layers.

Example

-- Night flight. Humanitarian is easier to read on a dark panel.
map_baselayer(chart, "OSM_HUMANITARIAN")
Photo slot: shots/map_baselayer.png

map_goto

Simulation Instrument Studio 1

Overloads

map_goto(map_id,lat,lon)

A map node. It draws tiles for a lat, lon, and zoom.

Parameters

#NameTypeDescription
1map_idNumberMap identifier. This number can be obtained by calling map_add.
2latNumberThe latitude to move the map to.
3lonNumberThe longitude to move the map to.

Example

chart = map_add(0, 0, 400, 300, "OSM_STANDARD", 11)

-- Minneapolis
map_goto(chart, 44.9778, -93.2650)
Photo slot: shots/map_goto.png

map_nav_canvas_layer_draw

Simulation Instrument Studio 1

Overloads

map_nav_canvas_layer_draw(layer_id)

A map node. It draws tiles for a lat, lon, and zoom.

Parameters

#NameTypeDescription
1layer_idIDMap nav canvas layer ID. This ID can be obtained by calling function map_add_nav_canvas_layer.

Example

-- Repaint the range ring after a zoom
map_nav_canvas_layer_draw(rings)
Photo slot: shots/map_nav_canvas_layer_draw.png

map_zoom

Simulation Instrument Studio 1

Overloads

map_zoom(map_id,zoom)

A map node. It draws tiles for a lat, lon, and zoom.

Parameters

#NameTypeDescription
1map_idNumberMap identifier. This number can be obtained by calling map_add.
2zoomNumberThe openstreemap zoom level. This value can normally range from 1 (whole earth) to 16 (closest to earth). This value is dependent on the base layer source type defined above.

Example

-- Close enough to read the runways at KMSP
map_zoom(chart, 13)
Photo slot: shots/map_zoom.png

video_stream_add

Simulation Instrument Studio 1

Overloads

video_stream_add(key, x, y, width, height)
video_stream_add(key, x, y, width, height, tex_x, tex_y, tex_width, tex_height)

A video node. It shows a stream in the instrument rectangle.

Parameters

#NameTypeDescription
1keyStringVideo stream key, this key is used to determine which video stream you wish to show. See stream keys below.
2xNumberLeft point of the canvas where your video stream should be shown.
3yNumberTop point of the canvas where your video stream should be shown.
4widthNumberThe video stream width on the canvas.
5heightNumberThe video stream height on the canvas.
6tex_xNumber(Optional) Left point of texture viewport.
7tex_yNumber(Optional) Top point of texture viewport.
8tex_widthNumber(Optional) Width of texture viewport.
9tex_heightNumber(Optional) Height of texture viewport.

Stream keys

KeySource
xpl/panelX-Plane 12 panel texture.
xpl/gauges[0]Gauges texture 0.
xpl/gauges[1]Gauges texture 1.
xpl/GNS430_1First GNS 430.
xpl/GNS530_1First GNS 530.
xpl/CDU739_1Captain CDU.
xpl/G1000_PFD_1G1000 PFD.

Example

-- X-Plane G1000 PFD, in the bezel we drew
pfd = video_stream_add("xpl/G1000_PFD_1", 12, 12, 400, 300)

Example: a crop of the gauges texture

-- Full PFD
pfd = video_stream_add("xpl/G1000_PFD_1", 12, 12, 400, 300)

-- Only the attitude window inside the gauges texture
attitude = video_stream_add("xpl/gauges[0]", 12, 12, 200, 200, 80, 40, 240, 180)
Photo slot: shots/video_stream_add.png

video_stream_ext_add

Simulation Instrument Studio 1

Overloads

video_stream_ext_add(tag, key, x, y, width, height)
video_stream_ext_add(tag, key, x, y, width, height, tex_x, tex_y, tex_width, tex_height)

A video node. It shows a stream in the instrument rectangle.

Parameters

#NameTypeDescription
1tagStringVideo stream source tag. This is the name configured for the stream.
2keyStringVideo stream key, this key is used to determine which video stream you wish to show.
3xNumberLeft point of the canvas where your video stream should be shown.
4yNumberTop point of the canvas where your video stream should be shown.
5widthNumberThe video stream width on the canvas.
6heightNumberThe video stream height on the canvas.
7tex_xNumber(Optional) Left point of texture viewport.
8tex_yNumber(Optional) Top point of texture viewport.
9tex_widthNumber(Optional) Width of texture viewport.
10tex_heightNumber(Optional) Height of texture viewport.

Example

-- A texture the aircraft published
mfd = video_stream_ext_add("G1000", "MFD", 0, 0, 512, 384)
Photo slot: shots/video_stream_ext_add.png

video_stream_set

Simulation Instrument Studio 1

Overloads

video_stream_set(video_stream_id, key)
video_stream_set(video_stream_id, key, tex_x, tex_y, tex_width, tex_height)

A video node. It shows a stream in the instrument rectangle.

Parameters

#NameTypeDescription
1keyStringReference to the video stream. This can be created using video_stream_add function.
2tex_xNumber(Optional) Left point of texture viewport.
3tex_yNumber(Optional) Top point of texture viewport.
4tex_widthNumber(Optional) Width of texture viewport.
5tex_heightNumber(Optional) Height of texture viewport.

Example

-- Crop to the attitude tape, skip the bezel in the texture
video_stream_set(pfd, 40, 20, 320, 240)
Photo slot: shots/video_stream_set.png