A method and apparatus for loading vector tiles

CN121388208BActive Publication Date: 2026-08-14浪潮智慧城市科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-10
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0003]当前CesiumJS仅提供以栅格瓦片的形式加载矢量瓦片地图的方法,使得CesiumJS难以发挥矢量瓦片地图的众多优越特性

Benefits of technology

[0040](1)本发明运用瓦片状态值取负值的操作,管理瓦片的生命周期,在记录瓦片状态的同时,更为准确的判别无用瓦片并及时移除,提升了地图服务的缓存空间利用效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121388208B_ABST
    Figure CN121388208B_ABST
Patent Text Reader

Abstract

This invention relates to the fields of smart cities and GIS, specifically providing a vector tile loading method and apparatus based on CesiumJS, comprising the following steps: S1, obtaining the tile set T0 that CesiumJS should render from the current camera view, and updating the state values ​​according to the current tile state; S2, establishing a timed execution method to periodically obtain the tile set T1 that CesiumJS should render from the current camera view, and by comparing tile set T0 with T1, adding new tiles to tile set T0 and synchronously updating the tile state values ​​in T0; S3, updating the tile state values ​​again according to the tile parent-child hierarchy and tile state within tile set T0; S4, removing redundant tiles from tile set T0 according to the tile state of tile set T0. Compared with existing technologies, this invention can fully utilize the existing capabilities and features of CesiumJS to expand the ability to load vector tile map services using CesiumJS.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of smart cities and GIS, and specifically provides a vector tile loading method and apparatus. Background Technology

[0002] Vector tile maps are electronic map services that directly render vector geometric elements such as points, lines, and polygons using a map engine. The information of these vector geometric elements is stored and transmitted in the form of map tiles. Compared to traditional raster tile maps, vector tile maps offer advantages such as higher display accuracy, more flexible and diverse styles, and stronger map interactivity. They are gradually replacing traditional raster tile map services in high-precision navigation and mobile map applications. CesiumJS is one of the most frequently used, widely applied, and actively developed browser map engines in the current electronic map field, supporting OGC-standard 2D and 3D map data services such as WMS, WMTS, and 3DTiles.

[0003] Currently, CesiumJS only provides a method for loading vector tile maps in the form of raster tiles, making it difficult for CesiumJS to take full advantage of the many superior features of vector tile maps. Summary of the Invention

[0004] This invention addresses the shortcomings of the prior art by providing a highly practical vector tile loading method.

[0005] A further technical objective of this invention is to provide a reasonably designed, safe, and applicable vector tile loading device.

[0006] The technical solution adopted by this invention to solve its technical problem is:

[0007] A vector tile loading method, based on CesiumJS, has the following steps:

[0008] S1. Obtain the set of tiles T0 that CesiumJS should render from the current camera view, and update the state values ​​according to the current state of the tiles;

[0009] S2. Establish a timed execution method to periodically obtain the set of tiles T1 that CesiumJS should render under the current camera view, and add new tiles to the set of tiles T0 by comparing the set of tiles T0 with T1 and synchronously update the tile state values ​​in T0.

[0010] S3. Update the tile state value again based on the tile parent-child hierarchy and tile state within the tile set T0;

[0011] S4. Based on the tile state of tile set T0, remove the excess tiles in T0.

[0012] Furthermore, step S1 includes:

[0013] S1-1. Obtain tilesToRender from the current camera view in CesiumJS and use it as a tile collection T0;

[0014] S1-2. Define the tile state as four states: REFINE value -1, LOADING value 2, LOADED value 3, and RENDER value 4.

[0015] S1-3, Write the asynchronous network request method Fn0, the asynchronous data loading method Fn1, and the synchronous data unloading method Fn2 for the tiles. This requires using the Scene, Primitive, and PrimitiveCollection objects of CesiumJS.

[0016] S1-4. Initialize the state of all tiles in T0 to LOADING, and automatically execute the asynchronous method Fn0 on the tiles with the state of LOADING.

