Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

227
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda