Is there an easy way to turn of ALL labels in the Vector Style Editor?

2668
8
Jump to solution
04-17-2019 05:37 PM
BrianE1
Occasional Contributor

My process right now is turning off one layer at a time which can be time consuming.

0 Kudos
1 Solution

Accepted Solutions
MarkBockenhauer
Esri Regular Contributor

I have done the following..   In vector tile style editor choose the map you want to remove labels from..  Save it as your own style.   Then on items page, download the style. 

This will give you a root.json file.   In that style you need to add  "visibility": "none" to all of the "label layers"    I was using the World Navigation Style and I noticed that in the label layers "layout" all of the layers had "symbol-avoid-edges": true,    I did a search and replace on the root.json file to replace all instances of "symbol-avoid-edges": true,  with "symbol-avoid-edges": true,"visibility": "none",   

 then back at the items page I just updated the item (update button) with my modified root.json. 

This removed most of the labels...  still have labels for "Openspace or forest/label/Default"  as that was the one label layers that didn't have "symbol-avoid-edges":true,    

If you can find a string to replace in the style you want to modify, search and replace is much easier.

mark

View solution in original post

8 Replies
BrianE1
Occasional Contributor

Anyone?

0 Kudos
MarkBockenhauer
Esri Regular Contributor

I have done the following..   In vector tile style editor choose the map you want to remove labels from..  Save it as your own style.   Then on items page, download the style. 

This will give you a root.json file.   In that style you need to add  "visibility": "none" to all of the "label layers"    I was using the World Navigation Style and I noticed that in the label layers "layout" all of the layers had "symbol-avoid-edges": true,    I did a search and replace on the root.json file to replace all instances of "symbol-avoid-edges": true,  with "symbol-avoid-edges": true,"visibility": "none",   

 then back at the items page I just updated the item (update button) with my modified root.json. 

This removed most of the labels...  still have labels for "Openspace or forest/label/Default"  as that was the one label layers that didn't have "symbol-avoid-edges":true,    

If you can find a string to replace in the style you want to modify, search and replace is much easier.

mark

MattMoy
New Contributor II

Hey Mark, 

Thanks for your response here, it's very helpful. I have a similar question and wanted to know if you had any suggestions. I'm trying to edit the basemap so that the labels draw on top/front of the data I add. Is this possible?

0 Kudos
AlderMaps
Occasional Contributor

I'm a little late to the party here (was searching for an answer to the main question), but thought I would give this a shot. If you want basemap labels to draw on top of other features, you can select a "Label/Reference" layer to start, modify it if you want, save it as an item to your portal, then load it in your map (not as the basemap), and ensure it's above your other layers in Contents.

Not sure if it will automatically load in the basemap or not; if it does; you should be able to select additional options for the basemap and for that layer, then select "Move from Basemap". Drag it to the top of contents and it will draw above your other layers. Obviously in this case you want to ensure the remaining basemap does not have labels; modify in Tile Style Editor as needed.

Screenshot 2023-05-02 103530.png

TWPFSecretariat
New Contributor II

Thanks Mark and Matt for this exchange. Made it a lot easier than me going through the reference documents trying to find the right syntax to remove labels. I used "text-font" to find and replace with "visibility": none and it looks great! 

Best, 

Shawn

0 Kudos
John-Foster
Esri Contributor

To follow up on this issue we recently added an embedded JSON editor so that you could do this type of edit without downloading, editing with an external editor, and then uploading the JSON. To edit in the VTSE directly, once your style is loaded, select Edit JSON from the tool palette.

vtse-json-1.png

Edit the JSON, use ctrl-F to find, and make your edits. When done, click the Update button to validate the JSON and apply the edits and update the map.

vtse-json-2.png

--jf
AlderMaps
Occasional Contributor

I came up with another method to accomplish kinda-sorta what this post is about (turn off all labels / have labels drawn on top of other features). I wanted to use the Nova basemap but wanted the labels to draw on top of everything else (so two separate layers in the map, the labels on top and the base on the bottom).

I grabbed the JSON for one of of the labels-only styles in the Vector Tile Style Editor, grabbed the entire JSON for the Nova basemap, and threw them in a text comparison app (e.g. https://text-compare.com). I could then see exactly where in the JSON labels stop and everything else starts. Having identified the split point, I just snagged one half (labels) of the JSON and saved it as one item in my content, then snagged the other half (base) and saved it as a separate item.

I found ripping out the label JSON and saving it separately (if needed) was faster/easier than turning the visibility off for ALL labels in the JSON. 

Publicly shared items in my work account (I also did a little high-level color modification):
https://nrcs.maps.arcgis.com/home/item.html?id=f9a2539b279a44b4a9b2d1cae6704613
https://nrcs.maps.arcgis.com/home/item.html?id=914ec120e27249fcb86ebb138b518394

Now I can sandwich whatever layers I want between the basemap data and the labels:Screenshot 2023-06-30 101712.png

SilasRead1
New Contributor

This worked great, thank you for sharing your solution!

0 Kudos