[0017] S1-5. When the method Fn0 of a tile in T0 completes the request operation, the state of this tile is updated to LOADED, and the asynchronous method Fn1 is automatically executed on the tiles with the state of LOADED; when a tile completes the method Fn1, the state of this tile is updated to RENDER.

[0018] Furthermore, in steps S1-3, the asynchronous network request method Fn0 uses the Get method to obtain the tile file content through the tile's row number x, column number y, and level z;

[0019] The asynchronous data loading method Fn1 parses the geometric and attribute information of point, line, and polygon vector features in the tile file. Vector feature objects are managed using Primitive objects. Primitives with the same x, y, and z values ​​are managed using the same PrimitiveCollection object and mounted in the Scene object. After mounting, the asynchronous update method of PrimitiveCollection is executed.

[0020] The synchronous data unloading method Fn2 removes the PrimitiveCollection object specifying x, y, and z from the Scene.

[0021] Furthermore, step S2 includes:

[0022] S2-1. Establish a timed execution method that executes once every 300ms by default, obtain the collection of tiles that CesiumJS should render in the current camera view, tilesToRender, and set it as T1;

[0023] S2-2. Multiply the state values ​​of all tiles in the current T0 by negative one, and compare T0 with T1.

[0024] Furthermore, in step S2-2, if a tile of T0 also exists in T1, then the state value of this tile is multiplied by negative one again;

[0025] If a tile exists in T1 but not in T0, then insert the tile into T0 and initialize its state to LOADING.

[0026] Furthermore, step S3 includes:

[0027] S3-1. Obtain the maximum level maxDepth of the tiles in T0, and traverse all tiles in T0 whose state values ​​are less than REFINE and set them as tile set T2;

[0028] S3-2, Traverse all tiles t in T2.

[0029] Furthermore, in step S3-2, all tiles t in T2 are traversed and processed as follows:

[0030] Use a quadtree to traverse all child tiles of tile t that exist in T0. If a child tile exists in T0 and its state is RENDER, then keep the state value of tile t unchanged.

[0031] If a child tile exists in T0 and its state is not all RENDER, then the state value of tile t is multiplied by negative one again.

[0032] If no sub-tile of tile t exists in T0, then the state value of tile t remains unchanged.

[0033] Furthermore, step S4 includes:

[0034] S4-1. Process T0 according to the state value of the tiles in T0, remove all tiles whose state value is still less than REFINE from T0 and execute method Fn2;

[0035] S4-2, Tiles removed from the T0 tile set will no longer be subject to any operations.

[0036] A vector tile loading device includes: at least one memory and at least one processor;

[0037] The at least one memory is used to store a machine-readable program;

[0038] The at least one processor is configured to invoke the machine-readable program to execute a vector tile loading method.

[0039] Compared with the prior art, the vector tile loading method and apparatus of the present invention have the following outstanding advantages:

[0040] (1) This invention uses the operation of taking negative values ​​of tile status values ​​to manage the life cycle of tiles. While recording the tile status, it can more accurately identify useless tiles and remove them in time, thereby improving the utilization efficiency of the cache space of map services.

[0041] (2) Unlike conventional methods of monitoring changes in map viewpoint, a timed method with adjustable execution intervals is used to update the tile set under the current camera viewpoint, which further ensures that the map has more stable operating efficiency during zooming, panning and other operations.

[0042] (3) Using the maximum level maxDepth effectively reduces the number of child tiles traversed, optimizes the display effect of the map during the indentation process, and avoids the problem of missing map display caused by the child level map not being fully loaded and the parent level tiles being unloaded.

[0043] (4) Make full use of the methods of the CesiumJS native class library to effectively extend the vector tile map service capabilities without changing the CesiumJS native raster vector tile loading logic. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0045] Figure 1 This is a flowchart illustrating a vector tile loading method;

[0046] Figure 2 This is a schematic diagram illustrating the update method of T0 in step S2 of a vector tile loading method;

