Dear Larry,
Below is my function for drawCircle. So I have convert it to
something like this var newRadius = radius/0.000621371192; but the circle
does not appear. What is my mistake? I have converted my radius value from
meter to mile.
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
alert("radius : "+radius);
var newRadius = radius/0.000621371192;
alert("newRadius : "+newRadius);
var rlat = (newRadius/earthsradius) * r2d;
var rlng = rlat / Math.cos(point.lat() * d2r);
alert("TEST : "+point.lng());
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;
}
On Thu, Sep 9, 2010 at 5:04 AM, [email protected]
<[email protected]>wrote:
> On Sep 8, 1:43 pm, ss ss <[email protected]> wrote:
> > Dear Larry,
> > I have managed to study the codes you gave me earlier and
> > able to generate my circles. The problem now is that my radius is in the
> > form of meters.
>
> What is the problem with meters? If your circle is the wrong size,
> eiher:
> 1. convert your desired radius to meters
> or
> 2. change the circle drawing code to use your desired units (which I
> can't see specified anywhere in this thread) to meters
> If you need help converting units, google has a wonderful search
> engine.
>
> -- Larry
>
> > So what must I do to adjust it. So time being I just put the
> > radius value as 10 as the codes below. Thank you.
> >
> > var centerPoint = new GLatLng(getDetails[1], getDetails[0])
> > var myCircle = new GPolygon(drawCircle(centerPoint,10,map));
> > map.addOverlay(myCircle);
> > map.setCenter(centerPoint, 8);
> >
> >
> >
> > On Mon, Aug 23, 2010 at 9:55 AM, ss ss <[email protected]> wrote:
> > > Dear Larry,
> > > Yes this is how I want I dont want the other stroke
> line in
> > > the circle. Ok give me some time to go through the codes then I will
> get
> > > back to you. Thank you once again.
> >
> > > On Mon, Aug 23, 2010 at 9:21 AM, [email protected] <
> > > [email protected]> wrote:
> >
> > >> On Aug 22, 6:09 pm, ss ss <[email protected]> wrote:
> > >> > Dear Larry,
> > >> > I have put the link at this sitehttp://
> > >> 116.0.102.219/maps/overlappingPolygons.html. Can you have a look?
> >
> > >> What was the question?
> >
> > >> Are you asking about reducing the "stroke" size?
> > >>http://www.geocodezip.com/overlappingPolygonsNoStroke.asp
> >
> > >> -- Larry
> >
> > >> > On Sun, Aug 22, 2010 at 11:31 PM, [email protected] <
> > >> [email protected]
> >
> > >> > > wrote:
> > >> > > 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.aspbutthecurveisnot
> > >> > > > > > > > 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%[email protected]>
> <google-maps-api%2bunsubscr...@googlegroups.com>
> > >> <google-maps-api%2Bunsubscribe@ googlegroups.com>
> > >> > > <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%[email protected]>
> <google-maps-api%2bunsubscr...@googlegroups.com>
> > >> <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%[email protected]>
> <google-maps-api%2bunsubscr...@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%[email protected]>
> <google-maps-api%2bunsubscr...@googlegroups.com>
> > >> .
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/google-maps-api?hl=en.- Hide quoted
> text -
> >
> > - Show quoted text -
>
> --
> 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%[email protected]>
> .
> 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.