Opened 13 years ago

Closed 13 years ago

#343 closed defect (fixed)

Measure: Area is wrong when unit of Map CS is feet

Reported by: christinebao Owned by: Christine Bao
Priority: P2 Milestone: Future
Component: Widgets Version: 1.1.1
Severity: Major Keywords: Measure
Cc: Jenny He, arthur.liu@… Browser: All
External ID: 1281984 Operating System: All
state: Committed


From Autodesk QA report:


  1. Open one flexible web layout which Unit of CS is feet.
  2. Measure -> Draw one triangle

Check the number of area and the value is wrong.

Attachments (1)

MeasureArea.patch (722 bytes ) - added by christinebao 13 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by christinebao, 13 years ago

Tech diagnosis:
The code for measure area is:

    updateMarker: function(marker, geom) {
        if (!marker) {
        var quantity, from, to;
        var v = geom.getVertices();
        var map = this.getMap();
        var proj = map.oMapOL.baseLayer.projection;
        if (geom.CLASS_NAME.indexOf('LineString') != -1) {
            from = this.getMap().geoToPix(v[0].x,v[0].y);
            to = this.getMap().geoToPix(v[1].x,v[1].y);
            at = {x: (from.x + to.x) / 2, y: (from.y + to.y) / 2};
            quantity = geom.getGeodesicLength(proj);
            measureUnits = Fusion.METERS;
            if (measureUnits != this.units) {
              quantity = Fusion.convert(measureUnits, this.units, quantity);
        } else {
            var cg = geom.getCentroid();
            at = this.getMap().geoToPix(cg.x, cg.y);
            quantity = geom.getGeodesicArea(proj);
            //TODO: result is in square meters - convert to other units?
        if (quantity > 1) {
            this.positionMarker(marker, at);

Please note: there is a TODO here: result is in square meters - convert to other units?

As the map unit is feet, and length is measured in feed, it's better to convert the area from square meters to square feets.

Add the code to fix this defect:

           quantity = geom.getGeodesicArea(proj);

            measureUnits = Fusion.METERS;
            if (measureUnits != this.units) {
                var rate = Fusion.convert(measureUnits, this.units, 1);
                quantity = quantity * rate * rate;

In this way, the quantity is coverted to square feets if needed.

by christinebao, 13 years ago

Attachment: MeasureArea.patch added

comment:2 by christinebao, 13 years ago

Attach patch for fixing this defect. Please review. Thank you!

comment:3 by liuar, 13 years ago

Reviewed. Please submit the code. Thanks.

comment:4 by christinebao, 13 years ago

Resolution: fixed
state: NewCommitted
Status: newclosed

Commit the patch to fix this defect.

Note: See TracTickets for help on using tickets.