[0047] Figure 3 This is a schematic diagram illustrating the update method of T0 in step S3 of a vector tile loading method;

[0048] Figure 4 This is a schematic diagram of the update method of T0 in step S4 of a vector tile loading method. Detailed Implementation

[0049] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to specific embodiments. Obviously, the described embodiments are merely some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0050] The following is a preferred embodiment:

[0051] like Figure 1 As shown, a vector tile loading method in this embodiment, based on CesiumJS, has the following steps:

[0052] S1. Obtain the set of tiles T0 that CesiumJS should render from the current camera view, and update the state values ​​according to the current state of the tiles;

[0053] include:

[0054] S1-1. Obtain tilesToRender from the current camera view in CesiumJS and use it as a tile collection T0;

[0055] S1-2. Define the tile state as four states: REFINE (value -1), LOADING (value 2), LOADED (value 3), and RENDER (value 4).

[0056] S1-3. Write the asynchronous network request method Fn0, the asynchronous data loading method Fn1, and the synchronous data unloading method Fn2 for the tiles. This requires using the Scene, Primitive, and PrimitiveCollection objects of CesiumJS.

[0057] Method Fn0 retrieves the tile file content using the tile's row number x, column number y, and level z using the Get method;

[0058] The asynchronous data loading method Fn1 parses the geometric and attribute information of point, line, and polygon vector features in the tile file. Vector feature objects are managed using Primitive objects. Primitives with the same x, y, and z values ​​are managed using the same PrimitiveCollection object and mounted in the Scene object. After mounting is completed, the asynchronous update method of PrimitiveCollection is executed.

[0059] The synchronous data unloading method Fn2 removes the PrimitiveCollection object with specified x, y, and z from the Scene.

[0060] S1-4. Initialize the state of all tiles in T0 to LOADING, and automatically execute the asynchronous method Fn0 on the tiles with the state of LOADING.

[0061] S1-5. When the method Fn0 of a tile in T0 completes the request operation, the state of this tile is updated to LOADED, and the asynchronous method Fn1 is automatically executed on the tiles with the state of LOADED; when a tile completes the method Fn1, the state of this tile is updated to RENDER.

[0062] S2. Establish a timed execution method to periodically obtain the set of tiles T1 that CesiumJS should render under the current camera view, and add new tiles to the set of tiles T0 by comparing the set of tiles T0 with T1 and synchronously update the tile state values ​​in T0.

[0063] like Figure 2 As shown, it includes:

[0064] S2-1. Establish a timed execution method that executes once every 300ms by default, obtain the collection of tiles that CesiumJS should render in the current camera view, tilesToRender, and set it as T1;

[0065] S2-2. Multiply the state values ​​of all tiles in the current T0 by negative one, and compare T0 with T1.

[0066] If a tile of T0 also exists in T1, then multiply the state value of this tile by one negative number again.

[0067] If a tile exists in T1 but not in T0, then insert the tile into T0 and initialize its state to LOADING.

[0068] S3. Update the tile state value again based on the tile parent-child hierarchy and tile state within the tile set T0;

[0069] include:

[0070] S3-1. Obtain the maximum level maxDepth of the tiles in T0, and traverse all tiles in T0 whose state values ​​are less than REFINE and set them as tile set T2;

[0071] S3-2. Traverse all tiles t in T2 and perform the following processing:

[0072] Use a quadtree (depth: maxDepth-tz) to traverse all child tiles of tile t that exist in T0. If a child tile exists in T0 and its state is RENDER, then keep the state value of tile t unchanged.

[0073] If a child tile exists in T0 and its state is not all RENDER, then the state value of tile t is multiplied by negative one again; if no child tile of tile t exists in T0, then the state value of tile t remains unchanged.

[0074] S4. Based on the tile state of tile set T0, remove the excess tiles from T0;

[0075] like Figure 4 As shown, it includes:

[0076] S4-1. Process T0 according to the state value of the tiles in T0, remove all tiles whose state value is still less than REFINE from T0 and execute method Fn2;

