Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
Update size of a circle on radius update Google Maps v3

I'm new in javascript and I try to update the size of a circle in a google map when the value of the radius is updated but it doesn't work.

I tried to return the value of cityCircle when I update the radius but it returns "undefined".

setTimeout(function() {
    google.maps.event.trigger(map, 'resize');

    if (num_places > 0) {

        var radiusmap = s.radius;
        var cityCircle;

        function addCircle() {
            if (cityCircle) {
                cityCircle.setMap(null);
            } else {
                cityCircle = new google.maps.Circle({
                    radius: radiusmap * 1000,
                    fillColor: '#bce3e4',
                    fillOpacity: 0.2,
                    strokeColor: '#7cc4c5',
                    strokeOpacity: 1,
                    strokeWeight: 1
                });
            cityCircle.bindTo('center', centerMarker, 'position');
            cityCircle.bindTo('map', centerMarker, 'map');
            }
        }

        if (radiusmap == 100) {
            addCircle();
            map.setCenter(latlng);
            map.setZoom(8);
        }
        if (radiusmap == 50) {
            console.log(cityCircle);
            addCircle();
            map.setZoom(9);
        }
        if (radiusmap == 20) {
            addCircle();
            map.setZoom(10);
        }
        if (radiusmap == 5) {
            addCircle();
            map.setZoom(12);
        }
        if (radiusmap == 0) {
            map.setZoom(2);
        }

    } else {
        map.setZoom(s.zoom);
        map.setCenter(latlng);
    }
}

Any help would be really appreciated :)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!