---
title: "Example: Shapes & Overlays · Nuxt Scripts"
description: "Draw circles, polygons, polylines, rectangles, and GeoJSON data on a Google map."
canonical_url: "https://scripts.nuxt.com/scripts/google-maps/guides/shapes-and-overlays"
meta:
  "og:description": "Draw circles, polygons, polylines, rectangles, and GeoJSON data on a Google map."
  "og:image": "https://scripts.nuxt.com/_og/s/o_795fe1d3a6c2ea54.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Example: Shapes & Overlays · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_795fe1d3a6c2ea54.png"
---

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

**Guides**

# **Example: Shapes & Overlays**

[Copy for LLMs](https://scripts.nuxt.com/scripts/google-maps/guides/shapes-and-overlays.md)

**Shapes & Overlays Demo**

Circle (blue), polygon (green), polyline route (red), and rectangle (yellow) on a single map.

Place each shape component inside `**<ScriptGoogleMaps>**` and pass the corresponding Google Maps API options through `**options**`. Google's [**shapes guide**](https://developers.google.com/maps/documentation/javascript/shapes) covers the geometry and styling fields shared by these components.

## Circle: Delivery Radius

```vue
<script setup lang="ts">
const center = { lat: -33.8688, lng: 151.2093 }

const circleOptions = {
  center,
  radius: 2000,
  fillColor: '#4285F4',
  fillOpacity: 0.15,
  strokeColor: '#4285F4',
  strokeOpacity: 0.8,
  strokeWeight: 2,
}
</script>

<template>
  <ScriptGoogleMaps
    :map-options="{
      center,
      zoom: 13,
    }"
  >
    <ScriptGoogleMapsMarker :position="center" />
    <ScriptGoogleMapsCircle :options="circleOptions" />
  </ScriptGoogleMaps>
</template>
```

## Polygon: Zone Boundary

```vue
<script setup lang="ts">
const zoneBoundary = [
  { lat: -33.856, lng: 151.200 },
  { lat: -33.852, lng: 151.220 },
  { lat: -33.870, lng: 151.225 },
  { lat: -33.878, lng: 151.205 },
  { lat: -33.870, lng: 151.195 },
]

const polygonOptions = {
  paths: zoneBoundary,
  fillColor: '#34a853',
  fillOpacity: 0.2,
  strokeColor: '#34a853',
  strokeWeight: 2,
}
</script>

<template>
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.865, lng: 151.210 },
      zoom: 14,
    }"
  >
    <ScriptGoogleMapsPolygon :options="polygonOptions" />
  </ScriptGoogleMaps>
</template>
```

## Polyline: Route Path

```vue
<script setup lang="ts">
const routePath = [
  { lat: -33.8568, lng: 151.2153 },
  { lat: -33.8600, lng: 151.2100 },
  { lat: -33.8650, lng: 151.2090 },
  { lat: -33.8688, lng: 151.2093 },
]

const polylineOptions = {
  path: routePath,
  strokeColor: '#ea4335',
  strokeOpacity: 1.0,
  strokeWeight: 3,
}

const startColor = '#34a853'
const endColor = '#ea4335'
</script>

<template>
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.862, lng: 151.212 },
      zoom: 15,
    }"
  >
    <ScriptGoogleMapsPolyline :options="polylineOptions" />
    <ScriptGoogleMapsMarker :position="routePath[0]">
      <template #content>
        <div class="w-6 h-6 rounded-full border-2 border-white" :style="{ background: startColor }" />
      </template>
    </ScriptGoogleMapsMarker>
    <ScriptGoogleMapsMarker :position="routePath[routePath.length - 1]">
      <template #content>
        <div class="w-6 h-6 rounded-full border-2 border-white" :style="{ background: endColor }" />
      </template>
    </ScriptGoogleMapsMarker>
  </ScriptGoogleMaps>
</template>
```

## Rectangle: Bounding Box

```vue
<script setup lang="ts">
const rectangleOptions = {
  bounds: {
    north: -33.855,
    south: -33.875,
    east: 151.225,
    west: 151.195,
  },
  fillColor: '#fbbc04',
  fillOpacity: 0.15,
  strokeColor: '#fbbc04',
  strokeWeight: 2,
}
</script>

<template>
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.865, lng: 151.210 },
      zoom: 14,
    }"
  >
    <ScriptGoogleMapsRectangle :options="rectangleOptions" />
  </ScriptGoogleMaps>
</template>
```

## GeoJSON: Data Layer

Load GeoJSON from a URL or pass inline data. Replacing `**src**` reloads the layer, while nested changes to an inline object do not. The component watches the `**style**` prop deeply.

```vue
<script setup lang="ts">
const geoJson = {
  type: 'FeatureCollection',
  features: [
    {
      type: 'Feature',
      geometry: {
        type: 'Polygon',
        coordinates: [[
          [151.20, -33.87],
          [151.25, -33.87],
          [151.25, -33.90],
          [151.20, -33.90],
          [151.20, -33.87],
        ]],
      },
      properties: { name: 'Sydney CBD' },
    },
  ],
}

const geoJsonStyle = {
  fillColor: '#4285F4',
  fillOpacity: 0.3,
  strokeColor: '#4285F4',
  strokeWeight: 2,
}
</script>

<template>
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.885, lng: 151.225 },
      zoom: 13,
    }"
  >
    <ScriptGoogleMapsGeoJson :src="geoJson" :style="geoJsonStyle" />
  </ScriptGoogleMaps>
</template>
```

### Remote URL

```vue
<script setup lang="ts">
const geoJsonStyle = {
  fillColor: '#34a853',
  fillOpacity: 0.2,
  strokeWeight: 1,
}
</script>

<template>
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.885, lng: 151.225 },
      zoom: 10,
    }"
  >
    <ScriptGoogleMapsGeoJson
      src="https://example.com/boundaries.geojson"
      :style="geoJsonStyle"
    />
  </ScriptGoogleMaps>
</template>
```

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/google-maps/1.guides/5.shapes-and-overlays.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/google-maps/guides/shapes-and-overlays.md)

[**Example: Markers & Info Windows** Add advanced markers, info windows, and custom HTML popups to a Google map.](https://scripts.nuxt.com/scripts/google-maps/guides/markers-and-info-windows) [**Example: Marker Clustering** Group dense sets of Google Maps markers with the marker clusterer component.](https://scripts.nuxt.com/scripts/google-maps/guides/marker-clustering)

**On this page **

- [Circle: Delivery Radius](#circle-delivery-radius)
- [Polygon: Zone Boundary](#polygon-zone-boundary)
- [Polyline: Route Path](#polyline-route-path)
- [Rectangle: Bounding Box](#rectangle-bounding-box)
- [GeoJSON: Data Layer](#geojson-data-layer)

```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/guides/shapes-and-overlays#webpage","@type":"WebPage","description":"Draw circles, polygons, polylines, rectangles, and GeoJSON data on a Google map.","name":"Example: Shapes & Overlays","url":"https://scripts.nuxt.com/scripts/google-maps/guides/shapes-and-overlays","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/google-maps/guides/shapes-and-overlays#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/google-maps/guides/shapes-and-overlays"]}],"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/guides/shapes-and-overlays#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":"Guides","item":"https://scripts.nuxt.com/scripts/google-maps/guides","position":4},{"@type":"ListItem","name":"Example: Shapes & Overlays","item":"https://scripts.nuxt.com/scripts/google-maps/guides/shapes-and-overlays","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.