[0077] S4-2, Tiles removed from the T0 tile set will no longer be subject to any operations.

[0078] Based on the above method, a vector tile loading device in this embodiment includes: at least one memory and at least one processor;

[0079] The at least one memory is used to store a machine-readable program;

[0080] The at least one processor is configured to invoke the machine-readable program to execute a vector tile loading method.

[0081] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A vector tile loading method, characterized in that, Based on CesiumJS, the steps are as follows: S1. Obtain the set of tiles T0 that CesiumJS should render from the current camera view, and update the state values ​​according to the current state of the tiles; include: S1-1. Obtain tilesToRender from the current camera view in CesiumJS and use it as a tile collection T0; S1-2. Define the tile state as four states: REFINE value -1, LOADING value 2, LOADED value 3, and RENDER value 4. S1-3, Write the asynchronous network request method Fn0, the asynchronous data loading method Fn1, and the synchronous data unloading method Fn2 for the tiles. This requires using the Scene, Primitive, and PrimitiveCollection objects of CesiumJS. S1-4. Initialize the state of all tiles in T0 to LOADING, and automatically execute the asynchronous method Fn0 on the tiles with the state of LOADING. S1-5. When method Fn0 of a tile in T0 completes the request operation, the state of this tile is updated to LOADED, and the asynchronous method Fn1 is automatically executed on the tiles with the state of LOADED; when a tile completes method Fn1, the state of this tile is updated to RENDER. S2. Establish a timed execution method to periodically obtain the set of tiles T1 that CesiumJS should render under the current camera view, and add new tiles to the set of tiles T0 by comparing the set of tiles T0 with T1 and synchronously update the tile state values ​​in T0. include: S2-1. Establish a timed execution method that executes once every 300ms by default, obtain the collection of tiles that CesiumJS should render in the current camera view, tilesToRender, and set it as T1; S2-2, Multiply the state values ​​of all tiles in the current T0 by negative one, and compare T0 with T1; If a tile of T0 also exists in T1, then multiply the state value of this tile by one negative number again. If a tile exists in T1 but not in T0, then insert the tile into T0 and initialize its state to LOADING; S3. Update the tile state value again based on the tile parent-child hierarchy and tile state within the tile set T0; S3-1. Obtain the maximum level maxDepth of the tiles in T0, and traverse all tiles in T0 whose state values ​​are less than REFINE and set them as tile set T2; S3-2, Traverse all tiles t in T2; Iterate through all tiles t in T2 and perform the following processing: Use a quadtree to traverse all child tiles of tile t that exist in T0. If a child tile exists in T0 and its state is RENDER, then keep the state value of tile t unchanged. If a child tile exists in T0 and its state is not all RENDER, then the state value of tile t is multiplied by negative one again. If no sub-tile of tile t exists in T0, then the state value of tile t remains unchanged; S4. Based on the tile state of tile set T0, remove the redundant tiles in T0; include: S4-1. Process T0 according to the state value of the tiles in T0, remove all tiles whose state value is still less than REFINE from T0 and execute method Fn2; S4-2, Tiles removed from the T0 tile set will no longer be subject to any operations.

2. The vector tile loading method according to claim 1, characterized in that, In steps S1-3, the asynchronous network request method Fn0 uses the Get method to obtain the tile file content through the tile's row number x, column number y, and level z; The asynchronous data loading method Fn1 parses the geometric and attribute information of point, line, and polygon vector features in the tile file. Vector feature objects are managed using Primitive objects. Primitives with the same x, y, and z values ​​are managed using the same PrimitiveCollection object and mounted in the Scene object. After mounting, the asynchronous update method of PrimitiveCollection is executed. The synchronous data unloading method Fn2 removes the PrimitiveCollection object specifying x, y, and z from the Scene.

3. A vector tile loading device, characterized in that, include: At least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to invoke the machine-readable program to execute the method according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Loading method and system of vector tile data, service terminal and memory

    CN107766487A

  • Vector tile display method and system

    CN113495933A