Armin
Armin

Reputation: 15938

Highlight whole countries in Google Maps

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?

Upvotes: 37

Views: 76257

Answers (6)

MrUpsidown
MrUpsidown

Reputation: 22490

14 years (!) after the original feature request, Google has enabled Data-driven styling.

One of the most commonly requested features you have asked for is access to the same boundaries and polygons used in Google Maps to build informative and engaging maps for your customers. Today, we are excited to announce the preview release of Data-driven styling for the Maps JavaScript API, which enables you to display and style Google boundaries.

Here is a demo and the official documentation.

Upvotes: 3

mgibson
mgibson

Reputation: 6203

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

Upvotes: 11

defau1t
defau1t

Reputation: 10619

If you just want a map of Germany why not use this:

http://jvectormap.com/maps/countries/germany/

Germany is already available

Upvotes: 0

Asmo Soinio
Asmo Soinio

Reputation: 1202

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

Example: https://chart.googleapis.com/chart?cht=map:fixed=-60,0,80,-35&chs=600x350&chld=CA-BC|CN|IT|GR|US-UT&chdl=Vancouver|Beijing|Torino|Athens|Salt+Lake+City&chco=B3BCC0|5781AE|FF0000|FFC726|885E80|518274&chtt=Last+Five+Olympic+Hosts&chm=f2010+Winter,000000,0,0,10|f2008+Summer,000000,0,1,10|f2008+Winter,000000,0,2,10,1,:-5:10|f2004+Summer,000000,0,3,10|f2004+Summer,000000,0,4,10

enter image description here

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.

Upvotes: 3

davetapley
davetapley

Reputation: 17898

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:

all countries


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:

filter countries with where

Upvotes: 50

Armin
Armin

Reputation: 15938

Currently (API version 3) there seems to exist no possibility to increase border-thickness for single countries.

Upvotes: 0

Related Questions