-1

I need to create a custom marker that would be similar to the look of the ClusterMarker. I want to display the number of markers each County has. That mark will display in the centre of the County showing the number of markers.

How would I create the marker to display the number in the middle of it. This number would be queried from the database. They don't need to be clickable.

Thanks

user3297090
  • 9
  • 1
  • 8
  • You can manipulate the image with PHP. Have a look at [this answer](http://stackoverflow.com/a/20778505/1238965) and other PHP image processing functions: http://php.net/manual/en/book.image.php – MrUpsidown May 18 '15 at 14:54

2 Answers2

0
  var count = markers[i].getAttribute("count");

    if (count == '') {
    var image = new google.maps.MarkerImage('modules/mod_boutiques_map/images/mm_20_blue.png', iconSize, null, iconAnchor);
    } else if (count < 10) {
    var image = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_spin&chld=0.4|0|FFFF00|9|_|"+count, null, new google.maps.Point(0, 0), new google.maps.Point(10, 34));
    } else if (count < 99) {
    var image = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_spin&chld=0.46|0|FFFF00|10|_|"+count, null, new google.maps.Point(0, 0), new google.maps.Point(10, 34));
    } else {
    var image = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_spin&chld=0.54|0|FFFF00|10|_|"+count, null, new google.maps.Point(0, 0), new google.maps.Point(10, 34));
    }
user3297090
  • 9
  • 1
  • 8
-1

Can be mad to calculate center of each country each time and, I bet, countries limits won't change so often to generate a tedious maintenance, so, as long as you will retrieve the data of the number of markers for each country, I think your best option will be to store the countries' centers custom marker's position in database, in a file or in a constant class... depends of how you develop your map.

To customize markers with special icons, hide the close button, change color, and put detailed info inside follow steps described here.

After creating a custom marker layout, and fetching data of the markers, you just have to create an array of markers and insert there all customized markers.

Jordi Castilla
  • 26,609
  • 8
  • 70
  • 109