Skip to content
EN

What is the Plugin API?

Last updated

The Plugin API is the set of tools your Plugin uses to communicate with Re:Earth Visualizer. Through the API, your Plugin can read data from Visualizer, respond to user actions, control what appears on the map, and manage its own interface—all without needing access to Visualizer’s source code.

The entire API is available through a single global object called reearth. Every capability your Plugin needs is accessed through this object. For example, use reearth.camera to control the camera and reearth.layers to work with layers.

The API is organized around what a Plugin does: it presents an interface to the user and works with the scene—the map, its layers, and its data. Each part of the API serves one of these roles:

  • The Plugin itself (reearth.extension): The Plugin’s own context, including its configured properties, messaging with its UI, and lifecycle events.
  • The Plugin’s interface (reearth.ui, reearth.modal, reearth.popup): What the user sees and interacts with, including the main UI panel, dialog windows, and small anchored windows.
  • The scene (reearth.viewer, reearth.camera, reearth.timeline): The world the user is looking at, including the viewer’s environment and settings, the point of view, and time-based playback.
  • The content (reearth.layers, reearth.data): The data the Plugin puts on the map and keeps for itself, including map layers and client-side data storage.
  • Drawing and location tools (reearth.sketch, reearth.spatialId): Specialized capabilities for drawing shapes on the map and working with spatial ID location references.
  • System information (reearth.version, reearth.apiVersion, reearth.engine): Basic facts about the environment in which the Plugin runs, such as the Visualizer version and rendering engine.

These parts work together in every Plugin. Events are part of the same organization: the viewer emits mouse events, the timeline emits ticks, and the extension receives messages. Listen for an event on the object to which it relates.

For example, a Plugin that lets a user fly to saved locations reads its settings through reearth.extension, shows them as a clickable list through reearth.ui, and moves the view through reearth.camera when one is selected.

For every available property and method, see the API reference.