---
title: "<ScriptGoogleMapsPolygon> · Nuxt Scripts"
description: "Draw reactive polygon overlays, including editable polygons and polygons with holes."
canonical_url: "https://scripts.nuxt.com/scripts/google-maps/api/polygon"
meta:
  "og:description": "Draw reactive polygon overlays, including editable polygons and polygons with holes."
  "og:image": "https://scripts.nuxt.com/_og/s/o_8f8f66347ae3f867.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "<ScriptGoogleMapsPolygon> · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_8f8f66347ae3f867.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Api**

# **\<ScriptGoogleMapsPolygon>**

[Copy for LLMs](https://scripts.nuxt.com/scripts/google-maps/api/polygon.md)

Polygon shape overlay on the map. Place it inside a [`**<ScriptGoogleMaps>**`](https://scripts.nuxt.com/scripts/google-maps/api/script-google-maps) component. Its options map to [`**google.maps.PolygonOptions**`](https://developers.google.com/maps/documentation/javascript/reference/polygon#PolygonOptions).

`**options**``Omit<google.maps.PolygonOptions, 'map'>`

Configuration options for the polygon overlay.

## Usage

```vue
<template>
  <ScriptGoogleMaps api-key="your-api-key">
    <ScriptGoogleMapsPolygon
      :options="{
        paths: [
          { lat: -34.397, lng: 150.644 },
          { lat: -34.407, lng: 150.654 },
          { lat: -34.417, lng: 150.634 },
        ],
        fillColor: '#0000FF',
        fillOpacity: 0.3,
        strokeWeight: 2,
      }"
    />
  </ScriptGoogleMaps>
</template>
```

### Polygon with Hole

Pass an array of arrays to `**paths**` to cut holes in the polygon. The first array defines the outer boundary; subsequent arrays define holes. Google requires each inner path to use the [**opposite winding direction**](https://developers.google.com/maps/documentation/javascript/shapes#polygon_holes) from the outer path.

```vue
<template>
  <ScriptGoogleMaps
    api-key="your-api-key"
    :map-options="{
      center: { lat: -34.404, lng: 150.644 },
      zoom: 14,
    }"
  >
    <ScriptGoogleMapsPolygon
      :options="{
        paths: [
          [
            { lat: -34.390, lng: 150.630 },
            { lat: -34.390, lng: 150.660 },
            { lat: -34.420, lng: 150.660 },
            { lat: -34.420, lng: 150.630 },
          ],
          [
            { lat: -34.400, lng: 150.640 },
            { lat: -34.410, lng: 150.640 },
            { lat: -34.410, lng: 150.650 },
            { lat: -34.400, lng: 150.650 },
          ],
        ],
        fillColor: '#FF0000',
        fillOpacity: 0.35,
        strokeWeight: 2,
      }"
    />
  </ScriptGoogleMaps>
</template>
```

### Editable Polygon

```vue
<template>
  <ScriptGoogleMaps api-key="your-api-key">
    <ScriptGoogleMapsPolygon
      :options="{
        paths: [
          { lat: -34.397, lng: 150.644 },
          { lat: -34.407, lng: 150.654 },
          { lat: -34.417, lng: 150.634 },
        ],
        editable: true,
        draggable: true,
        fillColor: '#4285F4',
        fillOpacity: 0.2,
      }"
      @click="(e) => console.log('Clicked at', e.latLng?.toJSON())"
    />
  </ScriptGoogleMaps>
</template>
```

Polygon mouse events emit [`**google.maps.PolyMouseEvent**`](https://developers.google.com/maps/documentation/javascript/reference/polygon#PolyMouseEvent). On editable geometry, its optional `**vertex**`, `**edge**`, and `**path**` indices identify the affected part of the path. The component watches the `**options**` prop deeply.

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/google-maps/2.api/6.polygon.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/google-maps/api/polygon.md)

[**\<ScriptGoogleMapsCircle>** Draw a reactive circle overlay and handle its map events.](https://scripts.nuxt.com/scripts/google-maps/api/circle) [**\<ScriptGoogleMapsPolyline>** Draw reactive paths and routes on a Google map.](https://scripts.nuxt.com/scripts/google-maps/api/polyline)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/scripts/google-maps/api/polygon#webpage","@type":"WebPage","description":"Draw reactive polygon overlays, including editable polygons and polygons with holes.","name":"<ScriptGoogleMapsPolygon>","url":"https://scripts.nuxt.com/scripts/google-maps/api/polygon","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/google-maps/api/polygon#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/google-maps/api/polygon"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/scripts/google-maps/api/polygon#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Scripts","item":"https://scripts.nuxt.com/scripts","position":2},{"@type":"ListItem","name":"Google Maps","item":"https://scripts.nuxt.com/scripts/google-maps","position":3},{"@type":"ListItem","name":"API","item":"https://scripts.nuxt.com/scripts/google-maps/api","position":4},{"@type":"ListItem","name":"<ScriptGoogleMapsPolygon>","item":"https://scripts.nuxt.com/scripts/google-maps/api/polygon","position":5}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
