0

I'm trying to create a map where only one country (in my case The Netherlands) is visible, and i want to render markers on this map. After some digging i found the solution in this post:

Is there a way to display a single country in Google map? It should be only one country, not parts from other countries included

I've looked up a SVG map of The Netherlands and altered the code for my purpose, but i can't find out how to remove the waterways from the map (the dark blue lines in the sea like you see here: https://www.google.com/maps/@52.4602959,4.5546196,12.92z )

this is the styling part of my script:

  var mapOptions = {
    zoom: 8.2,
    center: new google.maps.LatLng(52.043084, 5.0451778),
    mapTypeId: google.maps.MapTypeId.MAP,
    backgroundColor: 'transparent',
    disableDefaultUI: true,
    draggable: true,
    scaleControl: true,
    scrollwheel: true,
    styles: [
      {"featureType": "water", "stylers": [{ "visibility": "off" }]},
      {"featureType": "landscape", "stylers": [{ "visibility": "off" }]},
      {"featureType": "road", "stylers": [{ "visibility": "off" }]},
      {"featureType": "administrative", "stylers": [{ "visibility": "off" }]},
      {"featureType": "poi", "stylers": [{ "visibility": "off" }]},
      {"elementType": "labels", "stylers": [{ "visibility": "off" }]}
    ]
  };
  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

Full code and fiddle can be found here; https://jsfiddle.net/sander_cinnamon/uxejo76b/

Can anyone tell me how to remove these lines?

Thanks very much in advance!

cheers, Sander

Sander
  • 23
  • 2

1 Answers1

0

The waterways' featureType is "transit", removing these however will also remove all transit stations and lines.

Heres the code :

  styles:[
      {
        "featureType": "transit.line",
        "elementType": "geometry",
        "stylers": [
          {
            "visibility": "off"
          }
        ]
      },
      {
        "featureType": "transit.line",
        "elementType": "labels",
        "stylers": [
          {
            "visibility": "off"
          }
        ]
      }
    ]

Also, using the Map Styling wizard can help with the styling of map features : https://mapstyle.withgoogle.com/

Waren
  • 335
  • 2
  • 9
  • Thanks you Waren, it works like a charm! I've also bookmarked the styling wizard for future use ;-) – Sander Mar 20 '19 at 09:38