Skip to content

Widgets

Every widget renders into a floating panel at an edge of the globe (position: top-left, top-right, bottom-left, bottom-right, top-center, bottom-center) and needs the shared stylesheet. React names are shown; the Angular selectors are ww-layer-switcher, ww-navigation-controls, ww-goto-box, ww-coordinates, ww-measure-tool, ww-projection-switcher, ww-scale-bar, ww-compass, ww-attribution, ww-legend, ww-time-slider and ww-draw-tool, with the same inputs.

LayerSwitcher

A checkbox and an opacity slider per layer, top-most layer first. Screen-space layers (compass, coordinates, view controls) and tool-owned layers are hidden by default.

PropDefaultPurpose
heading'Layers'Panel heading; null hides it
showOpacitytrueOpacity slider per layer
hideOverlaystrueHide screen-space and tool-owned layers
topFirsttrueList order
filter(layer) => boolean

Zoom in and out, reset to north, tilt up and down, and a home button.

PropDefaultPurpose
zoomFactor2Range multiplier per step
tiltStep15Degrees per tilt step
showTilttrueTilt buttons
homewhole globeCameraTarget, or false to hide
animate1500Home flight in ms
orientation'vertical'Or 'horizontal'
fullscreenfalseAdds a fullscreen toggle for the globe and its widgets
screenshotfalseAdds a button that saves the globe as an image; an object sets type, quality and filename

The kit offers the same as toggleFullscreen(globe), captureScreenshot(globe) and downloadScreenshot(globe, options). Screenshots are taken inside WorldWind's redraw callback, so they work without preserveDrawingBuffer.

GoToBox

Type lat, lon (40.7, -74, 40.7N 74W) or a place name. Coordinates fly immediately; names are geocoded with a Nominatim-compatible service and multiple matches are listed.

PropDefaultPurpose
duration2000Flight in ms
defaultRange200 000Metres, when a result has no bounding box
geocodingpublic NominatimGeocodeOptions (endpoint, limit, language, fetch), or false for coordinates only
onNavigate(target, result?) => void

The public OpenStreetMap Nominatim is for light use only; point endpoint at your own for anything heavier.

CoordinatesReadout

Latitude, longitude and terrain altitude under the mouse, plus the camera range. Turns hover picking on while mounted.

PropDefaultPurpose
format'decimal'Or 'dms'
precision4 / 1Decimals, or seconds precision for dms
showAltitude, showRangetrueFields

MeasureTool

Press Measure, click the globe to add points: the line and vertex markers live in the tool's own layer, the readout shows the path length and, from three points, the polygon area. Undo and Clear do what they say.

PropDefaultPurpose
pathType'greatCircle'Or 'rhumbLine', 'linear'
followTerraintrueMeasure along the terrain
linecyan, 2 pxShapeStyle for the line

The hook useMeasureTool() (React) or the MeasureTool class (kit) gives you the same state without the panel.

Not a panel but an overlay anchored to a geographic position: it follows the globe every frame and hides while the point is behind the globe or off screen. Content is ordinary markup; title (React) or heading (Angular) adds a bold first line and onClose / closable a close button. The demos open one when you click a city pin or an airport.

PropDefaultPurpose
position{ latitude, longitude, altitude? }
anchor'bottom'Side of the point the popup sits on (bottom means above the point)
offset{ x, y } in pixels
hideWhenHiddentrueHide when behind the globe or outside the viewport

The kit exposes the same machinery as globe.toScreen(position) and globe.trackPosition(position, listener).

ProjectionSwitcher

Buttons for the 3D globe and the flat projections (equirectangular, Mercator, north and south polar). projections limits the choice, labels renames buttons.

ScaleBar

A bar showing a round ground distance (1, 2 or 5 times a power of ten) at the current zoom. The resolution comes from WorldWind's own pixel size at the look-at point, so tilt, projection and device pixel ratio are all accounted for.

PropDefaultPurpose
maxWidth120Longest bar in pixels
units'metric'Or 'imperial' (ft, mi), 'nautical' (m, nmi)

The kit exposes the same numbers as globe.trackScale(listener, options), scaleBar(wwd) and computeScaleBar(metersPerPixel, options); React also has useScaleBar().

Compass

