Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Hello I have a Polyline that I draw on the map and I would like to get its distance in meters.

right now it's not working, basically what I have is

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

The call to Unit.convertUnits throws a GeometryException with "invalid_call".

Any ideas?

thanks,

share|improve this question
    
I think it's failing because the input/output unit 'types' are not the same. That is, not both angular nor linear (nor areas). The help doc for calculateLength2D does say that if the coordinate system is gcs, use geodesicLength from GeometryEngine as @Steve says in the answer below. –  mkennedy Sep 18 '12 at 18:53

1 Answer 1

up vote 1 down vote accepted

I'm not overly familiar with the Android API but I am wondering if GeometryEngine.geodesicLength might be an easier approach.

GeometryEngine.geodesicLength javadoc

share|improve this answer
    
Thank you Steve, this indeed works, I had figured this out a while ago but forgot to edit the question, thank you! –  alessandro ferrucci Sep 19 '12 at 14:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.