Click here to Skip to main content
14,327,553 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi,
i want to remove first drawn circle and add a new circle with new radius on map.
how i do this?

What I have tried:

var circle = new google.maps.Circle({
    strokeWeight: 1.0,
    fillOpacity: 0.1
  });
  circle.setMap(null);
  
  var radus = 300;
  var sel_rads = $('#mapradius option:selected').val();
  if (sel_rads != "0") {     
      radus = sel_rads * 100;
  }  
  var cityCircle = new google.maps.Circle({
      strokeColor: '#000',
      strokeOpacity: 0.8,
      strokeWeight: 2,
      fillColor: '#000',
      fillOpacity: 0.05,
      radius: radus,
      map: map,
      center: map.center
  });

  this.set('distance', opt_distance);
  this.set('active', false);
  this.bindTo('bounds', circle);

  circle.bindTo('center', this);
  circle.bindTo('zIndex', this);
  circle.bindTo('map', this);
  circle.bindTo('strokeColor', this);
  circle.bindTo('radius', this);
Posted
Updated 29-Jun-16 1:04am
v3
Comments
CHill60 22-Apr-16 8:39am
   
What happens when you run your code?
ErBhati 25-Apr-16 1:24am
   
again a new circle is drawn. with new radius
Peter_in_2780 26-Apr-16 8:34am
   
Can you change the opacity on your first circle to zero. It will still be there, but invisible.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

here is my solution
   distanceWidget.set('map', null);

and distanceWidget is:
 distanceWidget = new DistanceWidget({
                map: map,
                distance: rads, // Starting distance in km.
                maxDistance: 0.5, // Twitter has a max distance of 2500km.
                color: '#000000',
                activeColor: '#5599bb',
                sizerIcon: '../Contents/Images/resize-off.png',
                activeSizerIcon: '../Contents/Images/resize.png'
            });
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100