Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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=

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

Any ideas?

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
up vote 2 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


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.