GMaps: Canvas overlays with colors

Back in 2009 I made several small GoogleMaps-based projects to show drawing on top of maps using canvas tiles. Till this day I continue getting emails with questions about some of those projects, and one of the frequent requests was whether it's possible to extend the markers to use multiple colors.

You can find the code for the "original" map with 400 markers using the same color here. This map shows the markers and allows the user to mouseover them with the cursor changing its shape when passing over a marker. A slightly different mechanism is shown here, which generates real markers, but only for those tiles that are currently displayed (to limit the number of markers displayed); the demo doesn't fully work for v2 API as it seems like isHidden method has changed its behavior.

The modified map with 400 markers using multiple colors is available here. It assigns one of two colors randomly, but you can use a similar mechanism to pick the color you need based on some marker data.

Leave a comment

what will you say?
(required)
(required)
Close