Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda