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
You can also initialize the map control with one of the [base map styles] that are available in the Web SDK. You can then use the `setStyle` function to update the base style with a different map style.
53
53
54
54
### Set a base map style on initialization
55
55
56
-
Base styles of the map control can be set during initialization. In the following code, the `style` option of the map control is set to the [`grayscale_dark` base map style].
56
+
Base styles of the map control can be set during initialization. In the following code, the `style` option of the map control is set to the
57
+
[grayscale_dark] base map style.
57
58
58
59
```javascript
59
60
var map =newatlas.Map('map', {
@@ -63,25 +64,32 @@ var map = new atlas.Map('map', {
63
64
);
64
65
```
65
66
66
-
<br/>
67
+
:::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.":::
<iframe height='500' scrolling='no' title='Setting the style on map load' src='//codepen.io/azuremaps/embed/WKOQRq/?height=265&theme-id=0&default-tab=js,result&embed-version=2&editable=true' frameborder='no' allowtransparency='true' allowfullscreen='true'>See the Pen <a href='https://codepen.io/azuremaps/pen/WKOQRq/'>Setting the style on map load</a> by Azure Maps (<a href='https://codepen.io/azuremaps'>@azuremaps</a>) on <a href='https://codepen.io'>CodePen</a>.
The base map style can be updated by using the `setStyle` function and setting the `style` option to either change to a different base map style or add more style options.
74
78
79
+
In the following code, after a map instance is loaded, the map style is updated from `grayscale_dark` to `satellite` using the [setStyle] function.
80
+
75
81
```javascript
76
82
map.setStyle({ style:'satellite' });
77
83
```
78
84
79
-
In the following code, after a map instance is loaded, the map style is updated from `grayscale_dark` to `satellite` using the [setStyle] function.
85
+
:::image type="content" source="./media/choose-map-style/update-base-map-style.png" alt-text="Screenshot showing the satellite style, set after the map load process.":::
<iframe height='500' scrolling='no' title='Updating the style' src='//codepen.io/azuremaps/embed/yqXYzY/?height=265&theme-id=0&default-tab=js,result&embed-version=2&editable=true' frameborder='no' allowtransparency='true' allowfullscreen='true'>See the Pen <a href='https://codepen.io/azuremaps/pen/yqXYzY/'>Updating the style</a> by Azure Maps (<a href='https://codepen.io/azuremaps'>@azuremaps</a>) on <a href='https://codepen.io'>CodePen</a>.
@@ -102,10 +110,24 @@ The following image shows the style picker control displayed in `list` layout.
102
110
103
111
The following code shows you how to override the default `mapStyles` base style list. In this example, we're setting the `mapStyles` option to list the base styles to display in the style picker control.
:::image type="content" source="./media/choose-map-style/Add-style-picker-control.png" alt-text="Screenshot showing a map with the Style picker control with the layout property set to list.":::
0 commit comments