I am using Google API maps. I want to assign different color to different country for example in England I want to draw each city in different color. How I can do it with JavaScript API V3? Do I need to use polygons?
Asked
Active
Viewed 3,531 times
1 Answers
1
You need to use either polygons or a KMLLayer. And for that, you need to provide your own source of data. http://naturalearthdata.com is a good source of public domain data. But Google doesn't provide the boundary information.

Mano Marks
- 8,761
- 3
- 27
- 28
-
is it possible to do it with using a diffrerent google API and still have map like google chart ? does i still get the same result ? – user1365697 May 01 '12 at 14:02
-
No Google API has that data down to the city level. Using Google Chart Tools you can get down to State/Province level, or certain US metropolitan areas. https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart – Mano Marks May 01 '12 at 14:09
-
i looked on the example in https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart and I saw char accoridng to city ( Rome, Milan ,...) so as far as I understand it is possile to get to city level also ib google chart tools so what is the diffrerent ? – user1365697 May 01 '12 at 14:38
-
You can put markers around the cities, yes, but that doesn't give you access to the boundaries of the city. Sorry if I misunderstood. – Mano Marks May 01 '12 at 15:01
-
What do you mean access to the boundaries ? if I want to assign color for each country or city what the disadvantage of the Google chart ? I didn't undersand the meaning of the access to the boundaries – user1365697 May 02 '12 at 04:48
-
I meant the city borders. If you just want dots over cities of different colors, the Geo Chart in Chart Tools is perfect for you – Mano Marks May 02 '12 at 05:45
-
@Mano Marks: The site http://naturalearthdata.org no longer appears to be online. – Peter O. Oct 13 '12 at 00:02