Skip to content

Measurement Scope to specific layer. #1531

Discussion options

You must be logged in to vote

I think the best way for you is this:

map.on("pm:create", ({ layer }) => {
  const measurements = {
    measurement: true,
    showTooltip: true,
    showTooltipOnHover: true,
    totalLength: true,
    segmentLength: true,
    area: true,
    radius: true,
    perimeter: true,
    height: true,
    width: true,
    coordinates: true,
    displayFormat: 'metric',
  };

  layer.on('pm:enable', (e)=>{
    layer.pm.setOptions({measurements}); // enables measurement calculation
    layer.pm.addMeasurementTooltipToLayer(layer); // Adds the tooltip to the layer
  });
  layer.pm.setOptions({measurements}); // enables measurement calculation
  layer.pm.addMeasurementTooltipToLayer(layer); // Adds…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@dvazquez-lightbox
Comment options

@Falke-Design
Comment options

@Falke-Design
Comment options

Answer selected by dvazquez-lightbox
@dvazquez-lightbox
Comment options

@dvazquez-lightbox
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants