simple gmap

stick an array of co-ordinates onto a map

by russau

HTML

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

JavaScript

var map;
var points = [new google.maps.LatLng(-34.865393, 138.646099), 
new google.maps.LatLng(-27.244823, 153.083327), 
new google.maps.LatLng(-37.766426, 144.845326), 
new google.maps.LatLng(-37.668088, 144.970751), 
new google.maps.LatLng(-33.643859, 151.133338), 
new google.maps.LatLng(-33.878690, 151.017099), 
new google.maps.LatLng(-27.235861, 153.084835), 
new google.maps.LatLng(-21.162168, 149.164145), 
new google.maps.LatLng(-37.764208, 175.252050), 
new google.maps.LatLng(-37.801493, 144.954918), 
new google.maps.LatLng(-27.563967, 152.952124), 
new google.maps.LatLng(-27.597362, 151.954997), 
new google.maps.LatLng(-32.314337, 115.747583), 
new google.maps.LatLng(-38.882979, 175.258521), 
new google.maps.LatLng(-46.093388, 168.946070), 
new google.maps.LatLng(-36.974954, 174.779917), 
new google.maps.LatLng(-27.233455, 153.085748), 
new google.maps.LatLng(-33.877918, 151.208194), 
new google.maps.LatLng(-34.918756, 150.567456), 
new google.maps.LatLng(-33.648658, 150.776175), 
new google.maps.LatLng(-38.246714, 144.169657), 
new google.maps.LatLng(-34.115188, 150.799994), 
new google.maps.LatLng(-37.721181, 144.767828), 
new google.maps.LatLng(-27.530421, 153.205386)];

jQuery(document).ready(function() {

    var myLatlng = new google.maps.LatLng(-34.865393, 138.646099);
    var myOptions = {
        zoom: 4,
        center: myLatlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map($('#map')[0], myOptions);
    
    $.each(points, function() {
        var beachMarker = new google.maps.Marker({
            position: this,
            title: this.toString(),
            map: map
        });
    });

  
});