How to know if a point is visible on my map ?
var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng)); if map.getbounds().contains(point) ...
If by visible you are meaning if a point is inside a map's visible area (viewport);
// assuming you initialized your map
var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng));
var currentBounds = map.getBounds() // get bounds of the map object's viewport
if(currentBounds.contains(point)){
// your location is inside your map object's viewport
}else{
// your location is out of the bounds of the map's visible viewport
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With