How do I highlight a country with the google maps api v3?

10,132

Solution 1

I found this can be done with polygons and 'holes'. Google has this pentagon example

The only down side is the polygon needs to be drawn by hand (maybe there's a database of country outlines?) I used this tool to assist with the manual drawing for now.

Solution 2

The information at these links will help you, I think:

  1. KML of the World Countries as created by Valery Hronusov
  2. KML of the World Capitals as created by Filipumme

Solution 3

this demo shows you how: https://google-developers.appspot.com/maps/documentation/javascript/examples/layer-kml

aight, got kml for france; working demo: http://dev.bowdenweb.com/maps/gmaps/layer-kml-02.html

Share:
10,132
Dane O'Connor
Author by

Dane O'Connor

I'm a high energy programmer, problem solver, and entrepreneur. I love what I do. I think we should talk. gtalk: Dane.OConnor twitter: thedeeno skype: thedeeno

Updated on June 04, 2022

Comments

  • Dane O'Connor
    Dane O'Connor almost 2 years

    I'm trying to achieve an effect similar to this:

    http://www.state.gov/cms_images/france_map_2007-worldfactbook2.jpg

    Notice how France is brighter than the other countries. It has the 'focus'. I've been exploring the API and it looks like I'm supposed use kmlLayers to achieve this effect. Is this correct? If so, how do I leverage or even find kml to do this? How else could I do this?

    Thanks

  • Dane O'Connor
    Dane O'Connor almost 12 years
    thanks. My issue with this was that it's a reverse from what I need (I have no way of hiding the other countries, just France in this case). Also, for some reason the kml data has many unfilled regions.