code: function(geometry, units) {
          var length, geomUnits;
          if(this.geodesic) {
              length = geometry.getGeodesicLength(this.map.getProjectionObject());
              geomUnits = "m";
          } else {
              length = geometry.getLength();
              geomUnits = this.map.getUnits();
          }
          var inPerDisplayUnit = OpenLayers.INCHES_PER_UNIT[units];
          if(inPerDisplayUnit) {
              var inPerMapUnit = OpenLayers.INCHES_PER_UNIT[geomUnits];
              length *= (inPerMapUnit / inPerDisplayUnit);
          }
          return length;
      }
docs: Method: getLength
  
  Parameters:
  geometry - {<OpenLayers.Geometry>}
  units - {String} Unit abbreviation
  
  Returns:
  {Float} The geometry length in the given units.