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 is 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)

About

I am Paul Kulchenko.
I live in Kirkland, WA with my wife and three kids.
I do consulting as a software developer.
I study robotics and artificial intelligence.
I write books and open-source software.
I teach introductory computer science.
I develop a slick Lua IDE and debugger.

Recommended

Close