Skip to content

Commit e4821c3

Browse files
committed
Add a section for basemap customization
1 parent c111bc1 commit e4821c3

File tree

6 files changed

+71
-4
lines changed

6 files changed

+71
-4
lines changed

articles/azure-maps/choose-map-style.md

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var map = new atlas.Map('map', {
2727
style: 'road'
2828

2929
//Additional map options.
30-
};
30+
});
3131

3232
//Update the style options at anytime using `setStyle` function.
3333
map.setStyle({
@@ -37,8 +37,6 @@ map.setStyle({
3737
});
3838
```
3939

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].
41-
4240
<!-----------------------------------------------------------------------------------------------
4341
<br/>
4442
> [!VIDEO https://codepen.io/azuremaps/embed/eYNMjPb?height=700&theme-id=0&default-tab=result]
@@ -57,7 +55,7 @@ var map = new atlas.Map('map', {
5755
style: 'grayscale_dark',
5856

5957
//Additional map options
60-
);
58+
});
6159
```
6260

6361
:::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.":::
@@ -85,6 +83,74 @@ map.setStyle({ style: 'satellite' });
8583
> [!VIDEO //codepen.io/azuremaps/embed/yqXYzY/?height=265&theme-id=0&default-tab=js,result&embed-version=2&editable=true]
8684
----------------------------------------------------------------------------------------------->
8785

86+
## Customize the base map
87+
The base map can be customized with the `styleOverrides` option. To see all available options, see [styleOverrides].
88+
89+
The following code shows how to disable country/region borders and building footprints on the map.
90+
91+
```javascript
92+
var map = new atlas.Map('map', {
93+
styleOverrides: {
94+
countryRegion: { borderVisible: false },
95+
buildingFootprint: { visible: false },
96+
},
97+
98+
//Additional map options
99+
});
100+
```
101+
102+
Here are the effects of all five available `styleOverrides` options:
103+
104+
1. 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="Country/region borders":::
112+
113+
2. 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="Admin district borders":::
121+
122+
3. 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-district2.gif" alt-text="Second admin district borders":::
130+
131+
4. 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="Building footprints":::
139+
140+
5. 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="Road details":::
148+
149+
> [!NOTE]
150+
> For the supported map styles on each `styleOverrides` option, please read [styleOverrides] API documentation for more details.
151+
152+
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].
153+
88154
## Add the style picker control
89155

90156
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:
154220
> [Add a bubble layer]
155221
156222
[style options]: /javascript/api/azure-maps-control/atlas.styleoptions
223+
[styleOverrides]: /javascript/api/azure-maps-control/atlas.styleoverrides
157224
[base map styles]: supported-map-styles.md
158225

159226
[Add a bubble layer]: map-add-bubble-layer.md
149 KB
Loading
143 KB
Loading
253 KB
Loading
329 KB
Loading
416 KB
Loading

0 commit comments

Comments
 (0)