Changing colors for the same object

82 views
Skip to first unread message

KB

unread,
May 25, 2012, 5:55:51 AM5/25/12
to Google Maps JavaScript API v3
Watch this: http://www.gisdro.nl/BODEMKWALITEIT/index_uitdelucht.php

3 layers with the same polygons in different colors. Each object is
created 3 times.

Is it more efficient to create each object 3 times with different
colors or should I create each object once and change the color of
each object (from an array of 3 colors?) when changing the layer?

Enoch Lau (Google Employee)

unread,
May 26, 2012, 6:43:58 AM5/26/12
to google-map...@googlegroups.com
If these polygons are exactly the same, it's more efficient to just change the color of an existing polygon than creating new polygons with the same path but a different color. But unless you have a very large number of polygons, it shouldn't really make any practical difference because polygon rendering in v3 is pretty fast.

Enoch

KB

unread,
Jun 25, 2012, 11:46:31 AM6/25/12
to google-map...@googlegroups.com
Thanks for the answer. It is not a large number of polygons, but many nodes each polygon. I will try to change colors to see the difference in performance (not done yet).
Reply all
Reply to author
Forward
0 new messages