Skip to content

Commit

Permalink
Fallback to featureCrs if no displayCrs is passed to updateFeatureMea…
Browse files Browse the repository at this point in the history
…surements
  • Loading branch information
manisandro committed Dec 11, 2024
1 parent 47ae485 commit 5b988f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utils/MeasureUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,12 @@ const MeasureUtils = {
lenUnit: settings.lenUnit,
areaUnit: settings.areaUnit
};
const displayCrs = settings.displayCrs ?? featureCrs;
feature.set('label', '');
feature.set('segment_labels', undefined);
const geom = feature.getGeometry();
if (geomType === 'Point') {
feature.set('label', CoordinatesUtils.getFormattedCoordinate(geom.getCoordinates(), featureCrs, settings.displayCrs));
feature.set('label', CoordinatesUtils.getFormattedCoordinate(geom.getCoordinates(), featureCrs, displayCrs));
} else if (geomType === 'LineString') {
const lengths = MeasureUtils.computeSegmentLengths(geom.getCoordinates(), featureCrs, geodesic);
measurements.segment_lengths = lengths;
Expand Down

0 comments on commit 5b988f1

Please sign in to comment.