GIS mass data drawing method and system
By using ServiceWorker threads in the background to intercept GIS data and adopt incremental rendering, the test of massive GIS data rendering on page performance is solved, reducing the computing pressure of main thread and avoiding the instantaneous huge pressure on the device.
Patent Information
- Application Number
- CN202411434275.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-02-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Rendering of massive GIS data has caused serious tests on page performance, resulting in high computational pressure on the main thread and long-term rendering threads, causing huge instantaneous pressure on the device.
By opening the ServiceWorker thread in the background, intercepting the GIS data interface, intercepting the full amount of GIS data, and using incremental rendering, the data is pushed to the main thread in batches, reducing the calculation pressure of the main thread.
It effectively reduces the calculation pressure of the main thread, avoids long-term blank waiting and long-term occupation of rendering threads, and avoids the instantaneous pressure brought to the device by directly rendering massive data.
Smart Images

Figure CN119441368A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data visualization, and in particular to a GIS massive data drawing method and system. Background Art
[0002] Service Worker is a JavaScript script that runs in the background of the browser. It can intercept, process and return network requests, thereby realizing offline caching, message push, background synchronization and other functions. Service Worker is an advanced feature of the browser. It is essentially a Web Worker, which is a script that runs independently of the web page. Service Worker can help developers create faster, more reliable and smarter Web applications.
[0003] The Web Worker API was created to free up the main thread. This is because JavaScript in the browser runs on a single thread. As Web services become more and more complex, the time-consuming and resource-consuming calculation process in JavaScript will lead to various degrees of performance problems. Since Web Worker is independent of the main thread, it can be used to do some complex logic, and then tell the main thread through the postMessage method after completion. Service Worker is an upgraded version of Web Worker. Compared with the latter, the former has the ability of persistent offline caching.
[0004] With the continuous development of the Internet and the background of the Internet of Everything, GIS (Geographic Information System) is used in various scenarios. Various GIS data, such as point data and modeling data of houses, handheld devices, vehicles, factories, etc., are rendered on the page. The data ranges from thousands to tens of thousands, which is a severe test for page performance.
[0005] Based on this, the present invention proposes a GIS massive data drawing method and system. Summary of the invention
[0006] In order to make up for the defects of the prior art, the present invention provides a simple and efficient GIS massive data drawing method and system.
[0007] The present invention is achieved through the following technical solutions:
[0008] A method for drawing massive GIS data, characterized by comprising the following steps:
[0009] Step S1: GIS data collection
[0010] The ServiceWorker thread is started in the background, and the GIS data interface is intercepted through the ServiceWorker thread to intercept the full amount of GIS data;
[0011] Step S2: Initial rendering of GIS data
[0012] Select some data according to custom standards, push the rendering data to the main thread, and render it as the initial data; after the main thread receives the data, call the rendering method to render the data to the page;
[0013] Step S3: GIS data incremental rendering
[0014] Divide the remaining full data into several data sets according to custom preset rules, and put the data sets into the queue to be rendered; use the incremental update method to push the data to be rendered to the main thread in batches;
[0015] After the main thread receives the data, it calls the rendering method to render the data to the page.
[0016] In step S1, the implementation steps are as follows:
[0017] Step S1.1, register the Service Worker thread, wait for installation and activation, and enter the working state;
[0018] Step S1.2: intercept network requests by monitoring the fetch event of the Service Worker thread; establish a GIS data request set, and hijack the GIS data source if a GIS resource request is hit.
[0019] In the step S3, a timer is set to periodically take out a data set from the queue to be rendered according to a custom time, and push the rendering data to the main thread, which performs incremental rendering after receiving the data.
[0020] A GIS massive data drawing system, comprising:
[0021] The GIS data collection module is responsible for starting the ServiceWorker thread in the background, intercepting the GIS data interface through the ServiceWorker thread, and intercepting the full amount of GIS data;
[0022] The initial rendering module is responsible for selecting some data according to custom standards, pushing the rendering data to the main thread, and rendering it as the initial data; after the main thread receives the data, it calls the rendering method to render the data to the page;
[0023] The incremental rendering module is responsible for dividing the remaining full data into several data sets according to the custom preset rules (coordinate location set, total number divided into equal parts, etc.), and putting the data sets into the queue to be rendered; using the incremental update method, the data to be rendered is pushed to the main thread in batches;
[0024] After the main thread receives the data, it calls the rendering method to render the data to the page.
[0025] The steps of implementing GIS data collection by the GIS data collection module are as follows:
[0026] Step S1.1, register the Service Worker thread, wait for installation and activation, and enter the working state;
[0027] Step S1.2: intercept network requests by monitoring the fetch event of the Service Worker thread; establish a GIS data request set, and hijack the GIS data source if a GIS resource request is hit.
[0028] The incremental rendering module is provided with a timer, which periodically takes out a data set from the to-be-rendered queue according to a custom time, pushes the rendering data to the main thread, and performs incremental rendering after receiving the data.
[0029] A computing device, comprising:
[0030] One or more processors, one or more memories, and one or more programs, wherein the one or more programs are stored in the one or more memories and are configured to be executed by the one or more processors, and the one or more programs include instructions for executing any of the above methods.
[0031] A readable storage medium, characterized in that: a computer program is stored on the readable storage medium, and the computer program implements the above method when executed by a processor.
[0032] The beneficial effects of the present invention are as follows: the GIS massive data rendering method and system can not only reduce the computing pressure of the main thread, but also avoid long blank waiting times and long occupancy of the rendering thread through incremental rendering, thereby avoiding the instantaneous huge pressure on the device caused by directly rendering massive data. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0034] Attached Figure 1 This is a schematic diagram of the GIS massive data drawing method of the present invention. DETAILED DESCRIPTION
[0035] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0036] The GIS massive data drawing method comprises the following steps:
[0037] Step S1: GIS data collection
[0038] The ServiceWorker thread is started in the background, and the GIS data interface is intercepted through the ServiceWorker thread to intercept the full amount of GIS data;
[0039] Step S2: Initial rendering of GIS data
[0040] Select some data according to custom standards, push the rendering data to the main thread, and render it as the initial data; after the main thread receives the data, call the rendering method to render the data to the page;
[0041] Step S3: GIS data incremental rendering
[0042] The remaining full data is divided into several data sets according to the custom preset rules (coordinate location set, total number is divided into equal parts, etc.), and the data sets are put into the queue to be rendered; the data to be rendered is pushed to the main thread in batches using the incremental update method;
[0043] After the main thread receives the data, it calls the rendering method to render the data to the page.
[0044] In step S1, the implementation steps are as follows:
[0045] Step S1.1, register the Service Worker thread, wait for installation and activation, and enter the working state;
[0046] Step S1.2: intercept network requests by monitoring the fetch event of the Service Worker thread; establish a GIS data request set, and hijack the GIS data source if a GIS resource request is hit.
[0047] In the step S3, a timer is set to periodically take out a data set from the queue to be rendered according to a custom time, and push the rendering data to the main thread, which performs incremental rendering after receiving the data.
[0048] Here is an example:
[0049] GIS data collection
[0050] ```js
[0051] self.addEventListener('fetch',(event)=>{
[0052] / / Hit GIS resources
[0053] [GIS data interface collection].match(event.request).then(()=>{
[0054] if(hit){
[0055] fetch(event.request).then((response)=>{
[0056] / / Hijack the fetch request to get the GIS data source response
[0057] / / GIS data processing
[0058] ```js
[0059] / / Priority return
[0060] event.respondWith(gisdata)
[0061] / / Processing logic
[0062] Queue = dealWith(response)
[0063] / / Queue to be rendered
[0064] Queue = [data to be rendered 1, data to be rendered 2, data to be rendered 3, ...]
[0065] ```
[0066] / / Main thread communicates with Service Worker thread
[0067] ```js
[0068] / / Communication logic, push to the main thread regularly
[0069] setInterval(()=>{
[0070] postMessage(data to be rendered 1)
[0071] },timer)
[0072] / / Main thread receives
[0073] navigator.serviceWorker.addEventListener('message',function(e){
[0074] / / Pass the received data to be rendered to the main thread rendering logic
[0075] render(e.data)
[0076] });
[0077] ```
[0078] })
[0079] }
[0080] })
[0081] });
[0082] ```
[0083] The GIS massive data drawing system includes:
[0084] The GIS data collection module is responsible for starting the ServiceWorker thread in the background, intercepting the GIS data interface through the ServiceWorker thread, and intercepting the full amount of GIS data;
[0085] The initial rendering module is responsible for selecting some data according to custom standards, pushing the rendering data to the main thread, and rendering it as the initial data; after the main thread receives the data, it calls the rendering method to render the data to the page;
[0086] The incremental rendering module is responsible for dividing the remaining full data into several data sets according to the custom preset rules (coordinate location set, total number divided into equal parts, etc.), and putting the data sets into the queue to be rendered; using the incremental update method, the data to be rendered is pushed to the main thread in batches;
[0087] After the main thread receives the data, it calls the rendering method to render the data to the page.
[0088] The steps of implementing GIS data collection by the GIS data collection module are as follows:
[0089] Step S1.1, register the Service Worker thread, wait for installation and activation, and enter the working state;
[0090] Step S1.2: intercept network requests by monitoring the fetch event of the Service Worker thread; establish a GIS data request set, and hijack the GIS data source if a GIS resource request is hit.
[0091] The incremental rendering module is provided with a timer, which periodically takes out a data set from the to-be-rendered queue according to a custom time, pushes the rendering data to the main thread, and performs incremental rendering after receiving the data.
[0092] The computer-readable storage medium stores one or more programs, wherein the one or more programs include instructions, and when the instructions are executed by a computing device, the computing device performs any one of the above methods.
[0093] The computing device comprises:
[0094] One or more processors, one or more memories, and one or more programs, wherein the one or more programs are stored in the one or more memories and are configured to be executed by the one or more processors, and the one or more programs include instructions for executing any of the above methods.
[0095] Compared with the existing technology, the GIS massive data drawing method and system has the following characteristics:
[0096] First, using ServiceWorker threads to process massive amounts of data can reduce thread computing pressure;
[0097] Second, the incremental rendering method is used to avoid long blank waiting times and long-term occupancy of the rendering thread, thereby avoiding the instantaneous huge pressure on the device caused by directly rendering massive data.
[0098] The embodiment described above is only one specific implementation of the present invention. Common changes and substitutions made by those skilled in the art within the scope of the technical solution of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for drawing massive GIS data, characterized by: The following steps are involved: Step S1: GIS data collection The ServiceWorker thread is started in the background, and the GIS data interface is intercepted through the ServiceWorker thread to intercept the full amount of GIS data; Step S2: Initial rendering of GIS data Select some data according to custom standards, push the rendering data to the main thread, and render it as the initial data; after the main thread receives the data, call the rendering method to render the data to the page; Step S3: GIS data incremental rendering Divide the remaining full data into several data sets according to custom preset rules, and put the data sets into the queue to be rendered; Use the incremental update method to push the data to be rendered to the main thread in batches; After the main thread receives the data, it calls the rendering method to render the data to the page.
2. The GIS massive data rendering method according to claim 1, characterized in that: In step S1, the implementation steps are as follows: Step S1.1, register the Service Worker thread, wait for installation and activation, and enter the working state; Step S1.2: intercept network requests by monitoring the fetch event of the Service Worker thread; establish a GIS data request set, and hijack the GIS data source if a GIS resource request is hit.
3. The GIS massive data rendering method according to claim 1, characterized in that: In the step S3, a timer is set to periodically take out a data set from the queue to be rendered according to a custom time, and push the rendering data to the main thread, which performs incremental rendering after receiving the data.
4. A GIS massive data drawing system, characterized by: include: The GIS data collection module is responsible for starting the ServiceWorker thread in the background, intercepting the GIS data interface through the ServiceWorker thread, and intercepting the full amount of GIS data; The initial rendering module is responsible for selecting some data according to custom standards, pushing the rendering data to the main thread, and rendering it as the initial data; after the main thread receives the data, it calls the rendering method to render the data to the page; The incremental rendering module is responsible for dividing the remaining full data into several data sets according to custom preset rules, and putting the data sets into the queue to be rendered; Use the incremental update method to push the data to be rendered to the main thread in batches; After the main thread receives the data, it calls the rendering method to render the data to the page.
5. The GIS massive data rendering system according to claim 4, characterized in that: The steps of implementing GIS data collection by the GIS data collection module are as follows: Step S1.1, register the Service Worker thread, wait for installation and activation, and enter the working state; Step S1.2: intercept network requests by monitoring the fetch event of the Service Worker thread; establish a GIS data request set, and hijack the GIS data source if a GIS resource request is hit.
6. The GIS massive data rendering system according to claim 4, characterized in that: The incremental rendering module is provided with a timer, which periodically takes out a data set from the to-be-rendered queue according to a custom time, pushes the rendering data to the main thread, and performs incremental rendering after receiving the data.
7. A computer-readable storage medium storing one or more programs, characterized in that: The one or more programs include instructions which, when executed by a computing device, cause the computing device to perform any one of the methods according to claims 1 to 3.
8. A computing device, characterized in that include: One or more processors, one or more memories, and one or more programs, wherein the one or more programs are stored in the one or more memories and are configured to be executed by the one or more processors, and the one or more programs include instructions for executing any of the methods according to claims 1 to 3.
Citation Information
Patent Citations
Method and device for loading webpage
CN108228282A
Method and device for realizing service data processing and client
CN111367596A
Page rendering method and device, equipment, storage medium and program product
CN113961832A
Page rendering method, device and equipment and computer readable storage medium
CN115982489A
Applet page rendering method and apparatus, electronic device, and storage medium
WO2022134428A1
Cited By
Method and system for rendering GIS (Geographic Information System) mass data of electric power metering equipment
CN121478731A