Google-maps – How to display country borders, US state borders, and city borders using Google Maps

google mapsgoogle-maps-api-3

I am using Google Maps v3 and I need to add border lines for different areas to my map. For example, in Google Maps all the US State borders are shown automatically. I need to do the same thing for different countries. For example, show all the city boundaries in England.
How i can do this with Google Maps API v3?

Regards,
Yossi

Best Answer

You can use the KML support that is provided in Google Maps, learn more by reviewing the KML Introduction, and then create v3 KmlLayer. The Lat-Lng coordinates that make up the country, state, and city boundaries is not provided out-of-the-box in Google Maps, but some of supporting data is available:

  1. KML of the World Countries as created by Valery Hronusov
  2. KML of the World Capitals as created by Filipumme
  3. KML of the US States is available for download from Google
  4. Some additional city data is available, but that is often city-by-city and requires online searching to find

Much of this data is also available publicly for dynamic retrieval as Fusion Tables, but in that case, you will be using shared public data. I use KML for this type of thing, because I want to have internal copies of the data, maintain full control over the data, and have the ability to make my own changes or updates.