Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print Google Maps with cluster (clusterer) icons?

I have to print some Google Maps displayed within PHP application.

Basically, I can print it, and what is important markers are printed correctly. But problem occurs if I need to print cluster. Instead of cluster icon, only a white box is printed (in fact that part of the map is not printed at all), and only number of markers that that cluster contain is printed in that box.

I tried with custom icon, and result is the same.

Is it possible to print anything anyhow as a clusterer (icon), with number of grouped markers inside? At least to put some color in the box? It does not have to be icon, is it possible to set color of that empty box with styles?

Tnx in advance!

like image 509
user198003 Avatar asked Oct 10 '22 14:10

user198003


1 Answers

Printing is not available with MarkerClusterer, but it is an option if you use an enhancement named: MarkerClustererPlus. It is essentially a Google Maps v3 upgrade of the original v2 MarkerClusterer, which was then further enhanced and extended by Gary Little. It functions pretty much the same as the v3 MarkerClusterer, but offers more optionsdoc.

Specific to your question, you may pass a set of options to the MarkerClusterer constructor function (when using MarkerClustererPlus) and include an option: printable. If set to true, it will give you what you want. I have noticed that setting printable to true may cause you to adjust the placement of the cluster count label within the cluster marker icon, but it usually just takes some tweaking. Most importantly, the cluster icon and the count label will appear in map prints.

like image 52
Sean Mickey Avatar answered Oct 13 '22 11:10

Sean Mickey