A Basic Map
The easiest way to learn about Trimble MAPS is to see a basic example. This code will produce a map centered on the lower 48 states of the U.S.
Princeton example test
CDN Example
Include the JavaScript and CSS files in the <head>
of your HTML file.
<link href="https://cdn.trimblemaps.com/styles/v2/trimblemaps.2.1.1.css" rel="stylesheet">
<script src="https://cdn.trimblemaps.com/js/v2/trimblemaps.2.1.1.js"></script>
Include the following code in the <body>
of your HTML file.
<div id="myMap" style="height: 600px; width: 800px;"></div>
<script>
TrimbleMaps.APIKey = "YOUR_KEY_HERE";
var myMap = new TrimbleMaps.Map({
container: "myMap",
center: new TrimbleMaps.LngLat(-96, 35),
zoom: 3
});
</script>
NPM Example
Install the npm package
npm install --save @trimblemaps/trimblemaps-js
Include the JavaScript and CSS files in the <head>
of your HTML file.
<link href="https://cdn.trimblemaps.com/styles/v2/trimblemaps.2.1.1.css" rel="stylesheet">
import TrimbleMaps from '@trimblemaps/trimblemaps'
TrimbleMaps.APIKey = "YOUR_KEY_HERE";
const myMap = new TrimbleMaps.Map({
container: "YOUR_DIV_HERE",
center: new TrimbleMaps.LngLat(-96, 35),
zoom: 3
});