Ok, I made a page with just the map and some java script in it. I
thought had had it figured out, but still no cigar.
Here is what I have. (I left the key out, I don't know if you're
allowed to post those)
[code]
<html>
<head>
<title> test</title>
<!-- this is where the google maps api key goes -->
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setMapType(G_HYBRID_MAP);
map.setCenter(new GLatLng(51.2278, -177.0891), 3);
var color =["#000000", "#800000","#F00000", "#008000", "#00F000",
"#000080", "#0000F0", "#808000", "#F0F000",
"#008080"];
// for (var i=1; i < 10; i++) {
// createPolygon(new GPolygon(drawCircle(map.getCenter(),
color[i], 10,i/10, color[i], i/10), "polygon "+ i);
// map.addOverlay(polys[polys.length-1]);
// }
createPolygon(new GPolygon(drawCircle(map.getCenter(), "#FFFA73",
4, .8, "#FFFA73", .8), "test");
map.addOverlay(polys[polys.length-1]);
}
}
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;
var r2d = 180 / Math.PI;
var earthsradius = 3963;
var points = 32;
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++) {
var theta = Math.PI * (i / (points/2));
ex = point.lng() + (rlng * Math.cos(theta));
ey = point.lat() + (rlat * Math.sin(theta));
extp.push(new GPoint(ex, ey));
}
return extp;
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 383px; height: 230px"></div>
</body>
</html>
On Sep 11, 3:40 pm, csdude <[EMAIL PROTECTED]> wrote:
> btw; I noticed that when you 'resize' a map/image that the copyright
> notice goes outside the image.
>
> for example: I am using:
>
> <div id="map" style="width: 383px; height: 230px"></div> to display
> the map and the copyright notice is drawn outside the map to the
> left. (Does that mean I 'request' the wrong size map ?)
>
> On Sep 11, 12:45 pm, csdude <[EMAIL PROTECTED]> wrote:
>
> > Cool thanks!!
>
> > I am going to play with that code a bit later today.
>
> > Ron
>
> > On Sep 11, 12:36 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Sep 11, 9:19 am, csdude <[EMAIL PROTECTED]> wrote:
>
> > > > Actually I tried to use that one. Java script is not complaining
> > > > about anything, I just don't get to see the circle.
>
> > > > I am trying to use the one from:
> > > > http://esa.ilmari.googlepages.com/circle.htm?haku=#
>
> > > > function drawCircle(center, radius, nodes, liColor, liWidth, liOpa,
> > > > fillColor, fillOpa)
>
> > > > However there is som code around it that I don't know yet what it
> > > > does.
>
> > > > I was hoping to do something like:
>
> > > > function load() {
> > > > if (GBrowserIsCompatible()) {
> > > > var map = new GMap2(document.getElementById("map"));
> > > > map.setMapType(G_HYBRID_MAP);
> > > > map.setCenter(new GLatLng('lat', 'long'), 3);
> > > > // draw circle with epicenter mapcenter, 50km radius, 360
> > > > segments
> > > > map.drawCircle(map.getCenter(), 50, 1);
> > > > }
>
> > > > But obviously I am missing something.
> > > > (The fact I use a "G_HYBRID_MAP" map doesn't matter, does it ?)
>
> > > Example:http://www.geocodezip.com/overlappingPolygons.asp
>
> > > > On Sep 11, 11:45 am, Davepar <[EMAIL PROTECTED]> wrote:
>
> > > > > Also look in the GMap
> > > > > samples:http://gmaps-samples.googlecode.com/svn/trunk/basic_wcircle/basicw_ci...
>
> > > > > Dave
>
> > > > > On Sep 11, 7:02 am, csdude <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hello,
>
> > > > > > I am new to the google maps api.
> > > > > > I would like to draw circles on a map. (for 'marking' seismic
> > > > > > activity).
>
> > > > > > I saw a few java script functions, played with a few of them but
> > > > > > couldn't get them to work.
>
> > > > > > The maps I use are simple, like the example that is shown when you
> > > > > > 'sign up' for the google maps api.
>
> > > > > > e.g:
>
> > > > > > function load() {
> > > > > > if (GBrowserIsCompatible()) {
> > > > > > var map = new GMap2(document.getElementById(\"map\"));
> > > > > > map.setMapType(G_HYBRID_MAP);
> > > > > > map.setCenter(new GLatLng('lat', 'long'), 3);
> > > > > > }
>
> > > > > > }
>
> > > > > > is there a simple example that shows how to do this ?
> > > > > > (I basically am looking for a drawCircle function/method that I can
> > > > > > use to draw a circle or ring)
>
> > > > > > thanks,
>
> > > > > > Ron- 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]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---