Give Different Color To Each Country In Google Map
Solution 1:
Using Google Maps this is really not easy, as @oezi said you would need to build overlays of every country you want to color, which frankly sounds like a mess.
But if you don't need all of the functionalities of Google Maps, perhaps you can use a Map Chart from the fantastic Google Chart Tools (aka Chart API). You can check and tinker with a working example of a Colored Map (among some others) in the interactive Chart Wizard
2017 UPDATE: This answer is quite old and as such the Map Charts API has been deprecated by Google. You can use the Geocharts from the Google Charts API instead:
https://developers.google.com/chart/interactive/docs/gallery/geochart
Hope this helps!
Solution 2:
you may check this question,it's the same question you are asking. How to color countries using google maps?
it's talking about google Geocharts in google maps.
Solution 3:
there is a possibility to change the map style. and there is a very nice interactive example here - but, as far as i can see, it isn't possible to change the style of a specific country using this, so you'll have to build your own overlays using polygons.
Solution 4:
First, find the shape file in .kml format. Tip: try googling "kml uk" or "kml china".
Once you have the KMLfile, host it somewhere and then call it as a var
inside your Google Maps API initMap like this:
var myCustomRegion = new google.maps.KmlLayer({
url: 'FULL_URL_TO_YOUR_SHAPE_FILE',
map: map
});
Now your shape is laid into your map.
You can style the shape using the <LineStyle>
and <PolyStyle>
tags inside the KML file itself.
Post a Comment for "Give Different Color To Each Country In Google Map"