JavaScript Maps SDK
Contents
With the JavaScript Maps SDK, you can embed interactive, highly customizable maps into web and desktop applications. (For mobile applications, please see our Mobile Maps SDK.) Our maps are built on commercial vehicle-specific data from Trimble Maps, which allows you to plan and visualize safe, legal, and efficient routes for all types of vehicles, around the world. With features ranging from traffic data to weather alerts and road conditions, our Maps SDK is ideal for any application that demands maps for work.
The example below shows the out-of-the-box features of our maps. The map can be modified using the Example Code drop-down at the bottom. The SDK is also used in the modern version of our PC*Miler Web application.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link rel="stylesheet" href="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.21.0.css" /> <script src="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.21.0.js"></script> <style> body { margin: 0; padding: 0; } #map { position: absolute; top: 0; bottom: 0; width: 100%; } </style> </head> <body> <div id="map"></div> <script> TrimbleMaps.APIKey = 'YOUR_API_KEY_HERE'; const map = new TrimbleMaps.Map({ container: 'map', // container id style: TrimbleMaps.Common.Style.TRANSPORTATION, //hosted style id center: [-75, 40], // starting position zoom: 9 // starting zoom }); </script> </body> </html>
The Maps SDK is available via two JavaScript libraries:
-
A library to render interactive maps in WebGL using vector map tile data—the latest generation of interactive mapping. This library is recommended for new users, as it provides better speed, capabilities, and customization than older mapping platforms. The documentation in this section covers our vector map tile offering. You can read more about the benefits of vector maps in our developer portal Features Guide.
-
Our classic library (formerly known as ALK Maps), which renders maps using raster tiles. This library is constantly updated with new images and new map data for existing users. It may be an option for select new users building maps for older devices with limited display capabilities. For documentation for our Maps SDK version with raster tiles, please visit this page.