Skip to content

Commit 0ad2a07

Browse files
authored
Merge pull request #125912 from zhz0704/custom-basemap-docs
Add a section for basemap customization
2 parents c3039d1 + 44e1e8f commit 0ad2a07

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 [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 = 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 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+
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
147 KB
Loading
253 KB
Loading
240 KB
Loading
211 KB
Loading
392 KB
Loading

0 commit comments

Comments
 (0)