Many markers / custom icons slow

2,826 views
Skip to first unread message

Jon Duell

unread,
Sep 2, 2009, 7:39:28 PM9/2/09
to Google Maps JavaScript API v3
When loading many markers onto a map (close to 200), it's fairly slow:
http://www.internetcreators.com/dev/gmap_test/single.html

But when loading the same number of icons with custom icons, it's
incredibly slow:
http://www.internetcreators.com/dev/gmap_test/duo.html

The example above is a side-by-side comparison of the two maps, the
second map loads in more than twice the time as the first.

I'm loading data from an external xml file, but that loads pretty
quickly. Any advice on how to speed up loading time for multiple
markers, especially with custom icons?

Thanks,
Jon

Susannah (Google Employee)

unread,
Sep 2, 2009, 8:52:50 PM9/2/09
to Google Maps JavaScript API v3
Hi Jon,

You're right that loading lots of markers is too slow. Please file a
bug in issue tracker (http://code.google.com/p/gmaps-api-issues/issues/
list?q=label:ApiType-Javascript3) to help us monitor this.

As for the custom icons loading slower than the markers, if you set
the size of the image explicitly, they will load as quickly as the
default markers. Doing so saves us a lot of computation (which we
should also improve).

So, instead of:
var sale_image = "sale.png";

Do:
var sale_image = new google.maps.MarkerImage("sale.png", new
google.maps.Size(32, 32));

-Susannah

Jon Duell

unread,
Sep 8, 2009, 2:01:29 PM9/8/09
to Google Maps JavaScript API v3
Thanks Susannah,

I filed an issue here:
http://code.google.com/p/gmaps-api-issues/issues/detail?id=1673

For the custom icons, I changed it to set the size of the custom icon
explicitly, and it loads as quickly as the default markers.

Thank you so much!
Jon

Solo

unread,
Sep 8, 2009, 4:43:41 PM9/8/09
to Google Maps JavaScript API v3
Hi John,

Your example does not work with IE6 and in local copy ...
What could be a reason?



On Sep 2, 7:39 pm, Jon Duell <due...@gmail.com> wrote:
> When loading many markers onto a map (close to 200), it's fairly slow:http://www.internetcreators.com/dev/gmap_test/single.html
>
> But when loading the same number of icons with custom icons, it's
> incredibly slow:http://www.internetcreators.com/dev/gmap_test/duo.html
>
> Theexampleabove is a side-by-side comparison of the two maps, the
> second map loads in more than twice the time as the first.
>
> I'm loading data from an externalxmlfile, but that loads pretty

sfdude

unread,
Sep 8, 2009, 5:20:17 PM9/8/09
to Google Maps JavaScript API v3
Hi Jon,

In the "single.html" file,
just under the <TITLE> tag,
both <script> tags are not closed properly,
(uneven number of angle brackets).

Could that be the source of your trouble?
SFdude

Solo

unread,
Sep 9, 2009, 4:48:23 PM9/9/09
to Google Maps JavaScript API v3
To XML/jQuery Gurus

Here is a link to a little updated Jon's page (I used Google jsapi
instead of local jQuery)
http://www.webpilot.ru/z_GoogleMapV3/xml/single.html
and archive to download to test on local PC
http://www.webpilot.ru/z_GoogleMapV3/xml/bigList.rar

Questions:
1) Why script does not work with IE6 (by the link and on local PC)
2) On local PC it works with FireFox3 but not fully (info window not
opens by click)

With Chrome and Safari it works great (by the link and on local PC)

Any tricks, examples, best practices?

Thanks!

pamela (Google Employee)

unread,
Sep 13, 2009, 9:28:29 AM9/13/09
to google-map...@googlegroups.com
You have a syntax error in your options. IE does not allow dangling
commas at the end of JavaScript objects (FF does):
var marker = new google.maps.Marker({
position: marker_latlng,
map: map,
title: listing.find("title").text(),
});

The screencast about debugging for Maps API v2 is applicable for v3 as
well. The third part will show you how using the IE debugger can help
you see where errors are:
http://code.google.com/apis/maps/articles/debuggingmaps.html

- pamela

Solo

unread,
Sep 16, 2009, 12:06:06 PM9/16/09
to Google Maps JavaScript API v3
Thanks for the tip Pamela,

Removing the comma fixed the problem.
http://www.webpilot.ru/z_GoogleMapV3/xml/singleNodanglingCommas.html

On Sep 13, 9:28 am, "pamela (Google Employee)" <pamela...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages