This sample demonstrates how to handle large vector data sets by organizing that data according to multiple scale levels and configuring a loading strategy. This is illustrated by a number of Feature Layers that visualize large OpenStreetMap datasets: places, roads, buildings, and points of interest in Belgium.
A QueryProvider
lets you define what kind of data should be presented at different scales. For example, at a large scale you only want to show highways, while at a smaller scale, you also want to see local roads. On a 2D map, different data will be loaded depending on the scale you're looking at. In the sample this is combined with the LoadSpatially
loading strategy, which only loads the data for the current view extent. If the LoadEverything
loading strategy is used, all the data for that scale level would be loaded.
In 3D scenes the LoadSpatially
loading strategy will load data for multiple scales: data on the horizon is visualized with a larger scale because it is farther away from the camera. The sample illustrates this by loading and displaying only highways on the horizon, while close to the camera also the local roads are loaded and shown. Consult the LoadSpatially
JSDoc for more information on how the loading strategy uses the QueryProvider
to achieve this.
The sample shows the total number of features that are loaded into the WorkingSet
of all layers. This counter is updated when you navigate over the map, as new data is loaded when scale level zones change.
Learn how to include large vector datasets. Use scale levels to control data download size and to style points, lines and polygons according to your business rules.