Necesito mostrar marcadores en un mapa, solamente si están dentro del radio del circulo mostrado en la pantalla. Pero no se, como validar si efectivamente el marcador esta o no esta dentro del radio.
var myLatLng = { lat: 14.151171, lng: -90.841083 };
var myLatLng2 = { lat: 14.15009000, lng: -90.84334708 };
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: myLatLng,
mapTypeId: 'terrain',
zoom: 18
});
var markerYesShow = new google.maps.Marker({
position: myLatLng,
map: map,
title: 'Yes Show Into Radio'
});
var markerNotShow = new google.maps.Marker({
position: myLatLng2,
map: map,
title: 'Not Show '
});
var alerta = new google.maps.Circle({
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35,
map: map,
center: myLatLng,
radius: 100
});
}
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
<div id="map"></div>
<!-- Replace the value of the key parameter with your own API key. -->
<script async defer
src="https://maps.googleapis.com/maps/api/js??key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap">
</script>