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. If none are provided it is auto generated by the viewer.

    • 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}>): This array is the list of Polygon vertices and is used to render the polygon in the viewer.

    • color (string, optional): The color to use for the polygon when rendered. Currently accepts direct color names: ‘blue’ or hex values. Default if not provided is red.

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

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

Code Sample