How-to configure the Measure tool
The measure tool is managed as a part of the ServiceManager component. Therefore, all the options for the measure tool are passed in as options to the ServiceManger component when it’s added to the application.
Here’s the example from the demo:
app.add(gm3.components.ServiceManager, 'service-tab', {
services: true,
measureToolOptions: {
pointProjections: point_projections
}
});
pointProjectionsis an array of projection and label definitions, that is defined the same as with the Coordinate Display. When a user clicks on a point on the map, the point will be shown in all of the defined projections.initialUnitsis one of:mfor meters.kmfor kilometers.ftfor feet (this is the default).mifor miles.chfor chains.afor acres.hfor hectares.
Example of setting the default units to meters
The code below will set the default the measurement units to meters instead of feet.
app.add(gm3.components.ServiceManager, 'service-tab', {
services: true,
measureToolOptions: {
pointProjections: point_projections,
initialUnits: 'm'
}
});