Sha256: 2056ac191d17e320ae330f3ae61baf9bbef78a773c0ba37e7c8f49cc4d0ce9d3

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

$(function(){
  var
    latlng,
    marker,
    markers = [],
    myOptions = {
      zoom: 10,
      center: new google.maps.LatLng(-34.397, 150.644),
      mapTypeId: google.maps.MapTypeId.ROADMAP
    },
    map = new google.maps.Map(document.getElementById("features_map"), myOptions);

  $.each(features, function(index, feature){
      latlng = new google.maps.LatLng(feature['latitude'], feature['longitude']);

      marker = new google.maps.Marker({
        position: latlng,
        title: feature['title']
      });

      marker.setMap(map);
      markers.push(marker);
  });

  var lats  = $.map(markers, function(marker, index){ return marker.position.lat() }),
      longs = $.map(markers, function(marker, index){ return marker.position.lng() }),
      south_west = new google.maps.LatLng(Array.min(lats), Array.min(longs)),
      north_east = new google.maps.LatLng(Array.max(lats), Array.max(longs)),
      markers_bounds = new google.maps.LatLngBounds(south_west, north_east);

  map.fitBounds(markers_bounds);

});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cartoset-0.0.2 app/assets/javascripts/features/index.js
cartoset-0.0.1 app/assets/javascripts/features/index.js