For example, the zoomend event worked, how to get the objects that are visible on the map now?

map.on('zoomend', function(ee) { }); 

    1 answer 1

    What objects do you want to receive? If, for example, you have an associative array of markers marks , then you can get visible ones from them as follows:

     map.on('zoomend', function(ee) { var bounds = map.getBounds(); // Π³Ρ€Π°Π½ΠΈΡ†Ρ‹ Π²ΠΈΠ΄ΠΈΠΌΠΎΠΉ области ΠΊΠ°Ρ€Ρ‚Ρ‹ for (var key in marks) { // ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌ массив ΠΌΠ°Ρ€ΠΊΠ΅Ρ€ΠΎΠ² if (marks.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) { var lat_lng = marks[key].getLatLng(); // ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚Ρ‹ ΠΌΠ°Ρ€ΠΊΠ΅Ρ€Π° if (bounds.contains(lat_lng)) { // провСряСм, ΠΏΠΎΠΏΠ°Π΄Π°Π΅Ρ‚ Π»ΠΈ ΠΌΠ°Ρ€ΠΊΠ΅Ρ€ Π² Π³Ρ€Π°Π½ΠΈΡ†Ρ‹ области console.log(lat_lng); } } } });