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');
});
}
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