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
Images can be used with HTML markers and various layers within the Azure Maps web SDK:
16
16
17
-
- Symbol layers can render points on the map with an image icon. Symbols can also be rendered along a lines path.
18
-
- Polygon layers can be rendered with a fill pattern image.
19
-
- HTML markers can render points using images and other HTML elements.
17
+
- Symbol layers can render points on the map with an image icon. Symbols can also be rendered along a lines path.
18
+
- Polygon layers can be rendered with a fill pattern image.
19
+
- HTML markers can render points using images and other HTML elements.
20
20
21
21
In order to ensure good performance with layers, load the images into the map image sprite resource before rendering. The [IconOptions](/javascript/api/azure-maps-control/atlas.iconoptions), of the SymbolLayer, preloads a couple of marker images in a handful of colors into the map image sprite, by default. These marker images and more are available as SVG templates. They can be used to create images with custom scales, or used as a customer primary and secondary color. In total there are 42 image templates provided: 27 symbol icons and 15 polygon fill patterns.
Once an image template is loaded into the map image sprite, it can be rendered as a symbol in a symbol layer by referencing the image resource ID in the `image` option of the `iconOptions`.
50
50
51
-
The following sample renders a symbol layer using the `marker-flat` image template with a teal primary color and a white secondary color.
51
+
The following sample renders a symbol layer using the `marker-flat` image template with a teal primary color and a white secondary color.
52
52
53
53
<br/>
54
54
@@ -59,9 +59,9 @@ The following sample renders a symbol layer using the `marker-flat` image templa
59
59
60
60
## Use an image template along a lines path
61
61
62
-
Once an image template is loaded into the map image sprite, it can be rendered along the path of a line by adding a LineString to a data source and using a symbol layer with a `lineSpacing`option and by referencing the ID of the image resource in the `image` option of th `iconOptions`.
62
+
Once an image template is loaded into the map image sprite, it can be rendered along the path of a line by adding a LineString to a data source and using a symbol layer with a `lineSpacing`option and by referencing the ID of the image resource in the `image` option of th `iconOptions`.
63
63
64
-
The following sample renders a pink line on the map and uses a symbol layer using the `car` image template with a dodger blue primary color and a white secondary color.
64
+
The following sample renders a pink line on the map and uses a symbol layer using the `car` image template with a dodger blue primary color and a white secondary color.
65
65
66
66
<br/>
67
67
@@ -87,7 +87,7 @@ The following sample renders a polygon layer using the `dot` image template with
87
87
</iframe>
88
88
89
89
> [!TIP]
90
-
> Setting the secondary color of fill patterns makes it easier to see the underlying map will still providing the primary pattern.
90
+
> Setting the secondary color of fill patterns makes it easier to see the underlying map will still providing the primary pattern.
91
91
92
92
## Use an image template with an HTML marker
93
93
@@ -102,9 +102,9 @@ The following sample uses the `marker-arrow` template with a red primary color,
102
102
(<a href='https://codepen.io/azuremaps'>@azuremaps</a>) on <a href='https://codepen.io'>CodePen</a>.
103
103
</iframe>
104
104
105
-
106
105
> [!TIP]
107
106
> Image templates can be used outside of the map too. The getImageTemplate funciton returns an SVG string that has placeholders; `{color}`, `{secondaryColor}`, `{scale}`, `{text}`. Replace these placeholder values to create a valid SVG string. You can then either add the SVG string directly to the HTML DOM or convert it into a data URI and insert it into an image tag. For example:
107
+
>
108
108
> ```JavaScript
109
109
>//Retrieve an SVG template and replace the placeholder values.
@@ -356,7 +356,6 @@ This table lists all image templates currently available within the Azure Maps w
356
356
:::column-end:::
357
357
:::row-end:::
358
358
359
-
360
359
**Polygon fill pattern templates**
361
360
362
361
:::row:::
@@ -497,7 +496,6 @@ The map preloads a set of icons into the maps image sprite using the `marker`, `
497
496
| `pin-round-darkblue` | `#003963` | `#ffffff` |
498
497
| `pin-round-red` | `#ef4c4c` | `#ffffff` |
499
498
500
-
501
499
## Try it now tool
502
500
503
501
With the following tool, you can render the different built-in image templates in various ways and customize the primary and secondary colors and scale.
@@ -517,8 +515,7 @@ Learn more about the classes and methods used in this article:
0 commit comments