[Cartoweb-users] Meansure area cartoweb

M_Becker moacirnetto at yahoo.com.br
Thu Oct 19 07:59:51 EDT 2006


I have problem with the function getArea() , I need to calculate the area of coordinate in SAD 69    SRID: 4291



Feature.prototype.getArea = function() {
  //TODO area for circle
  if (this.vertices.length > 1) {
    //surface calculation
    var measure = 0;
    for (var i = 0; i<this.vertices.length - 1;i++)
      measure += this.vertices[i].x * this.vertices[i+1].y - this.vertices[i+1].x * this.vertices[i].y;
      measure += this.vertices[this.vertices.length -1].x * this.vertices[0].y - this.vertices[0].x *       this.vertices[this.vertices.length -1].y;
      return Math.abs(measure) / 2;
  } else {
    return 0;
  }




		
_______________________________________________________ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale 
o discador agora! 
http://br.acesso.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20061019/03dc11c0/attachment.html


More information about the Cartoweb-users mailing list