Use text instead of markers on Google Maps

I create a map with hundreds of markers and info windows that come with each of them. I use a custom icon instead of the standard and cluster cluster to speed up loading.

Each info window has a link that leads to a specific article. To open this article, there are two steps:

  • You need to click on the marker
  • An information window opens, you see the name of the article, and you must click on the name (link) to open the article.

I would like to avoid one click. Is it possible to have a text marker (instead of seeing a custom icon) - you will see the text “article 1”, and when you click on it, “article 1” will open?

Here is part of my code:

<head>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer.js"></script>
<script type="text/javascript"> 
var map = null;
var markerArray = []; //create a global array to store markers
var myPoints = [

[1, 1, 'Article 1'],
[2, 2, 'Article 2'],
[3, 3, 'Article 3'],

];
//create global array to store points

function initialize() {
    var myOptions = {
        zoom: 5,
        center: new google.maps.LatLng(2, 2),
        mapTypeControl: true,
        mapTypeControlOptions: {
            style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
        },
        navigationControl: true,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    var mcOptions = {
        gridSize: 10,
        maxZoom: 15
    };
    var mc = new MarkerClusterer(map, [], mcOptions);

    google.maps.event.addListener(map, 'click', function() {
        infowindow.close();
    });

    // Add markers to the map
    // Set up markers based on the number of elements within the myPoints array
    for(var i=0; i<myPoints.length; i++){
         createMarker(new google.maps.LatLng(myPoints[i][0], myPoints[i][1]), myPoints[i][2]);
    }

    mc.addMarkers(markerArray , true);
}

var infowindow = new google.maps.InfoWindow({
    size: new google.maps.Size(150, 50)
});

var image = '/321.png';
function createMarker(latlng, html) {
    var contentString = html;
    var marker = new google.maps.Marker({
        position: latlng,
        map: map,
        icon:image,
        zIndex: Math.round(latlng.lat() * -100000) << 5
    });

    google.maps.event.addListener(marker, 'click', function() {
        infowindow.setContent(contentString);
        infowindow.open(map, marker);
    });

    markerArray.push(marker); //push local var marker into global array
}

window.onload = initialize;
</script> 
</head>
+3
1

, , , Google Maps .

, , , -, , , /.

. Google Maps Marker, .

, .

+1

All Articles