Skip to content

Commit fcd646c

Browse files
committed
Addressed feedback and added end-links
1 parent 1392e69 commit fcd646c

File tree

1 file changed

+46
-21
lines changed

1 file changed

+46
-21
lines changed

articles/azure-maps/web-sdk-best-practices.md

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ titleSuffix: Microsoft Azure Maps
44
description: Learn tips & tricks to optimize your use of the Azure Maps Web SDK.
55
author: sinnypan
66
ms.author: sipa
7-
ms.date: 11/29/2021
7+
ms.date: 04/13/2023
88
ms.topic: conceptual
99
ms.service: azure-maps
1010
services: azure-maps
@@ -20,7 +20,7 @@ Generally, when looking to improve performance of the map, look for ways to redu
2020

2121
## Security best practices
2222

23-
For more information on security best practices, see [Authentication and authorization best practices](authentication-best-practices.md).
23+
For more information on security best practices, see [Authentication and authorization best practices].
2424

2525
### Use the latest versions of Azure Maps
2626

@@ -30,10 +30,13 @@ If self-hosting the Azure Maps Web SDK via the npm module, be sure to use the ca
3030

3131
```json
3232
"dependencies": {
33-
"azure-maps-control": "^2.0.30"
33+
"azure-maps-control": "^2.2.6"
3434
}
3535
```
3636

37+
> [!TIP]
38+
> Always use the latest version of the npm Azure Maps Control. For more information, see [azure-maps-control] in the npm documentation.
39+
3740
## Optimize initial map load
3841

3942
When a web page is loading, one of the first things you want to do is start rendering something as soon as possible so that the user isn't staring at a blank screen.
@@ -60,7 +63,7 @@ If the map takes a while to load due to network limitations or other priorities
6063

6164
### Set initial map style and camera options on initialization
6265

63-
Often apps want to load the map to a specific location or style. Sometimes developers wait until the map has loaded (or wait for the `ready` event), and then use the `setCemer` or `setStyle` functions of the map. This often takes longer to get to the desired initial map view since many resources end up being loaded by default before the resources needed for the desired map view are loaded. A better approach is to pass in the desired map camera and style options into the map when initializing it.
66+
Often apps want to load the map to a specific location or style. Sometimes developers wait until the map has loaded (or wait for the `ready` event), and then use the `setCamera` or `setStyle` functions of the map. This often takes longer to get to the desired initial map view since many resources end up being loaded by default before the resources needed for the desired map view are loaded. A better approach is to pass in the desired map camera and style options into the map when initializing it.
6467

6568
## Optimize data sources
6669

@@ -74,17 +77,17 @@ The Web SDK has two data sources,
7477
If working with larger datasets containing millions of features, the recommended way to achieve optimal performance is to expose the data using a server-side solution such as vector or raster image tile service.
7578
Vector tiles are optimized to load only the data that is in view with the geometries clipped to the focus area of the tile and generalized to match the resolution of the map for the zoom level of the tile.
7679

77-
The [Azure Maps Creator platform](creator-indoor-maps.md) retrieves data in vector tile format. Other data formats can be using tools such as [Tippecanoe](https://github.com/mapbox/tippecanoe). For more information on working with vector tiles, see the Mapbox [awesome-vector-tiles](https://github.com/mapbox/awesome-vector-tiles#awesome-vector-tiles-) readme in GitHub.
80+
The [Azure Maps Creator platform] retrieves data in vector tile format. Other data formats can be using tools such as [Tippecanoe]. For more information on working with vector tiles, see the Mapbox [awesome-vector-tiles] readme in GitHub.
7881

7982
It's also possible to create a custom service that renders datasets as raster image tiles on the server-side and load the data using the TileLayer class in the map SDK. This provides exceptional performance as the map only needs to load and manage a few dozen images at most. However, there are some limitations with using raster tiles since the raw data isn't available locally. A secondary service is often required to power any type of interaction experience, for example, find out what shape a user clicked on. Additionally, the file size of a raster tile is often larger than a compressed vector tile that contains generalized and zoom level optimized geometries.
8083

81-
For more information about data sources, see [Create a data source](create-data-source-web-sdk.md).
84+
For more information about data sources, see [Create a data source].
8285

8386
### Combine multiple datasets into a single vector tile source
8487

8588
The less data sources the map has to manage, the faster it can process all features to be displayed. In particular, when it comes to tile sources, combining two vector tile sources together cuts the number of HTTP requests to retrieve the tiles in half, and the total amount of data would be slightly smaller since there's only one file header.
8689

87-
Combining multiple data sets in a single vector tile source can be achieved using a tool such as [Tippecanoe](https://github.com/mapbox/tippecanoe). Data sets can be combined into a single feature collection or separated into separate layers within the vector tile known as source-layers. When connecting a vector tile source to a rendering layer, you would specify the source-layer that contains the data that you want to render with the layer.
90+
Combining multiple data sets in a single vector tile source can be achieved using a tool such as [Tippecanoe]. Data sets can be combined into a single feature collection or separated into separate layers within the vector tile known as source-layers. When connecting a vector tile source to a rendering layer, you would specify the source-layer that contains the data that you want to render with the layer.
8891

8992
### Reduce the number of canvas refreshes due to data updates
9093

@@ -116,7 +119,7 @@ When features have numerous properties or content, it's much more performant to
116119

117120
Additionally, reducing the number of significant digits in the coordinates of features can also significantly reduce the data size. It isn't uncommon for coordinates to contain 12 or more decimal places; however, six decimal places have an accuracy of about 0.1 meter, which is often more precise than the location the coordinate represents (six decimal places is recommended when working with small location data such as indoor building layouts). Having any more than six decimal places will likely make no difference in how the data is rendered and requires the user to download more data for no added benefit.
118121

119-
Here's a list of [useful tools for working with GeoJSON data](https://github.com/tmcw/awesome-geojson).
122+
Here's a list of [useful tools for working with GeoJSON data].
120123

121124
### Use a separate data source for rapidly changing data
122125

@@ -167,7 +170,7 @@ That said, if you only have a few points to render on the map, the simplicity of
167170

168171
### Combine layers
169172

170-
The map is capable of rendering hundreds of layers, however, the more layers there are, the more time it takes to render a scene. One strategy to reduce the number of layers is to combine layers that have similar styles or can be styled using a [data-driven styles](data-driven-style-expressions-web-sdk.md).
173+
The map is capable of rendering hundreds of layers, however, the more layers there are, the more time it takes to render a scene. One strategy to reduce the number of layers is to combine layers that have similar styles or can be styled using a [data-driven styles].
171174

172175
For example, consider a data set where all features have a `isHealthy` property that can have a value of `true` or `false`. If creating a bubble layer that renders different colored bubbles based on this property, there are several ways to do this as shown in the following list, from least performant to most performant.
173176

@@ -261,7 +264,7 @@ The symbol layer has two options that exist for both icon and text called `allow
261264
When working with large sets of data points you may find that when rendered at certain zoom levels, many of the points overlap and are only partial visible, if at all. Clustering is process of grouping points that are close together and representing them as a single clustered point. As the user zooms in the map, clusters break apart into their individual points. This can significantly reduce the amount of data that needs to be rendered, make the map feel less cluttered, and improve performance. The `DataSource` class has options for clustering data locally. Additionally, many tools that generate vector tiles also have clustering options.
262265

263266
Additionally, increase the size of the cluster radius to improve performance. The larger the cluster radius, the less clustered points there's to keep track of and render.
264-
For more information, see [Clustering point data in the Web SDK](clustering-point-data-web-sdk.md)
267+
For more information, see [Clustering point data in the Web SDK].
265268

266269
### Use weighted clustered heat maps
267270

@@ -273,15 +276,15 @@ var layer = new atlas.layer.HeatMapLayer(source, null, {
273276
});
274277
```
275278

276-
For more information, see [Clustering and the heat maps layer](clustering-point-data-web-sdk.md#clustering-and-the-heat-maps-layer)
279+
For more information, see [Clustering and the heat maps layer].
277280

278281
### Keep image resources small
279282

280283
Images can be added to the maps image sprite for rendering icons in a symbol layer or patterns in a polygon layer. Keep these images small to minimize the amount of data that has to be downloaded and the amount of space they take up in the maps image sprite. When using a symbol layer that scales the icon using the `size` option, use an image that is the maximum size your plan to display on the map and no bigger. This ensures the icon is rendered with high resolution while minimizing the resources it uses. Additionally, SVGs can also be used as a smaller file format for simple icon images.
281284

282285
## Optimize expressions
283286

284-
[Data-driven style expressions](data-driven-style-expressions-web-sdk.md) provide flexibility and power for filtering and styling data on the map. There are many ways in which expressions can be optimized. Here are a few tips.
287+
[Data-driven style expressions] provide flexibility and power for filtering and styling data on the map. There are many ways in which expressions can be optimized. Here are a few tips.
285288

286289
### Reduce the complexity of filters
287290

@@ -341,7 +344,7 @@ Things to check:
341344
* Ensure that you complete your authentication options in the map. Without authentication, the map loads a blank canvas and returns a 401 error in the network tab of the browser's developer tools.
342345
* Ensure that you have an internet connection.
343346
* Check the console for errors of the browser's developer tools. Some errors may cause the map not to render. Debug your application.
344-
* Ensure you're using a [supported browser](supported-browsers.md).
347+
* Ensure you're using a [supported browser].
345348

346349
**All my data is showing up on the other side of the world, what's going on?**
347350

@@ -376,39 +379,61 @@ Things to check:
376379
Yes.
377380

378381
> [!TIP]
379-
> Safari has a [bug](https://bugs.webkit.org/show_bug.cgi?id=170075) that prevents sandboxed iframes from running web workers, a requirement of the Azure Maps Web SDK. The solution is to add the `"allow-same-origin"` tag to the sandbox property of the iframe.
382+
> Safari has a [bug] that prevents sandboxed iframes from running web workers, a requirement of the Azure Maps Web SDK. The solution is to add the `"allow-same-origin"` tag to the sandbox property of the iframe.
380383
381384
## Get support
382385

383386
The following are the different ways to get support for Azure Maps depending on your issue.
384387

385388
**How do I report a data issue or an issue with an address?**
386389

387-
Report issues using the [Azure Maps feedback tool](https://feedback.azuremaps.com). Detailed instructions on reporting data issues are provided in the [Provide data feedback to Azure Maps](how-to-use-feedback-tool.md) article.
390+
Report issues using the [Azure Maps feedback] site. Detailed instructions on reporting data issues are provided in the [Provide data feedback to Azure Maps] article.
388391

389392
> [!NOTE]
390393
> Each issue submitted generates a unique URL to track it. Resolution times vary depending on issue type and the time required to verify the change is correct. The changes will appear in the render services weekly update, while other services such as geocoding and routing are updated monthly.
391394
392395
**How do I report a bug in a service or API?**
393396

394-
Report issues on Azure's [Help + support](https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview) page by selecting the **Create a support request** button.
397+
Report issues on Azure's [Help + support] page by selecting the **Create a support request** button.
395398

396399
**Where do I get technical help for Azure Maps?**
397400

398-
* For questions related to the Azure Maps Power BI visual, contact [Power BI support](https://powerbi.microsoft.com/support/).
401+
* For questions related to the Azure Maps Power BI visual, contact [Power BI support].
399402

400-
* For all other Azure Maps services, contact [Azure support](https://azure.com/support).
403+
* For all other Azure Maps services, contact [Azure support].
401404

402-
* For question or comments on specific Azure Maps Features, use the [Azure Maps developer forums](/answers/topics/azure-maps.html).
405+
* For question or comments on specific Azure Maps Features, use the [Azure Maps developer forums].
403406

404407
## Next steps
405408

406409
See the following articles for more tips on improving the user experience in your application.
407410

408411
> [!div class="nextstepaction"]
409-
> [Make your application accessible](map-accessibility.md)
412+
> [Make your application accessible]
410413
411414
Learn more about the terminology used by Azure Maps and the geospatial industry.
412415

413416
> [!div class="nextstepaction"]
414-
> [Azure Maps glossary](glossary.md)
417+
> [Azure Maps glossary]
418+
419+
[Authentication and authorization best practices]: authentication-best-practices.md
420+
[awesome-vector-tiles]: https://github.com/mapbox/awesome-vector-tiles#awesome-vector-tiles-
421+
[Azure Maps Creator platform]: creator-indoor-maps.md
422+
[Azure Maps developer forums]: /answers/topics/azure-maps.html
423+
[Azure Maps feedback]: https://feedback.azuremaps.com
424+
[Azure Maps glossary]: glossary.md
425+
[Azure support]: https://azure.com/support
426+
[azure-maps-control]: https://www.npmjs.com/package/azure-maps-control?activeTab=versions
427+
[bug]: https://bugs.webkit.org/show_bug.cgi?id=170075
428+
[Clustering and the heat maps layer]: clustering-point-data-web-sdk.md#clustering-and-the-heat-maps-layer
429+
[Clustering point data in the Web SDK]: clustering-point-data-web-sdk.md
430+
[Create a data source]: create-data-source-web-sdk.md
431+
[Data-driven style expressions]: data-driven-style-expressions-web-sdk.md
432+
[data-driven styles]: data-driven-style-expressions-web-sdk.md
433+
[Help + support]: https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview
434+
[Make your application accessible]: map-accessibility.md
435+
[Power BI support]: https://powerbi.microsoft.com/support
436+
[Provide data feedback to Azure Maps]: how-to-use-feedback-tool.md
437+
[supported browser]: supported-browsers.md
438+
[Tippecanoe]: https://github.com/mapbox/tippecanoe
439+
[useful tools for working with GeoJSON data]: https://github.com/tmcw/awesome-geojson

0 commit comments

Comments
 (0)