Highlight polygon and tint rest of map using Google Maps

Posted by Haes on Stack Overflow See other posts from Stack Overflow or by Haes
Published on 2010-06-02T09:22:00Z Indexed on 2010/06/02 9:23 UTC
Read the original article Hit count: 253

Filed under:
|
|
|

Hi,

I'd like to display a highlighted polygon using Google Maps. The idea is that the polygon in question would be displayed normally and the rest of the map should be darkened a little bit.

Here's an example image what I would like to accomplish with a polygon from Austria: alt text

Unfortunately, I'm a complete rookie when it comes to Google Maps API's and map stuff in general.

So, is this even possible do this with Google Map API's? If yes, with what version (v2, v3)? Would it be easier to do it with other map toolkits, like openlayers?

PS: One idea I had, was to build an inverse polygon (in this example, the whole world minus the shape of austria) and then display a black colored overlay with transparency using this inverted polygon. But that seems to be quite complicated to me.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about google-maps