Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide highway numbers without removing the directions

I am trying to style the map which shows the directions of all roads without the road numbers on them.

{
    featureType: "road.highway",
    elementType: "labels.icon",
    stylers: [
        {color:"#979897"},
    { lightness: 50 },
    { visibility: "off" }
    ]
},

But this removes the directions on the road as well the numbers.I want to show only the directions without the highway numbers.

like image 225
Tyranicangel Avatar asked Dec 11 '25 03:12

Tyranicangel


2 Answers

This code removes all icons as well as labels. I am not sure what you mean by directional arrows, is this an additional layer you have?

[
  {
    "featureType": "road",
    "elementType": "labels",
    "stylers": [
      { "visibility": "off" }
    ]
  }
]
like image 112
Jeremy Hamm Avatar answered Dec 13 '25 16:12

Jeremy Hamm


There's a very useful styling tool which allows you to visually tweak map settings, which then spits out the JSON you need for your settings:

https://mapstyle.withgoogle.com/

Jeremy's answer will remove labels from all roads, including highways, arterial roads and local roads. I suspect you only want to hide highway numbers, so use:

        [
          {
              "featureType": "road.highway",
              "elementType": "labels",
              "stylers": [
                {
                    "visibility": "off"
                }
              ]
          }
        ]

(This will also hide highway labels though).

You can also remove labels for arterial and local roads separately, if desired, by adding additional JSON objects using the following as the "featureType":

  • road.arterial
  • road.local
like image 39
Chris Halcrow Avatar answered Dec 13 '25 15:12

Chris Halcrow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!