# Eclipse Map

### Embed an eclipse map on your own page

You can embed an interactive eclipse map directly on your website:

<figure><img src="https://1001599322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbA8iUHgJsg3uY5Dn2s3E%2Fuploads%2FAL6Z7CFyPmiKIGY5ywSx%2Feclipse-path-widget.png?alt=media&#x26;token=86ce4171-1e2c-4115-b01d-51af74598314" alt=""><figcaption><p>Screenshot showing embeddable eclipse path widget</p></figcaption></figure>

There are a number of advantages to this approach, compared to other methods:

* Your visitors can explore the map without leaving your page (map can be zoomed and panned)
* You can highlight exactly the area of interest to your audience (e.g. your county or state) without needing to obtain a custom map
* The map marker can be positioned to show your exact location, along with customizable title and subtitle
* There's no need to lookup and transcribe the local circumstances of the eclipse (times, magnitude, duration) - they are calculated and displayed automatically
* Supports any solar eclipse between the years 1500 and 2500.

### Embedding the eclipse map widget

The eclipse map can be included either via a simple `iframe` or `embed` tag on your web page. No JavaScript is required, and configuration is simple, via a handful of URL parameters:

{% code title="" overflow="wrap" lineNumbers="true" %}

```html
<!DOCTYPE html>
<html>
  <head>
    <title>Radiant Drift Eclipse Widgets</title>
    <meta charset="UTF-8" />
  </head>

  <body>
    <div id="app">
      <div>
        <h1>Interactive Eclipse Map</h1>
        <p>Customizable, with pan and zoom</p>
        <iframe
          id="path"
          title="Eclipse Path"
          height="350"
                src="https://widget.radiantdrift.com/eclipse-path?center=31.5,-101&z=6&apiKey=[YOUR_API_KEY]&map=osm&date=2023-10-14&ll=31.9974,-102.0779&title=Midland, Texas&subtitle=Just north of the central path"
        >
        </iframe>
      </div>
    </div>
  </body>
</html>

```

{% endcode %}

Try it now - edit the the following example on CodePen, replacing `YOUR_API_KEY` with (you guessed it...) your own API key:

{% embed url="<https://codepen.io/stephent/pen/MWZQLpx>" %}
Codepen example showing embeddable eclispe map
{% endembed %}

### Configuation options

The eclipse map can be configured using the following URL search parameters:

<table><thead><tr><th width="155">Parameter</th><th width="100">Default</th><th>Description</th></tr></thead><tbody><tr><td><code>apiKey</code></td><td>none</td><td>Required. A valid API key</td></tr><tr><td><code>obs</code></td><td>none</td><td>Optional. Two comma-separated values, representing the latitude and longitude (negative west). When supplied, a map marker is shown at the given location.</td></tr><tr><td><code>title</code></td><td>none</td><td>Optional. Title string to be displayed in the map marker popover. This parameter has no effect if <code>obs</code> is omitted.</td></tr><tr><td><code>subtitle</code></td><td>none</td><td>Optional. Subtitle text (string) to be displayed in the map marker popover. This parameter has no effect if <code>obs</code> is omitted.</td></tr><tr><td><code>center</code></td><td>0,0</td><td>Optional (but recommended). Two comma-separated values representing the latitude and longitude (negative west) on which the map should be centered.</td></tr><tr><td><code>z</code></td><td>13</td><td>Optional. Zoom level (integer) at which the map should be displayed. Supported values vary by selected map type, but are typically in the range 0 to 19. Higher values represent higher zoom levels (i.e. smaller map area displayed)</td></tr><tr><td><code>map</code></td><td>osm</td><td>Optional. String value to select the displayed map type. Supported values are 'osm' (Open Street Map), 'ocm' (Open Cycle Map), 'top' (TopPlusOpen) (more coming soon).</td></tr><tr><td><code>date</code></td><td>None</td><td>Required. The date of the eclipse event to be displayed. Must be midnight UTC of the desired day. Format must be a value or dateString accepted by the JavaScript <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date">Date constructor</a>. We recommend using <code>YYYY-MM-DD</code> for simplicity, e.g. 2024-04-08 for the Apr 8 2024 eclipse. (The time zone of your location does not matter - the value must be midnight UTC.)</td></tr><tr><td><code>tzid</code></td><td>None</td><td>Optional. A <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">TZ identifier</a> (time zone ID) to be used to format times displayed in the widget, e.g. Europe/Berlin or America/Denver. When omitted, the user's operating system time zone is used.</td></tr></tbody></table>
