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

159
Vistas
When we click on search, it should zoom into the area selected. The area is highlighted on the map and zooms

This is the site https://www.space-intelligence.com/scotland-landcover/# When you click on the regional statistics it open a dropdown and then when you click select region it open a pop up and here you select the city and after that you click search button. But it is doing nothing. When you click on search, it should zoom into the area selected. The area is highlighted on the map and zooms in when you click search.

This is the function:

function areasearch(modalid) {
    var fid = $("#areasearch" + modalid).val();
    $("#exampleModal" + modalid).modal('toggle');
    map.data.forEach(function(feature) {
        if (fid != 0) {
            if (feature.i.ID != fid) {
                map.data.overrideStyle(feature, {
                    visible: false
                });
                feature.setProperty('visible', 'false');
            } else {
                var bounds = new google.maps.LatLngBounds();
                feature.getGeometry().forEachLatLng(function(latlng) {
                    bounds.extend(latlng);
                });
                map.fitBounds(bounds);
                map.data.overrideStyle(feature, {
                    visible: true
                });
                google.maps.event.trigger(map.data, 'click', feature.getId());
                feature.setProperty('visible', 'true');
            }
        } else {
            map.data.overrideStyle(feature, {
                visible: true
            });
            feature.setProperty('visible', 'true');
        }
        $('#exampleModal').modal('hide');
    });
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

use setZoom()

if you experiment some trouble with map.fitBounds(), try to use setZoom() method with your desire level of zoom (int is needed). Also you need to center the map where you want to have a focus with the method setCenter() (latLng object is needed).

Try insert the following lines with the value desired :

map.setCenter({lat:YOUR_LATITUDE, lng:YOUR_LONGITUDE});
map.setZoom(6);

you can also read the this section of the documentaion

about 4 years ago · Juan Pablo Isaza Denunciar
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