Options
All
  • Public
  • Public/Protected
  • All
Menu

A polygon (like a polyline) defines a series of connected coordinates in an ordered sequence. Additionally, polygons form a closed loop and define a filled region. See the samples in the developer's guide, starting with a simple polygon, a polygon with a hole, and more. Note that you can also use the Data layer to create a polygon. The Data layer offers a simpler way of creating holes because it handles the order of the inner and outer paths for you.

Access by calling const {Polygon} = await google.maps.importLibrary("maps"). See https://developers.google.com/maps/documentation/javascript/libraries.

Hierarchy

Index

Constructors

Methods

  • Adds the given listener function to the given event name. Returns an identifier for this listener that can be used with google.maps.event.removeListener.

    Parameters

    • eventName: string
    • handler: Function

    Returns MapsEventListener

  • bindTo(key: string, target: MVCObject, targetKey?: null | string, noNotify?: boolean): void
  • Binds a View to a Model.

    Parameters

    • key: string
    • target: MVCObject
    • Optional targetKey: null | string
    • Optional noNotify: boolean

    Returns void

  • get(key: string): any
  • Gets a value.

    Parameters

    • key: string

    Returns any

  • getDraggable(): boolean
  • Returns whether this shape can be dragged by the user.

    Returns boolean

  • getEditable(): boolean
  • Returns whether this shape can be edited by the user.

    Returns boolean

  • getMap(): null | Map
  • Returns the map on which this shape is attached.

    Returns null | Map

  • getVisible(): boolean
  • Returns whether this poly is visible on the map.

    Returns boolean

  • notify(key: string): void
  • Notify all observers of a change on this property. This notifies both objects that are bound to the object's property as well as the object that it is bound to.

    Parameters

    • key: string

    Returns void

  • set(key: string, value: unknown): void
  • Sets a value.

    Parameters

    • key: string
    • value: unknown

    Returns void

  • setDraggable(draggable: boolean): void
  • If set to true, the user can drag this shape over the map. The geodesic property defines the mode of dragging.

    Parameters

    • draggable: boolean

    Returns void

  • setEditable(editable: boolean): void
  • If set to true, the user can edit this shape by dragging the control points shown at the vertices and on each segment.

    Parameters

    • editable: boolean

    Returns void

  • setMap(map: null | Map): void
  • Renders this shape on the specified map. If map is set to null, the shape will be removed.

    Parameters

    • map: null | Map

    Returns void

  • setPaths(paths: any[] | MVCArray<any>): void
  • Sets the path for this polygon.

    Parameters

    Returns void

  • setValues(values?: null | object): void
  • Sets a collection of key-value pairs.

    Parameters

    • Optional values: null | object

    Returns void

  • setVisible(visible: boolean): void
  • Hides this poly if set to false.

    Parameters

    • visible: boolean

    Returns void

  • unbind(key: string): void
  • Removes a binding. Unbinding will set the unbound property to the current value. The object will not be notified, as the value has not changed.

    Parameters

    • key: string

    Returns void

  • unbindAll(): void

Generated using TypeDoc