You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-maps/choose-map-style.md
+71-4Lines changed: 71 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ var map = new atlas.Map('map', {
27
27
style:'road'
28
28
29
29
//Additional map options.
30
-
};
30
+
});
31
31
32
32
//Update the style options at anytime using `setStyle` function.
33
33
map.setStyle({
@@ -37,8 +37,6 @@ map.setStyle({
37
37
});
38
38
```
39
39
40
-
For a fully functional sample that shows how the different styles affect how the map is rendered, see [Map style options] in the [Azure Maps Samples]. For the source code for this sample, see [Map style options source code].
@@ -57,7 +55,7 @@ var map = new atlas.Map('map', {
57
55
style:'grayscale_dark',
58
56
59
57
//Additional map options
60
-
);
58
+
});
61
59
```
62
60
63
61
:::image type="content" source="./media/choose-map-style/set-base-map-style-on-initialization.png" alt-text="Screenshot showing the grayscale dark style being set during the map load process.":::
The [styleOverrides] options enable users to streamline the base map by turning off specific map elements like country/region borders, administrative district borders, building footprints, and road detail layers. This allows for a cleaner and simpler map view, making it easier to visualize geometry data.
88
+
89
+
The following code shows how to disable country/region borders and building footprints on the map.
90
+
91
+
```javascript
92
+
var map =newatlas.Map('map', {
93
+
styleOverrides: {
94
+
countryRegion: { borderVisible:false },
95
+
buildingFootprint: { visible:false },
96
+
},
97
+
98
+
//Additional map options
99
+
});
100
+
```
101
+
102
+
Here are examples of all five available `styleOverrides` options:
103
+
104
+
- Country/region borders
105
+
106
+
```javascript
107
+
styleOverrides: {
108
+
countryRegion: { borderVisible:false }
109
+
}
110
+
```
111
+
:::image type="content" source="./media/choose-map-style/country-region.gif" alt-text="An animated GIF that shows country/region borders on a map.":::
112
+
113
+
- Admin district borders
114
+
115
+
```javascript
116
+
styleOverrides: {
117
+
adminDistrict: { borderVisible:false }
118
+
}
119
+
```
120
+
:::image type="content" source="./media/choose-map-style/admin-district.gif" alt-text="An animated GIF that shows admin district borders.":::
121
+
122
+
- Second admin district borders
123
+
124
+
```javascript
125
+
styleOverrides: {
126
+
adminDistrict2: { borderVisible:false }
127
+
}
128
+
```
129
+
:::image type="content" source="./media/choose-map-style/admin-district-2.gif" alt-text="An animated GIF that shows second admin district borders.":::
130
+
131
+
- Building footprints
132
+
133
+
```javascript
134
+
styleOverrides: {
135
+
buildingFootprint: { visible:false }
136
+
}
137
+
```
138
+
:::image type="content" source="./media/choose-map-style/building-footprint.gif" alt-text="An animated GIF that shows building footprints.":::
139
+
140
+
- Road details
141
+
142
+
```javascript
143
+
styleOverrides: {
144
+
roadDetails: { visible:false }
145
+
}
146
+
```
147
+
:::image type="content" source="./media/choose-map-style/road-details.gif" alt-text="An animated GIF that shows road details.":::
148
+
149
+
> [!NOTE]
150
+
> For more information on the supported map styles on each `styleOverrides` option, see the [styleOverrides] API documentation.
151
+
152
+
For a sample showing the different styles and how they affect how the map is rendered, see [Map style options] in the [Azure Maps Samples]. For this sample's source code, see [Map style options source code].
153
+
88
154
## Add the style picker control
89
155
90
156
The style picker control provides an easy to use button with flyout panel that can be used by the end user to switch between base styles.
@@ -154,6 +220,7 @@ See the following articles for more code samples to add to your maps:
0 commit comments