Skip to content

Problems with measurement #1347

Discussion options

You must be logged in to vote

I know now the problem. The layer has after importing no measurement and also the GlobalOptions (showTooltipOnHover) are not applied. Use this for now:

var layers = L.geoJSON(JSON.parse(data)).addTo(map);
map.pm.setGlobalOptions({ measurements: { measurement: true, displayFormat: 'metric', showTooltipOnHover: true, showTooltip: true} })
layers.eachLayer((layer)=>{
  layer.on('pm:edit',(e)=>{
    e.layer.pm.calcMeasurement(e.layer);
    e.layer.pm.addMeasurementTooltipToLayer(e.layer);
  });

  layer.pm.calcMeasurement(layer);
  layer.pm.addMeasurementTooltipToLayer(layer);
  layer.closeTooltip();
})

PS: It is important to apply the measurement logic exactly like above and not in onEachFe…

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
10 replies
@YTheaudin96t
Comment options

@YTheaudin96t
Comment options

@YTheaudin96t
Comment options

@Falke-Design
Comment options

Answer selected by YTheaudin96t
@Falke-Design
Comment options

@YTheaudin96t
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pro ⭐ Related to Leaflet-Geoman Pro ⭐
2 participants