Skip to content

Instantly share code, notes, and snippets.

@matismasters
Created April 26, 2011 20:45
Show Gist options
  • Select an option

  • Save matismasters/943098 to your computer and use it in GitHub Desktop.

Select an option

Save matismasters/943098 to your computer and use it in GitHub Desktop.
HTML y JS para GMAPS
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAALo9aqudJX-CndJlG93sJ1hT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQ3t2QaEC2O7tWK6G8CATgheBuwIQ" type="text/javascript"></script>
<div id="main_wrapper">
<div id="map_canvas" style="width: 800px; height: 800px"></div>
</div>
<script type="text/javascript">
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(-31.8, -55.33333), 13);
map.setUIToDefault();
function createMarker(point, label)
{
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function()
{
marker.openInfoWindowHtml(label);
});
return marker;
}
<% @places.each do |p| %>
map.addOverlay(createMarker(new GLatLng(<%=p.lat%>,<%=p.long%>),"<h3><%=p.state + ", " + p. name %></h3>"));
<% end %>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment