addPolygon

addPolygon

Adds a polygon to the sphere using specified latitude and longitude points for vertices.

Parameter

  • A single un-named object with the following attributes. Several are optional:

    • id (number | string, optional): Unique id for the polygon. Note: If not provided, this is auto- generated.

    • name (string, optional): Name for the polygon, similar to id but does not have to be unique. To be used in later features.

    • points (Array<{lat: number, lng: number}>): An array (list) of vertices and that defines the outside edge of the polygon, used to render the polygon in the viewer.

    • color (string, optional): The display color for the polygon. This is used both for the edges and the middle. Accepts html color names (such as “blue”) or hex values. Default: red

    • opacity (number, optional): The opaque level value to use. 100 is fully opaque, 0 being invisible. Default: 100

    • hoverText (string, optional): Text that will display when the end user hovers their mouse over the polygon.

    • layer (string, optional): The polygon will be added to the layer named. Default: "default"

    • objectDisplayOrder (number, optional): Render order used to apply to all objects in the viewer. Only applied when AerialSphere class value viewerDisplayOrder is set to objectDisplayOrder. Note: Larger numbers render on top of smaller numbers.

Code Sample