generating an ellipse in kml

1,638 views
Skip to first unread message

it

unread,
Oct 14, 2008, 2:37:43 PM10/14/08
to KML Developer Support - Getting Started with KML
I'm trying to come up with an accurate algorithm for generating kml
lat/long coordinates for an Ellipse. What I have so far is not
accurate when it is drawn in the GE and appears smaller than it
should. Are there any funky conversions I need to do?

Here is the equations I'm using:

An ellipse rotated from an angle phi from the origin has as equation:

x= h + a cos( t) cos(phi) - b sin(t) sin(phi)
y = k + bsin(t)cose(phi)+ acos(t)sin(phi)


where (h,k) is the center, a and b the size of the major and minor
axis and t varies from -pi to pi.


Thank you very much

barryhunter [KML Guru]

unread,
Oct 14, 2008, 4:10:24 PM10/14/08
to KML Developer Support - Getting Started with KML
It looks like you working with simple planar geometry - ie on a flat
surface. Whereas the earth is a sphere (or an approximation of one)

So you need more advanced maths, to be honest its beyond me, so cant
actully help you, but know of plenty of circle plotting code, maybe
you can combine in the above equations?

http://www.google.com/search?q=kml+circle

Roman N

unread,
Oct 15, 2008, 2:14:34 PM10/15/08
to KML Developer Support - Getting Started with KML
Hi,

Look for the 'Destination point given distance and bearing from start
point' section on this page:

http://www.movable-type.co.uk/scripts/latlong.html

for a formula and JS code that might help. Given a starting point,
bearing and distance, it returns a destination point. It's perfect for
generating circles, and can probably be modified for ellipses.

- Roman
Reply all
Reply to author
Forward
0 new messages