On Aug 22, 8:03 am, ss ss <[email protected]> wrote:
> Dear Larry,
> I have actually stream down the codes to only one
> circle. Below is the codes.
1. Please post a link not code.
2. Please ask a question (if the question is still "how do I avoid
it?", I can see it from the code you posted, I need a link for that).
-- Larry
>
> function createPolygon(polygon, html) {
> var infoHtml = html;
> polys.push(polygon);
> GEvent.addListener(polygon, "click", function(overlaylatlng) {
> if(overlaylatlng){
> map.openInfoWindow(overlaylatlng, infoHtml);
> }
> });}
>
> function drawCircle(point, radius, map) {
> var d2r = Math.PI / 180; // degrees to radians
> var r2d = 180 / Math.PI; // radians to degrees
> var earthsradius = 3963; // 3963 is the radius of the earth in miles
> var points = 64;
> // find the raidus in lat/lon
> var rlat = (radius / earthsradius) * r2d;
> var rlng = rlat / Math.cos(point.lat() * d2r);
>
> var extp = new Array();
> for (var i=0; i < points+1; i++) // one extra here makes sure we connect
> the
> {
> var theta = Math.PI * (i / (points/2));
> ex = point.lng() + (rlng * Math.cos(theta)); // center a + radius x *
> cos(theta)
> ey = point.lat() + (rlat * Math.sin(theta)); // center b + radius y *
> sin(theta)
> extp.push(new GPoint(ex, ey));
> }
> return extp;}
>
> // Display the map, with some controls and set the initial location
> var map = new GMap2(document.getElementById("map"));
> map.addControl(new GLargeMapControl());
> map.addControl(new GMapTypeControl());
> map.setCenter(new GLatLng(0,0),8);
>
> var color =["#000000", "#800000","#F00000", "#008000", "#00F000",
> "#000080", "#0000F0","#808000", "#F0F000", "#008080"];
> for (var i=1; i < 2; i++) {
> createPolygon(new GPolygon(drawCircle(new GLatLng(0,0), (10-i)*10,
> map), color[i], 10,i/10, color[i], i/10), "polygon "+ i);
> map.addOverlay(polys[polys.length-1]);
> }
>
> On Sun, Aug 22, 2010 at 10:57 PM, [email protected] <[email protected]
>
> > wrote:
> > On Aug 22, 7:13 am, ss ss <[email protected]> wrote:
> > > Dear Larry,
> > > How about version 3 can I use is it?
>
> > Sure.
>
> > > How to use it?
>
> > Just like v2, read the documentation, just be wary, it is similar to
> > v2 but not the same.
>
> > > Ok in that example I notice there is two line one is inside the thick one
> > > how to avoid it.
>
> > I'm not sure what you mean by that. The arguments of the polygon
> > constructor are documented. Where is your map that shows the behavior
> > that you don't want and what have you tried to fix it?
>
> > -- Larry
>
> > > Below is the code
> > > createPolygon(new GPolygon(drawCircle(new GLatLng(0,0), (10-i)*10, map),
> > > color[i], 10,i/10, color[i], i/10), "polygon "+ i);
>
> > > Ok about the second question for now to know the lat long I will split
> > the
> > > string for e.g. POINT(103.92508506774902 1.461838406932495). So I am
> > > wondering is there any other better method? Thank you.
>
> > > On Sun, Aug 22, 2010 at 9:36 PM, [email protected]
> > > <[email protected]>wrote:
>
> > > > On Aug 22, 3:05 am, ss <[email protected]> wrote:
> > > > > Dear All,
> > > > > I can read this value from my database for a circle geo
> > > > > fence. Thus I also have a radius value. What is the best method to
> > > > > draw a perfect circle as I have gone to this sitehttp://
> > > >www.geocodezip.com/overlappingPolygons.aspbutthecurve is not
> > > > > smooth?
>
> > > > In v2 you can't really draw a "perfect circle", the approximation used
> > > > in that page is a 32 sided polygon:
> > > > var points = 32;
>
> > > > The more points, the closer to a circle it will be, but the more time
> > > > it will take to draw.
>
> > > > > Any idea the format I am reading is for
> > > > > e.g.POINT(103.92508506774902 1.461838406932495).
>
> > > > That shouldn't have anything to do with the circle. Or is this a
> > > > second question?
>
> > > > -- Larry
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Google Maps API" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<google-maps-api%2Bunsubscribe@
> > > > googlegroups.com>
> > <google-maps-api%2Bunsubscribe@ googlegroups.com>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/google-maps-api?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Maps API" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-maps-api%2Bunsubscribe@
> > googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-maps-api?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.