Rasterex APINPM Package/docs/components/measurement/api

API References

Technical references for measurement tool identifiers.

Method Signatures

Measurement tools use the standard Viewer SDK methods for commanding the canvas.

// 1. Tool Activation
await viewer.tools.set({ group: 'measurement', action: 'MEASURE_LENGTH', enabled: true });

// 2. Persistence Commands
await viewer.annotations.save();
await viewer.annotations.delete({ guid: 'guid-here' });
viewer.annotations.setAutoSave({ enabled: true });

// 3. Reset/Clear
viewer.tools.clear();

// 4. Data Extraction
const data = await viewer.annotations.getData({ filter: 'all' });

// 5. Continuous count-point mode
await viewer.annotations.insertCountPointMode({
  enabled: true,
  guid: 'COUNT-ANNOTATION-GUID'
});
Method Signatures

Event Interfaces

TypeScript definitions for measurement-related event payloads emitted by the Viewer SDK.

// Import directly from @rasterex/viewer
import type { 
  AnnotationCreatedEvent, 
  AnnotationSelectedEvent,
  AnnotationDeletedEvent 
} from '@rasterex/viewer';

// Example listener
viewer.annotations.on('created', (event: AnnotationCreatedEvent) => {
  console.log('Created annotation:', event.guid);
  console.log('Data:', event.data?.DimText, event.data?.Tool);
});
Event Interfaces

Tool Identifiers

Available action IDs for the measurement group.

Measurement Tool IDs

const measurementToolIds = [
  'MEASURE_LENGTH',
  'MEASURE_AREA',
  'MEASURE_PATH',
  'MEASURE_ARC',
  'MEASURE_ANGLE_CCLOCKWISE',
  'MEASURE_RECTANGULAR_AREA',
  'COUNT',
  'SNAP',
];