A rose that turns with the camera heading. Clicking it resets the heading to north (resetOnClick, default true); onClick (React) or (compassClick) (Angular) receives the heading that was showing. size sets the diameter in pixels (56).

Attribution

A slim strip crediting the data behind the visible layers. Credits come from three places: defaults for WorldWind's built-in layers (NASA imagery, OpenStreetMap, Bing Maps), the <Attribution> element of a WMS capabilities document, and the attribution option any layer can set ('Data: ACME' or { text, url }; null suppresses a default). Renders nothing when there is nothing to credit.

PropDefaultPurpose
position'bottom-center'Any panel position
extraCredits shown after the layers' own
includeDisabledfalseCredit layers that are switched off too
separator' · 'Text between credits

Kit: layerAttribution(layer), collectAttributions(layers), setLayerAttribution(layer, credit) and DEFAULT_ATTRIBUTIONS; React: useAttributions().

Legend

Legend images of the visible layers, top-most first. Layers built from capabilities carry the LegendURL of their WMS style or WMTS style; any other layer can set legend to an image URL or { url, width, height }. Renders nothing when no visible layer has one.

PropDefaultPurpose
heading'Legend'Panel heading; null hides it
showNamestrueLayer name above each image
includeDisabledfalseInclude layers that are switched off

Kit: layerLegend(layer), collectLegends(layers), setLayerLegend(layer, legend) and wmsLegendGraphicUrl(options) for servers that answer GetLegendGraphic; React: useLegends().

TimeSlider

A slider with play and pause that steps time-enabled WMS and WMTS layers through their time dimension. Layers built from capabilities know their dimension (Dimension / Extent with name="time", or a WMTS Time dimension); other layers take one through the timeDimension option, and the slider itself accepts start, end, step and values when the layers declare nothing. By default it drives every layer with a dimension; layers narrows that.

PropDefaultPurpose
start, endfrom the layersDate or ISO string
stepfinest declared step, else one dayMilliseconds
valuesExplicit instants instead of a range
value, defaultValuethe layers' default, else endControlled or initial instant
onChange / (valueChange)Called with the instant
timeFormat'auto'How TIME is written: 'date', 'datetime', or a function
playInterval1000Milliseconds between steps
looptrueStart over at the end
showPlaytruePlay and pause button

WorldWind only reads TIME when a layer is constructed, so the kit's setLayerTime(layer, date) (also globe.layers.setTime) updates the layer's URL builder and expires its imagery: the old tiles stay on screen until the new ones arrive. The demos drive NASA GIBS daily MODIS imagery this way:

tsx
<WmsLayer
  service="https://gibs.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi"
  layerNames="MODIS_Terra_CorrectedReflectance_TrueColor"
  format="image/jpeg"
  timeDimension={{ start: new Date('2024-01-01'), end: new Date('2024-01-31'), stepMs: DAY_MS }}
/>
<TimeSlider position="top-center" />

The kit's parseTimeDimension('2024-01-01/2024-01-31/P1D'), timeDimensionFromCapabilities(layerCapabilities) and resolveTimeDimension(layers, overrides) give you the same data without the widget.

DrawTool

Draws points, lines and polygons and edits them afterwards. Pick a shape, click the globe to add vertices, and finish a line or polygon with a double-click, Enter or the Finish button. Click a finished drawing to select it: its vertices get handles you can drag, Delete removes the selected vertex (or the feature once it is at its minimum), Escape deselects. Everything lives in the tool's own layer and round-trips through GeoJSON.

PropDefaultPurpose
onChange / (featuresChange)Called with the features whenever they change
showDownloadfalseButton that downloads the drawings as GeoJSON
editabletrueAllow selecting, dragging and deleting
finishOnDoubleClicktrue
keyboardtrueEnter, Escape, Delete and Backspace on the focused canvas
line, polygon, selectedorangeShapeStyle for lines, polygons, and the selection highlight
pointImage, pointScalered pushpinPoint features
handleImage, handleScalewhite dotVertex handles

Dragging works because WorldWind's navigator ignores a press whose default was prevented: the tool claims the press when it lands on a handle or a point, and the globe stays put. The hook useDrawTool() (React) and the DrawTool class (kit) expose start, finish, select, removeSelected, toGeoJson and load without the panel.

MIT licensed. Not affiliated with NASA; WorldWind is NASA's open-source virtual globe.