convert geometry measurement into meters

Discussion created by alessandroferrucci on Sep 18, 2012
Latest reply on Sep 18, 2012 by njarecha-esristaff
Hi I have a polyline that I'm drawing on the map and I'd like to calculate its length in meters.

Currently I do this:
distanceSeg=new Polyline();
double  len1=distanceSeg.calculateLength2D();
double m_len=Unit.convertUnits(len1, Unit.create(AngularUnit.Code.DEGREE) ,Unit.create(LinearUnit.Code.METER));

but the call to Unit.convertUnits throws  a GeometryException...any idea what I'm doing wrong?