Highlight whole countries in Google Maps
Solution 1
I was able to do this using the public World Country Boundaries.kml Fusion Table.
You'll need to add it as a Fusion Table Layer to your map.
Firstly initialize a map zoomed out right out, centered so we can see most countries:
var map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(30,0),
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
Next add the FusionTablesLayer
:
var world_geometry = new google.maps.FusionTablesLayer({
query: {
select: 'geometry',
from: '1N2LBk4JHwWpOY4d9fobIn27lfnZ5MDy-NoqqRpk'
},
map: map,
suppressInfoWindows: true
});
That looks like this:
With regard to:
Is there a possibility to fade out the other, not used countries?
If you look at the Fusion Table you'll see there are columns for Name
and ISO_2DIGIT
. We can filter on these by passing a where
condition to the FusionTablesLayer
, e.g:
query: {
select: 'geometry',
from: '1N2LBk4JHwWpOY4d9fobIn27lfnZ5MDy-NoqqRpk',
where: "ISO_2DIGIT IN ('US', 'GB', 'DE')"
},
To give:
Solution 2
For any one who ends up here in the future, this seems to now be handled very well by Google Charts, the latest implementation of the deprecated link above
https://developers.google.com/chart/interactive/docs/gallery/geochart
Solution 3
Old question, but: Google's deprecated Map Charts API looks like a better solution, if you do not need the map to be draggable:
https://developers.google.com/chart/image/docs/gallery/new_map_charts
This api will continue to work at lest until April 2015: https://developers.google.com/chart/terms
Important: The Image Charts portion of Google Chart Tools has been officially deprecated as of April 20, 2012. It will continue to work as per our deprecation policy.
Solution 4
Currently (API version 3) there seems to exist no possibility to increase border-thickness for single countries.
Solution 5
If you just want a map of Germany why not use this:
http://jvectormap.com/maps/countries/germany/
Germany is already available
Comments
-
Armin over 3 years
I have a general question about Google Maps. I want to use Google Maps just for germany, but of course the neighbor countries are shown as well. The border of germany is rarely visible.
Is there a possibility to fade out the other, not used countries?
-
Armin over 12 yearsI need all the details which are containing in Google Maps.
-
defau1t over 12 yearscan you please elaborate what is your exact requirement. No doubt google maps is always the answer, I am just wondering if your problem can be solved with other map type solution
-
Armin over 12 yearsOkay, I have coded a vector based map solution for a customer, which calculates the position of dots by long and lat and creates clusters (goo.gl/LvfFN - the map on the left side) . The customer wants additionally a gmaps implentation. Do you want to ask him why? I suppose this is not part of my initial question!
-
defau1t over 12 yearsThen from the google maps prespective, the best approach for you is to use google chart tools code.google.com/apis/chart/interactive/docs/gallery/geomap.html, if you wanyt to leverage google maps then you need to overlays and highlight the germany map, like what is here for usa map econym.org.uk/gmap/example_egroundoverlay.htm
-
Armin over 12 yearsSad, that there seems to be no fancier solution :( But thanks for your efforts!
-
defau1t over 12 yearsright, there is no fancier solution than this. you might still explore raphael js or the plugin I mentioned.
-
Jeroen K almost 11 yearsEven if you change the color, this is pretty ugly. Especially as the layer goes over the country names.
-
davetapley almost 11 yearsYou make a valid point, I've created an issue here.
-
Olli about 10 years@defau1t thanks for fixing it - yesterday jvectormap.owl-hollow.net did not exist at all.
-
defau1t about 10 years@Olli: that's true, the link was down but not 404. I saw someone down voted the post today so I was curious what could be the reason?
-
Haya Raed about 10 yearsIs it possible to choose the highlight colour?
-
davetapley about 10 years@HayaRaed yes, see Fusion Table Styles in the docs.
-
martin jakubik almost 7 years@defau1t can you fix the link in the post? ...owl-hollow... does not respond.
-
defau1t almost 7 years@martinjakubik: Here you go jvectormap.com/maps/countries/germany if you find any post as useful make sure you vote up the answer :)
-
martin jakubik almost 7 years@defau1t I meant why don't you Edit your post and fix it... but I did it myself. Otherwise your post is wrong and people have to read down the comments to find the right link.
-
Martin Zvarík over 5 yearsFYI: Fusion Tables are now deprecated and will be removed next month.
-
Cristian over 4 yearsis there a way to achieve this now since fusion tables are deprecated?
-
Cristian over 4 yearsis there a way to costumize the map and apply zooming and paning?