Skip to content

Commit

Permalink
Merge pull request #4730 from rldhont/fix-digitizing-measure
Browse files Browse the repository at this point in the history
 [Bugfix] JS Digitizing measure : Provide map projection
  • Loading branch information
rldhont authored Sep 6, 2024
2 parents 69cefdf + 01d0ef8 commit 53cd25c
Show file tree
Hide file tree
Showing 4 changed files with 614 additions and 260 deletions.
4 changes: 2 additions & 2 deletions assets/src/modules/Digitizing.js
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ export class Digitizing {
* @returns {string} The formatted length.
*/
formatLength(geom) {
const length = getLength(geom);
const length = getLength(geom, {projection: mainLizmap.map.getView().getProjection()});
let output;
if (length > 100) {
output = Math.round((length / 1000) * 100) / 100 + ' ' + 'km';
Expand All @@ -870,7 +870,7 @@ export class Digitizing {
* @returns {string} Formatted area.
*/
formatArea(polygon) {
const area = getArea(polygon);
const area = getArea(polygon, {projection: mainLizmap.map.getView().getProjection()});
let output;
if (area > 10000) {
output = Math.round((area / 1000000) * 100) / 100 + ' ' + 'km<sup>2</sup>';
Expand Down
1 change: 1 addition & 0 deletions tests/end2end/playwright/draw.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test.describe('Draw', () => {
});

test('All draw tools', async ({ page }) => {
await page.locator('#dock-close').click();
// Point
await page.locator('#draw').getByRole('link').nth(1).click();
await page.locator('.digitizing-point > svg').click();
Expand Down
Loading

0 comments on commit 53cd25c

Please sign in to comment.