Google Map Points Checker inside Radius

Check a collection of points inside a radius.

by Alex Azuero

HTML

<script src="http://maps.google.com/maps/api/js?sensor=false&amp;.js"></script>
<div id="map"></div>

CSS

#map{
    width: 450px;
    height: 400px;
}

JavaScript

/**
 * Draw points and check whether those points are inside a range from a point.
 */
var subjectPoint = {
    point: new google.maps.LatLng(-6.8853496, 107.62308819999998),
    radius: 200,
    color: '#00AA00',
}
var points = [
    {point: new google.maps.LatLng(-6.885897, 107.62327299999993),},
    {point: new google.maps.LatLng(-6.885897, 107.62327299999993),},
    {point: new google.maps.LatLng(-6.883413, 107.62473),},
    {point: new google.maps.LatLng(-6.8869343471498645, 107.61962798499451),},
    {point: new google.maps.LatLng(-6.886957, 107.61862399999995),},
    {point: new google.maps.LatLng(-6.886957, 107.61862399999995),},
    {point: new google.maps.LatLng(-6.886957, 107.61862399999995),},
    {point: new google.maps.LatLng(-6.882318, 107.61933499999998),},
    {point: new google.maps.LatLng(-6.884765861154916, 107.62804010317996),},
    {point: new google.maps.LatLng(-6.87901, 107.623381),},
    {point: new google.maps.LatLng(-6.878835, 107.62399499999992),},
    {point: new google.maps.LatLng(-6.88701605873258, 107.61575242454524),},
    {point: new google.maps.LatLng(-6.8865062, 107.61471759999995),},
    {point: new google.maps.LatLng(-6.8865062, 107.61471759999995),},
    {point: new google.maps.LatLng(-6.876385124262933, 107.62339418518059),},
];
var zoom = 15;
var map;
var elevator;
var mapOptions = {
    zoom: zoom,
    center: subjectPoint.point,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
};
map = new google.maps.Map($('#map')[0], mapOptions);
//render the range
var subjectMarker = new google.maps.Marker({
    map: map,
    position: subjectPoint.point,
    title: 'Subject',
});
var subjectRange = new google.maps.Circle({
    map: map,
    radius: subjectPoint.radius * 1000,    // metres
    fillColor: subjectPoint.color,
});
subjectRange.bindTo('center', subjectMarker, 'position');
//render the points
for (var i = 0; i < points.length; i++){
    var point = points[i];
    var marker = new google.maps.Marker({
        map: map,
       ...