Skip to main content

Render World Copies

Toggle between rendering a single world and multiple copies of the world using setRenderWorldCopies.


<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Render world copies</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="https://maps-sdk.trimblemaps.com/v4/trimblemaps-4.2.3.css" />
    <script src="https://maps-sdk.trimblemaps.com/v4/trimblemaps-4.2.3.js"></script>
    <style>
      body {
        margin: 0;
        padding: 0;
      }
      html,
      body,
      #map {
        height: 100%;
      }
      #menu {
        position: absolute;
        background: #fff;
        padding: 10px;
        font-family: 'Open Sans Regular', sans-serif;
        top: 8px;
        left: 8px;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <div id="menu">
      <div>Set <code>renderWorldCopies</code> to:</div>
      <div>
        <input type="radio" id="true" name="rtoggle" value="true" checked />
        <label for="true">true</label>
      </div>
      <div>
        <input type="radio" id="false" name="rtoggle" value="false" />
        <label for="false">false</label>
      </div>
    </div>
    <script>
      TrimbleMaps.setAPIKey('YOUR_API_KEY_HERE');
      const map = new TrimbleMaps.Map({
        container: 'map', // container id
        style: TrimbleMaps.Common.Style.TRANSPORTATION, // stylesheet location
        center: [179, 0], // starting position [lng, lat]
        zoom: 0.01, // starting zoom
      });

      const renderOptions = document.getElementById('menu');
      const inputs = renderOptions.getElementsByTagName('input');

      function switchRenderOption(option) {
        const status = option.target.id;
        map.setRenderWorldCopies(status === 'true');
      }

      for (let i = 0; i < inputs.length; i++) {
        inputs[i].onclick = switchRenderOption;
      }
    </script>
  </body>
</html>

Last updated June 26, 2025.