RE: [OpenMap Users] Radius error when editing an OMCircle

From: Sebastien Rosset <>
Date: Mon, 25 Jul 2005 17:25:57 -0700

When you construct the OMCircle, the class converts your units to radians
(and getRadius() returns the distance in decimal degrees).
It is easy to convert back to meters or whatever unit you want:

double rad = Length.METER.toRadians(400.0);
double decd = Length.DECIMAL_DEGREE.fromRadians( rad ); // This is what
OMCircle.getRadius() returns

// Convert back to meters:
double d1 = Length.METER.fromRadians(Length.DECIMAL_DEGREE.toRadians(decd));

// or feet if you wish:
double d1 = Length.FEET.fromRadians(Length.DECIMAL_DEGREE.toRadians(decd));

Sebastien Rosset.

>-----Original Message-----
>[] On Behalf Of Jesper Berglund
>Sent: Monday, July 25, 2005 4:14 PM
>Subject: [OpenMap Users] Radius error when editing an OMCircle
>Hello Folks!
>I am currently playing around with the editing stuff in
>OpenMap and I ran into this.
>I place an OMCircle on the map and creates it as this;
> OMCircle circle = new OMCircle( lat, lon,
>position.getRadius(), Length.METER );
>adds the circle to the layer and everything works perfectly.
>I save the circle reference because I want to know the changes.
>When the user has edited it I gather the data in a custom
>class and send it to a server, but when I look at the radius
>it is not the correct value. eg 400 meters become 0.0035 ... =(
>I have traced it to when I ask for the radius on OMCircle (
>OMArc ) it converts the radians with
>Length.DECIMAL_DEGREE.fromRadians( float ) and not the length
>unit I sent in. This calculation makes the radius almost zero.
>Is this a bug or am I using the classes wrong?
>Should the getRadius method take a Length class to convert the
>rads to the correct value??
>Jesper Berglund
>GUI Developer
>Pertexo Systems AB

[To unsubscribe to this list send an email to ""
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Jul 25 2005 - 20:35:03 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT