---
title: "Ocean bathymetry 3D | JavaScript maps SDK"
description: "Show a detailed 3D ocean bathymetry map."
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Ocean bathymetry 3D

Show a detailed 3D map of the ocean’s seafloor and its bathymetry.

Increase the authenticity of your web mapping applications and data by incorporating ocean relief into your maps. This will provide a greater sense of realism and depth to your visuals.

### NPM module setup

```bash
npm install --save @maptiler/sdk
```

#### main.js

```js
import { Map, config } from '@maptiler/sdk';
import '@maptiler/sdk/dist/maptiler-sdk.css';

config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
const map = new Map({
  container: 'map', // container id
  style: 'ocean', 
  center: [126.419, 10.2021], // starting position [lng, lat]
  zoom: 9.12, // starting zoom
  pitch: 77,
  bearing: -20,
  maxPitch: 85,
});
map.on('load', function() {
  map.addSource("bathymetry", {
    type: 'raster-dem',
    url: 'https://api.maptiler.com/tiles/ocean-rgb/tiles.json',
  });
  map.setTerrain({ source: 'bathymetry', exaggeration: 1.5 });
});
```

#### index.html

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="robots" content="noindex">
  <title>Ocean bathymetry 3D | NPM example</title>
  <link rel="stylesheet" href="./style.css">
</head>
<body>
  <div id="map"></div>
  <script type="module" src="./main.js"></script>
</body>
</html>
```

#### style.css

```css
body {margin: 0; padding: 0;}
#map {position: absolute; top: 0; bottom: 0; width: 100%;}
```

### Basic JavaScript setup

```html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add a map to a webpage</title>
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v4.2.0/maptiler-sdk.umd.min.js"></script>
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v4.2.0/maptiler-sdk.css" rel="stylesheet" />
<style>
  body {margin: 0; padding: 0;}
  #map {position: absolute; top: 0; bottom: 0; width: 100%;}
</style>
</head>
<body>
<div id="map"></div>
  <script>
    maptilersdk.config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
    const map = new maptilersdk.Map({
      container: 'map', // container id
      style: 'ocean', 
      center: [126.419, 10.2021], // starting position [lng, lat]
      zoom: 9.12, // starting zoom
      pitch: 77,
      bearing: -20,
      maxPitch: 85,
    });
    map.on('load', function() {
      map.addSource("bathymetry", {
        type: 'raster-dem',
        url: 'https://api.maptiler.com/tiles/ocean-rgb/tiles.json',
      });
      map.setTerrain({ source: 'bathymetry', exaggeration: 1.5 });
    });
  </script>
</body>
</html>
```

## Related examples

### [3D terrain map](https://docs.maptiler.com/sdk-js/examples/3d-map/)

Tutorials

Create and display 3D terrain maps on web pages.

### [Add elevation profile control](https://docs.maptiler.com/sdk-js/examples/elevation-profile-control-simple/)

Examples

Show elevation profiles for GeoJSON traces using MapTiler.

### [Add hillshading](https://docs.maptiler.com/sdk-js/examples/hillshade/)

Examples

Add raster hillshading effect to a MapTiler map.
