0

I have to make add highlight for two countries: Poland and Germany. I found something like that:

https://developers.google.com/maps/documentation/javascript/dds-boundaries/coverage

BUT I need something reverse:

  1. All of countries has to been covered by some overlay (on example: white background with some opacity)
  2. Only two countries (Poland and germany) has to be highlighted without these overlays

Sample:

enter image description here

I don't have idea how can I do it.

geocodezip
  • 158,664
  • 13
  • 220
  • 245
Daniel Kozina
  • 69
  • 2
  • 7
  • 2
    there is an example in this tutorial on how to draw polygons on the map to highlight countries: https://ourcodeworld.com/articles/read/830/how-to-highlight-an-area-city-state-or-country-in-google-maps-with-javascript – GrafiCode Sep 11 '22 at 09:40
  • ok I see it's good explanation (I think the best which I saw anywhere) BUT I don't understand how can I make the overlay on whole the world except these two countries ... I see how I can draw a country borders (thanks!) – Daniel Kozina Sep 11 '22 at 11:00
  • You *could* use DDS (the link you provided in your question) and color *all countries* except the 2 countries you are interested in. The issue is that, as you can see from the coverage information in the docs, some countries (Ukraine, Russia, Argentina, etc.) can't currently be drawn, so you'd get more *holes* than just these 2 countries. – MrUpsidown Nov 10 '22 at 08:56
  • I have filed a [feature request](https://issuetracker.google.com/issues/258476021) as I believe it would be a neat addition to DDS if we could have a way to create a *world overlay* and exculde *some* countries/regions/areas from it without the use of external resources. You might want to star the issue if you think it is worth it. – MrUpsidown Nov 11 '22 at 08:07

1 Answers1

-2

Related questions:

One option:

  1. go to http://www.gadm.org/download, download the adm0 file for Germany and the adm0 file for Poland

  2. Combine those polygons (as the inner ring(s)) with a polygon that covers the whole earth (see KML invert country border )

  3. zip up the resulting kml, rename to kmz. Display on the map using geoxml3

example with Germany and Poland

screenshot of resulting map

Note that this won't work (at present) with the Google Maps JavaScript API v3 native KmlLayer renderer.

geocodezip
  • 158,664
  • 13
  • 220
  • 245