awmacgr...@gmail.com
unread,Aug 6, 2009, 6:58:38 PM8/6/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to KML Developer Support - Google Earth Plug-in
Hi everyone,
I have plotted a circle (25-sided polygon) at points 0,0 and the
circle is very yummy.
I plot the same circle at point 0,70 (or 70 latitude, 0 longitude) and
the circle appears to be an oval. It is more elongated as the circle's
centre point approaches the pole. Such that if I plot the circle at
0,89 it is essentially a line.
I am using the code (appended below) from Google's KML example
section.
It appears that perhaps this code is calculating points based on a
flat surface, and not one that is on the surface of a sphere.
How can I correct this code to accommodate points approaching poles?
Thanks everyone!
//code:
=======
function createCirclePolygon() {
function makeCircle(radius, x, y) {
var center = ge.getView().copyAsLookAt
(ge.ALTITUDE_RELATIVE_TO_GROUND);
var ring = ge.createLinearRing('');
var steps = 25;
var pi2 = Math.PI * 2;
for (var i = 0; i < steps; i++) {
var lat = 89.12345 + x + radius * Math.cos(i / steps * pi2);
var lng = 0 + y + radius * Math.sin(i / steps * pi2);
ring.getCoordinates().pushLatLngAlt(lat, lng, 0);
}
return ring;
}
var polygonPlacemark = ge.createPlacemark('');
polygonPlacemark.setGeometry(ge.createPolygon(''));
var outer = ge.createLinearRing('');
polygonPlacemark.getGeometry().setOuterBoundary(makeCircle(.05, 0,
0));
ge.getFeatures().appendChild(polygonPlacemark);
}
//endcode