How to create circle in google map v3 with same radius in all zoom level?

I am working on map code migration from v2 to v3.

In v2 i have create circle with help of GProjection and Overlay and it will look same size in all zoom level.

In v3 google gives Circle class that will create circle in map but it will change in different zoom level.

I want to create circle that will have same size in all zoom level.

I want to know any other way in google map v3 by that i can create circle with same size for all zoom level.

Thanks in advance.

Answers


To create circles that are the same pixel size on the screen (versus same area size in geographic coordinates), you would traditionally use a Marker with a custom Icon in the shape of a circle. But now you can be more flexible and use the relatively new Symbols in v3.

var marker = new google.maps.Marker({
  position: new google.maps.LatLng(-122.5,47.5),
  icon: {
    path: google.maps.SymbolPath.CIRCLE,
    fillOpacity: 0.5,
    fillColor: '#ff0000',
    strokeOpacity: 1.0,
    strokeColor: '#fff000',
    strokeWeight: 3.0, 
    scale: 20 //pixels
  }
});

Aside: You can make cool animations out of these symbols as well: http://googlegeodevelopers.blogspot.com/2012/06/powerful-data-visualization-with.html


I use this code to manage zoom and scaling circles on my Google Map V3:

google.maps.event.addListener(iMap.map, 'zoom_changed', function () {
    for (var i = 0; i < iMap.circle.length; i++) {
        var p = Math.pow(2, (21 - iMap.map.getZoom()));
        iMap.circle[i].setRadius(p * 1128.497220 * 0.0027);
    }

    menu.hide();
});

Need Your Help

Render ejs file in node.js

node.js ejs

Hey guys I'm playing with node.js and trying to render an template file. I figured out how to render strings:

Get cursor position with respect to the control - C#

c# winforms mouse mouse-position

I want to get the mouse position with respect to the control in which mouse pointer is present. That means when I place the cursor to the starting point (Top-Left corner) of control it should give ...