code: function(projection) {
          var ring = this;  // so we can work with a clone if needed
          if(projection) {
              var gg = new OpenLayers.Projection("EPSG:4326");
              if(!gg.equals(projection)) {
                  ring = this.clone().transform(projection, gg);
              }
          }
          var area = 0.0;
          var len = ring.components && ring.components.length;
          if(len > 2) {
              var p1, p2;
              for(var i=0; i<len-1; i++) {
                  p1 = ring.components[i];
                  p2 = ring.components[i+1];
                  area += OpenLayers.Util.rad(p2.x - p1.x) *
                          (2 + Math.sin(OpenLayers.Util.rad(p1.y)) +
                          Math.sin(OpenLayers.Util.rad(p2.y)));
              }
              area = area * 6378137.0 * 6378137.0 / 2.0;
          }
          return area;
      }
docs: APIMethod: getGeodesicArea
  Calculate the approximate area of the polygon were it projected onto
  the earth.  Note that this area will be positive if ring is oriented
  clockwise, otherwise it will be negative.
  
  Parameters:
  projection - {<OpenLayers.Projection>} The spatial reference system
  for the geometry coordinates.  If not provided, Geographic/WGS84 is
  assumed.
  
  Reference:
  Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for
  Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion
  Laboratory, Pasadena, CA, June 2007 http://trs-new.jpl.nasa.gov/dspace/handle/2014/40409
  
  Returns:
  {float} The approximate signed geodesic area of the polygon in square
  meters.