Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

GoogleMapAPI 2.3 class and function drawCircle

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
nontek
Smarty n00b


Joined: 23 Mar 2007
Posts: 1
Location: Cologne

PostPosted: Sat Mar 24, 2007 8:13 am    Post subject: GoogleMapAPI 2.3 class and function drawCircle Reply with quote

Hello,

i want to use the following function, but i do not know how to integrate an use this with your nice class. Can anyone help me?


Code:
function drawCircle(point, radius, color) {
                        var cColor = color;
                        var cWidth = 5;
                        var Cradius = radius;   
                        var d2r = Math.PI/180;
                        var r2d = 180/Math.PI;
                        var Clat = (Cradius/6377.83027)*r2d;
                        var Clng = Clat/Math.cos(point.lat()*d2r);
                        var Cpoints = [];
                        for (var i=0; i < 33; i++) {
                            var theta = Math.PI * (i/16);
                            var CPlng = point.lng() + (Clng * Math.cos(theta));
                            var CPlat = point.lat() + (Clat * Math.sin(theta));
                            var P = new GLatLng(CPlat,CPlng);
                            newBounds.extend(P);
                            Cpoints.push(P);
                        }
                        map.addOverlay(new GPolyline(Cpoints,cColor,cWidth));
                    }



regards,
Matthias
Back to top
View user's profile Send private message Visit poster's website
miketonks
Smarty n00b


Joined: 02 Jun 2007
Posts: 1

PostPosted: Sat Jun 02, 2007 1:30 pm    Post subject: Extended Polylines for GoogleMapAPI Reply with quote

Hi there,

I'm working on something similar - as far as I can tell the API doesn't handlt polylines with more than two points. You can extend the class to add your own functions, as I've done here:

[link below]

It's not quite the same, but the principle is there. You probably need to add a function addCircle in a similar way to my locationBar and override the getMap function.

What would be nice is a getMapCustom() function in the API which by default returns nothing but allows us to hook in and append custom code to the getMap function without duplicating the entire function.

Alternatively you could generate the circle points in php as a csv string and use my addPolyLineByCoordsString function.

hope this helps, mike

PS er - it won't let me post url's because I'm a new user. Let's try this...

h t t p :// greenmap [dot] cvs [dot] sourceforge [dot] net/greenmap/greenmap/php/clsGoogleMap.php?revision=1.3&view=markup
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP