OptionaladapterTerraDrawMaplibreGLAdapter options. Please refer the default adapter settings (BaseAdapterConfig) at the below TerraDraw code. https://github.com/JamesLMilner/terra-draw/blob/806e319d5680a3f69edeff7dd629da3f1b4ff9bf/src/adapters/common/base.adapter.ts#L28-L48
OptionalareaThe precision of area value. Using setter to override the value if you want.
OptionalcomputeCompute elevation for each node in linestring measure mode.
This is an optional parameter and default is False. If true, the property of elevation is added to TerraDraw feature.
As default, an elevation is not shown in label if it is negative value (The data is added to the feature property though).
If you wish to show negative value of altitude, you may need to edit your own lineLayerLabelSpec style spec.
If terrainSource is set, this feature uses queryTerrainElevation function of maplibre-gl, thus you have to add and enable raster-dem source in maplibre style in advance.
For instance, the below code is to add Terrarium source from AWS
map?.addSource('terrarium', {
  type: 'raster-dem',
  attribution: '© <a href="https://github.com/tilezen/joerd/blob/master/docs/attribution.md" target="_blank" rel="noopener">Tilezen Joerd</a>',
  tiles: [
    'https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png'
  ],
  minzoom:0, maxzoom: 5, tileSize: 256,
  encoding: 'terrarium',
  bounds: [-180, -90, 180, 90]
})
map?.setTerrain({source: 'terrarium', exaggeration: 1})
The plugin control is just querying elevation from maplibre style's DEM source. Hence, the elevation's accuracy may not be good and queried elevation might be different each zoom level.
If terrainSource is set to use either terrainRGB or terrarium source, the plugin will try to fetch elevation directly from DEM tiles.
OptionaldistanceThe precision of distance value. It will be set different value dwhen distance unit is changed. Using setter to override the value if you want.
OptionalelevationElevation cache configuration.
If undefined is set to this option, the plugin uses default cache configuration.
Default is enabled with maxSize 1000, ttl 1 hour, and precision 9.
If you want to disable elevation cache, set enabled to false.
Note: If you disable elevation cache, the plugin will query elevation from DEM tiles every time when you measure linestring even if the same coordinates appear repeatedly. This may make the response slow.
OptionalforceDefault is auto. If auto is set, the unit is converted automatically based on the value.
If a specific unit is specified (e.g., 'km', 'm', 'cm', 'mi', 'ft', 'in'), the value is always returned in that unit.
This property is only effective when distanceUnit is set to 'kilometers' or 'miles'.
If distanceUnit is set to other values (e.g., 'degrees', 'radians'), it will be ignored, and auto will be applied.
If you need to force other unit type, please use DistanceUnit property.
OptionalforceDefault is auto. If auto is set, unit is converted depending on the value in metric. If a specific unit is specified, it returns the value always the same.
This property is only effective when distanceUnit is set to 'kilometers'. If distanceUnit is set to other than 'kilometers', it will be ignored, and auto will be applied.
If you need to force other unit type, please use DistanceUnit property.
OptionallineMaplibre symbol layer specification (on line nodes) for line distance layer
OptionalmeasureMeasure unit symbols. If you want to change the default symbol, please overwrite the symbol by this option.
OptionalmeasureThe unit of measurement can be metric or imperial. Default is metric
OptionalmodeOverwrite Terra Draw mode options if you specified.
OptionalmodesTerradraw modes added to the control. The mode will be added in the same order of the array. Default is all modes in the below order: ['render','point','linestring','polygon', 'rectangle','angled-rectangle','circle', 'freehand','sector','sensor', 'delete']
You can change the order of modes, or can get rid of some modes which you don't need for your app.
OptionalopenOpen editor as default if true. Default is false
OptionalpointMaplibre symbol layer specification (on points) for point layer
OptionalpolygonMaplibre symbol layer specification (centroid) for polygon area layer
OptionalroutingMaplibre circle layer specification for visualizing node style of line distance layer
Optionalterrainterrain source either terrain RGB or terrarium formats for computing elevation If undefined is set to this option, the plugin tries to fetch elevation enabled terrain of maplibre. As default, terrarium source from AWS is set.
MeasureControl Plugin control constructor options