Re: [OpenMap Users] OMCircle Distortion?

From: Christopher Franklin <christopher.franklin_at_lmco.com>
Date: Mon, 28 Jul 2008 15:42:21 -0400

Hi Don,

Thanks for replying so quickly.

Don Dietrick wrote:

> Hi Chris,
>
> Christopher Franklin wrote:
>> Greetings,
>>
>> I am working on a project that requires a user to select an area on
>> the map by using a circle. The user clicks to select the center and
>> then again to select the edge (radius). I am using an OMCircle
>> because it exhibits the proper behavior for a circle on a globe.
>>
>> I have noticed a problem with the OMCircle though. After drawing it
>> using the provided center and radius I am adding a graphic to
>> represent the center and another to represent the rightmost edge of
>> the circle. When the circle is drawn on or near the equator
>> everything appears correct. However, if the circle is drawn north or
>> south there is a noticeable distortion in how the circle and the edge
>> handle are drawn. I have done some experimentation and discovered
>> that the handle is being drawn in the correct location, but the edge
>> of the circle is not. The further away from the equator the greater
>> the discrepancy between my handle location and the OMCircle edge. If,
>> however, I move the handle to the top of the circle it is always
>> drawn in the correct location. For usability purposes I would like
>> the handle to be on the right hand side! Is there a way to fix this?
>> If not, I guess they will have to deal with the handle being on the
>> top or bottom of the circle...
>
> How are you creating the handle location, and what are its location
> parameters? How do you know the handle is in the right place?
The handle location is being generated by taking the current position of
the center in Lat/Lon and adding the circle radius to the Longitude. To
generate the the handle position on the "top" of the circle I instead
added the radius to the Latitude.

To determine that the handle was in the proper location took a bit of
experimentation. I have the ability to produce multiple circles at a
time. By experimentation I determined that by clicking on the center of
the circle and my artificial handle I was able to create the same size
of circle. If I click on the center and then put the radius on the
displayed circle edge I get a new circle with the edge handle being
drawn in the location of my second mouse click, but the drawn edge of
the circle is about 1 degree further out. The distance of the distortion
increases the further away from the equator I place the circle. The
problem persists at lower levels of zoom, although the ratio of
distances stays the same, just the scale changes. For instance at a 100k
zoom level the circle edge would be drawn about 1k further out than it
should be.

I hope this helps make the problem clearer... it is easier to see than
to describe in words!
>
> OMCircles created with distance radius shouldn't appear as circles in
> certain projections when you move away from the equator. Pixel
> distance from the center will vary along the circle edge for the same
> distance (depends on latitude, angle on edge from center).
I realize this. In fact, the problem I am trying to describe is actually
drawing the circle as far more circular than it actually should be. The
handle I am laying down shows that the circle is slightly off from where
it should be. I am going to go out on a limb here and hypothesize that
what it looks like is the 800m difference between 1 degree lat and 1
degree lon is not being taken into account. Feel free to slap me if I am
wrong on that one!
>
>>
>> Another problem I would like to bring up is when zoomed in to a small
>> area (~1m scale) the OMCircle draws as a polygon approximation of a
>> circle. Is there a way to increase the number of segments being drawn
>> at that low of scale?
>>
>
> OMCircles let you set the number of segments used to represent the
> circle, but you might be seeing a precision problem that occurs from
> using floats in the OMCircle. The next version of OpenMap will
> address the precision problem.
>
> Hope this helps,
>
> Don
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]

I hope this clarifies things a little for you. If not let me know and I
can either clarify more or post some code if that would help.

Thanks,

Chris

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Jul 28 2008 - 15:43:11 EDT

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