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?
To achieve this, you will basically need to look for the coordinates of the state or country on GADM. Once you have them, draw a shape on the Google Maps with the Polygon object providing an array with all the coordinates that play basically as borders of the place that you want to highlight.
That's because Google shifts the borders between countries, depending on what country you are in when you look at them. That is, Google customizes its maps, depending on what the viewer expects to see.
You can trace a path or highlight an area on your map by drawing lines and shapes.
Changing Map Styles Click on the option labeled Tools and then click on Change map. Once there, click on the button labeled Change feature styles. There are plenty of options for changing the different styles of your markers, which includes changing their color.
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:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With