Skip to main content

ExportMap Add-on API

The ExportMap add-on provides the ability to export map image.

Must set map option preserveDrawingBuffer to true when a map is constructed.

Parameters

option type description
options.addButton
boolean
Sets to true to add the export button. If no button is added, uses the instance export function to export map image.
options.pageTitle
boolean
Map image page title
options.top
boolean
Sets map image page top location.
options.left
boolean
Sets map image page left location.
options.width
boolean
Map width
options.height
boolean
Map height

Examples

// Control with defaults
const exportMapControl = new TrimbleMapsControl.ExportMap();

or;

// Customized control
const myMap = new TrimbleMaps.Map({
  container: "map",
  style: TrimbleMaps.Common.Style.TRANSPORTATION,
  zoom: 11,
  center: [-74.635242, 40.358839],
  preserveDrawingBuffer: true, // important!
});
const clientHeight = document.getElementById("map").clientHeight;
const clientWidth = document.getElementById("map").clientWidth;
const exportMapControl = new TrimbleMapsControl.ExportMap({
  pageTitle: "PCM website route 1",
  top: 0,
  left: 0,
  height: clientHeight,
  width: clientWidth,
  addButton: true,
});

myMap.addControl(exportMapControl);

updateOptions

Updates map export options.

Parameters

  • options ExportOptions Map export options.

export

Exports map image allowing user to print map or save map as PNG or PDF file format.

Last updated July 13, 2023.