my code stock.com

Sebastian Bernal

simple google maps con un marcador customizado
by Sebastian Bernal

google map

Snippet options

Download: Download snippet as simple-google-maps-con-un-marcador-customizado.html.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
    function initialize()
{
    var map = new google.maps.Map(document.getElementById("map"),
    {
        zoom: 11,
        center: new google.maps.LatLng(15.529279,73.903656),
        mapTypeId: google.maps.MapTypeId.ROADMAP
    });

    setMarkers(map, beaches);
}

var beaches = [
  ['Baga Beach', 15.559627,73.750792, 1]
];

function setMarkers(map, locations)
{
    var image = 'http://icons.iconarchive.com/icons/visualpharm/vacation/48/beach-chair-icon.png';
      for (var i = 0; i < locations.length; i++)
    {
        var beach = locations[i];
        var myLatLng = new google.maps.LatLng(beach[1], beach[2]);
        var marker = new google.maps.Marker(
        {
                position: myLatLng,
                map: map,
                icon: image,
                title: beach[0],
                zIndex: beach[3]
            });
      }
}
</script>


<div id="map" style="width: 530px; height:230px"></div>


<script>
   initialize(); 
</script>

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.