Skip to main content

Jump to a series of locations

Use the jumpTo function to showcase multiple locations. Requires Trimble Maps v3.0.0 or later.


<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <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%; overflow: hidden}
        </style>
    </head>
    <body>
        <div id="map"></div>

        <script>
        const cities = {
        type: 'FeatureCollection',
        features: [
          {
            type: 'Feature',
            properties: {},
            geometry: {
              type: 'Point',
              coordinates: [100.507, 13.745],
            },
          },
          {
            type: 'Feature',
            properties: {},
            geometry: {
              type: 'Point',
              coordinates: [98.993, 18.793],
            },
          },
          {
            type: 'Feature',
            properties: {},
            geometry: {
              type: 'Point',
              coordinates: [99.838, 19.924],
            },
          },
          {
            type: 'Feature',
            properties: {},
            geometry: {
              type: 'Point',
              coordinates: [102.812, 17.408],
            },
          },
          {
            type: 'Feature',
            properties: {},
            geometry: {
              type: 'Point',
              coordinates: [100.458, 7.001],
            },
          },
          {
            type: 'Feature',
            properties: {},
            geometry: {
              type: 'Point',
              coordinates: [100.905, 12.935],
            },
          },
        ],
      };

      TrimbleMaps.setAPIKey('YOUR_API_KEY_HERE');

      const map = new TrimbleMaps.Map({
        container: 'map',
        style: TrimbleMaps.Common.Style.TRANSPORTATION,
        center: [100.507, 13.745],
        zoom: 9,
      });

      map.on('load', () => {
        cities.features.forEach((city, index) => {
          setTimeout(() => {
            map.jumpTo({center: city.geometry.coordinates});
          }, 2000 * index);
        });
      });
    </script>
  </body>
</html>

Last updated June 26, 2025.