Skip to main content

CO2 Emissions

Calculate the CO₂ emissions for a route. See toll detail CO₂ classes for configuration details. Requires Trimble Maps v4.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.7.css" />
        <script src="https://maps-sdk.trimblemaps.com/v4/trimblemaps-4.2.7.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.setAPIKey('YOUR_API_KEY_HERE');
            const map = new TrimbleMaps.Map({
              container: 'map', // container id
                style: TrimbleMaps.Common.Style.TRANSPORTATION, // hosted style id
                center: new TrimbleMaps.LngLat(-74.566234, 40.49944), // starting position
                zoom: 8
            });
            const routeOptions = {
    'hubRouting': false,
    'vehicleType': 0,
    'routeType': 0,
    'tollDiscourage': false,
    'tollRoads': 3,
    'bordersOpen': true,
    'overrideRestrict': false,
    'highwayOnly': false,
    'hazMatType': 0,
    'distanceUnits': 0,
    'trkLCV': false,
    'trkUnits': 0,
    'trkHeight': '13\'1\"',
    'trkLength': '54\'2\"',
    'trkWidth': '100\"',
    'trkWeight': 88180,
    'trkAxles': 2,
    'useSites': true,
    'trlType': TrimbleMaps.Common.TrailerType.TRAILER,
    'trlCount': 1,
    'trlMaxHt': '13\'6\"',
    'trlMaxWt': 4400,
    'trlMaxAxles': 2,
    'isHybrid': false,
    'emiType': TrimbleMaps.Common.EmissionType.EUROVI,
    'minPoll': false,
    'overrideClass': 0,
    'tollCurrency': 0,
    'exchangeRate': 1.355,
    'tollPlan': '',
    'region': 'eu',
    'afSetIDs': [],
    'useAvoidsAndFavors': false,
    'useTraffic': false,
    'frameRoute': true,
    'ferryDiscourage': false,
    'routeId': '2',
    'routeColor': '#62A82F',
                    'co2Class': 4,
    'stops': [
        {
            'lngLat': {
                'lng': 13.376589,
                'lat': 52.533742
            },
            'address': {
                'StreetAddress': 'Chausseestrasse 97', 'City': 'Berlin', 'State': 'BE', 'Zip': '10115', 'County': 'Berlin', 'Country': null

            },
            'costs': {
                'CostOfStop': 0, 'HoursPerStop': 0, 'Loaded': true, 'OnDuty': true, 'UseOrigin': false
            }
        },
        {
            'lngLat': {
                'lng': 10.000901,
                'lat': 53.551237
            },
            'address': {
                'StreetAddress': '', 'City': 'Hamburg', 'State': 'HH', 'Zip': '20095', 'County': 'Hamburg', 'Country': null

            },
            'costs': {
                'costOfStop': 0,
                'hoursPerStop': 0,
                'loaded': true,
                'onDuty': true,
                'useOrigin': false
            }
        }
    ],
    'reportType': [
        'Mileage',
        'Detail',
        'Directions',
        'State',
        'Road'
    ],
    'requestMethod': 'POST',
    'dragOptions': {
        'snapKey': 'shiftKey',
        'snapMode': 2
    },
    'includeTrimblePlaceIDs': true,
    'isVisible': true
 };
    const myRoute = new TrimbleMaps.Route(routeOptions);
    myRoute.on('report', (reports) => {
        console.log(reports);
    });
    map.on('load', () => {
        myRoute.addTo(map);
    });
        </script>
    </body>
</html>
Last updated March 26, 2026.