A water conservancy entity spatial feature indexing and efficient rendering method based on machine learning and WebGL

By using machine learning and WebGL-based methods, a spatial element index library and a clustering label index library for water conservancy entities were established. This solved the problem of low efficiency in water conservancy entity screening and rendering within the basin, achieving efficient water conservancy entity screening and rendering, and improving the accuracy and physical meaning of cluster analysis.

CN120448606BActive Publication Date: 2025-11-18HUAZHONG UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510446094.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-11-18
Estimated Expiration
2045-04-10

AI Technical Summary

Technical Problem

The efficiency of filtering water conservancy entities within the basin is low, and the rendering efficiency cannot meet the usage requirements, making it impossible to efficiently filter out water conservancy entities that meet the query function.

Method used

Based on machine learning and WebGL methods, the various water conservancy entities within the watershed are decomposed into spatial elements, and a spatial element index library and a clustering label index library are established. Through feature vector clustering and grid cell relationship table, fast spatial clustering and efficient rendering are achieved.

Benefits of technology

It improves the efficiency of water conservancy entity screening and rendering, realizes visualization and efficient rendering in GIS platforms, databases or application systems, avoids clustering getting trapped in local optima, and improves the accuracy and physical meaning of cluster analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448606B_ABST
    Figure CN120448606B_ABST
Patent Text Reader

Abstract

The application provides a water conservancy entity space feature index and efficient rendering method based on machine learning and WebGL, and comprises the following steps: decomposing each water conservancy entity in a watershed into a space feature, and establishing a watershed water conservancy entity space feature index database; establishing a feature vector of each water conservancy entity according to the space feature of each water conservancy entity in the watershed; clustering each water conservancy entity based on the feature vector of each water conservancy entity, obtaining a clustering label of each water conservancy entity, and establishing a watershed water conservancy entity clustering label index database; and rendering the water conservancy entity in the watershed according to the watershed water conservancy entity space feature index database and the watershed water conservancy entity clustering label index database. The application has the following advantages: the established watershed water conservancy entity space feature index database and the watershed water conservancy entity clustering label index database can efficiently realize visual expression, spatial aggregation and classified retrieval in a GIS platform, a database or an application system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of water conservancy geographic information technology and information retrieval technology, specifically involving a method for indexing and efficiently rendering spatial elements of water conservancy entities based on machine learning and WebGL. Background Technology

[0002] Water conservancy entities within a river basin are characterized by their large number, wide distribution, and diverse functions. When conducting joint operations involving water conservancy entities within the basin for purposes such as flood control, scheduling, drainage, and irrigation, it is difficult to efficiently select water conservancy entities that meet the relevant query function requirements, resulting in low water conservancy entity selection efficiency. Furthermore, when rendering various water conservancy entities within the basin, the rendering efficiency cannot meet the usage requirements. Summary of the Invention

[0003] To address the shortcomings of existing technologies, this invention provides a method for indexing and rendering spatial elements of hydraulic entities based on machine learning and WebGL, which can effectively solve the aforementioned problems.

[0004] The technical solution adopted in this invention is as follows:

[0005] This invention provides a method for indexing and efficiently rendering spatial features of hydraulic entities based on machine learning and WebGL, comprising the following steps:

[0006] Step S1: Decompose each water conservancy entity within the basin into spatial elements and establish a spatial element index library for water conservancy entities in the basin.

[0007] Step S2: Based on the spatial elements of each water conservancy entity within the basin, establish the feature vector of each water conservancy entity; based on the feature vector of each water conservancy entity, cluster each water conservancy entity within the basin to obtain the clustering label of each water conservancy entity, and establish a water conservancy entity clustering label index library.

[0008] Step S3: Render the water conservancy entities within the watershed according to the spatial element index library of watershed water conservancy entities and the clustering tag index library of watershed water conservancy entities.

[0009] Preferably, step S1 specifically includes:

[0010] Step S1.1: Pre-set the grid resolution; divide the watershed into multiple grid cells according to the grid resolution;

[0011] Step S1.2: Decompose each hydraulic entity into spatial elements; wherein, the spatial elements include point elements, line elements, and surface elements;

[0012] Step S1.3: Determine the correspondence between each spatial feature and the grid cells it covers, thereby creating a table showing the relationship between spatial feature IDs and the grid cell IDs they cover;

[0013] in:

[0014] For the point feature, the corresponding grid cell is determined directly based on the point coordinates of the point feature;

[0015] For the line element, each grid cell it passes through is the grid cell it covers;

[0016] For the surface feature, directly determine the grid cells it covers;

[0017] Step S1.4: Based on the relationship table between spatial element ID and the ID of the grid cell it covers, determine the index parameters, and then establish a spatial element index library for watershed water conservancy entities.

[0018] Preferably, step S2 specifically includes:

[0019] Step S2.1: Suppose there are t hydraulic entities in the watershed; for hydraulic entity i, i = 1, 2, ..., t, determine its original feature vector X based on its spatial elements. i :

[0020] X i =[w i1 x i1 ,w i2 x i2 ,...,w in x in (1)

[0021] Where: x ij w represents the j-th characteristic value of hydraulic entity i, where j = 1, 2, ..., n, and n is the number of characteristic values ​​for each hydraulic entity; ij The weight of the j-th feature value of water conservancy entity i satisfies

[0022] Step S2.2, using formula (2), the original feature vector X of hydraulic entity i is... i Regularization is performed to obtain the regularized feature vector of hydraulic entity i.

[0023]

[0024] Where: ||X i ||2 represents the original feature vector X of water conservancy entity i. i The L2 norm;

[0025] Step S2.3: Based on the regularized feature vectors of each hydraulic entity i within the watershed. Clustering of water conservancy entities within the basin.

[0026] Preferably, step S2.3 specifically includes:

[0027] Step S2.3.1: Determine the final number of clusters K;

[0028] Step S2.3.2: Initialize and determine K cluster centers, namely: cluster centers c1, c2, ..., c K ;

[0029] According to the probabilistic selection algorithm, among t water conservancy entities, K water conservancy entities are initially selected as cluster centers;

[0030] Step S2.3.3: For each hydraulic entity i, calculate its relationship to each cluster center c. k membership degree u ik Where k = 1, 2, ..., K;

[0031] Step S2.3.4, based on each hydraulic entity i for each cluster center c k membership degree u ik Cluster center c k Updated to cluster center

[0032] Step S2.3.5, determine whether formula (3) is satisfied:

[0033]

[0034] Where: Δ represents the change in cluster centers; ε is a preset threshold;

[0035] If formula (3) is satisfied, proceed to step S2.3.6; if formula (3) is not satisfied, return to step S2.3.2.

[0036] Step S2.3.6: Using formula (4), calculate the mean profile coefficient S of all hydraulic entities:

[0037]

[0038] Where: s i Represents the profile coefficient of hydraulic entity i;

[0039] Step S2.3.7: Evaluate the clustering effect using the mean silhouette coefficient S; if the evaluation result does not meet the requirements, return to step S2.3.2, or adjust the number of clusters K and then return to step S2.3.2; if the evaluation result meets the requirements, proceed to step S2.3.8.

[0040] Step S2.3.8: Using formula (5), obtain the clustering label y for each water conservancy entity i. i :

[0041]

[0042] Step S2.3.9: Establish the clustering label index for water conservancy entities as shown in formula (6):

[0043] L(k)={i|y i =k,i∈{1,2,...,t}} (6)

[0044] Where: L(k) represents each cluster center The corresponding set of indexes for cluster categories.

[0045] Preferably, step S2.3.2 specifically includes:

[0046] Step A1: Randomly select one of the t water conservancy entities as the cluster center c1.

[0047] Step A2: Set the variable L to represent the number of selected cluster centers, where 1 ≤ L < K;

[0048] Step A3: Initialize the value of variable L to 1;

[0049] Step A4: The tL water conservancy entities that have not yet been selected as cluster centers are referred to as the water conservancy entity set H; the selection probability of each water conservancy entity h in the water conservancy entity set H is determined using formula (7).

[0050]

[0051] Where: D h The shortest distance from hydraulic entity h in the set of hydraulic entities H to each currently selected cluster center is determined by formula (8):

[0052]

[0053] Where: c l This represents the l-th cluster center among the currently selected cluster centers;

[0054] The regularized feature vector representing hydraulic entity i and cluster center c l The square of the vector difference after Euclidean norm calculation;

[0055] Step A5: According to the selection probability of each hydraulic entity h in the set of hydraulic entities H Select a water conservancy entity as the cluster center;

[0056] Step A6: Determine if variable L is equal to K. If it is, proceed to step A7; otherwise, set variable L = L + 1; update the hydraulic entity set H, and return to step A4.

[0057] Step A7: K cluster centers have now been determined. This step is now complete.

[0058] Preferably, step S2.3.3 specifically includes:

[0059] Step B1: Using formula (9), calculate the distance from hydraulic entity i to cluster center c. k Distance D ik :

[0060]

[0061] Where: S is the covariance matrix, calculated using formula (10):

[0062]

[0063] in: Let represent the vector mean of t hydraulic entities. The superscript T indicates a change of rank;

[0064] Step B2, using formula (11), calculate the cluster centers c of hydraulic entity i. k membership degree u ik :

[0065]

[0066] Where: p is the fuzzy index; D ig This represents the relationship between water conservancy entity i and cluster center c. g The distance between the hydraulic entity i and each cluster center c; g = 1, 2, ..., K; k The membership degree satisfies the formula:

[0067] Preferably, step S2.3.4 specifically includes:

[0068] Using formula (12), based on each hydraulic entity i and each cluster center c k membership degree u ik Cluster center c k Updated to cluster center

[0069]

[0070] Where p is the fuzzy index.

[0071] Preferably, step S2.3.4 specifically includes:

[0072] Using formula (13), based on each hydraulic entity i and each cluster center c k membership degree u ik Cluster center c k Updated to cluster center

[0073]

[0074] Where: η is the step size, which controls the magnitude of each update; S is the covariance matrix.

[0075] Preferably, the contour coefficient si of hydraulic entity i is obtained by using formula (14):

[0076]

[0077] Where: a i It is the average distance from hydraulic entity i to other hydraulic entities in the same cluster, calculated using formula (15):

[0078]

[0079] in: This represents the set of samples in the cluster category to which water conservancy entity i belongs. Represents the sample set C yi The regularized feature vectors of all water conservancy entities u except for water conservancy entity i; |C yi | indicates the number of samples in the cluster category to which water conservancy entity i belongs;

[0080] b i It is the average distance from water conservancy entity i to all water conservancy entities in the nearest other cluster categories, calculated by formula (16):

[0081]

[0082] Where: C v Let |C| represent the set of samples from the nearest other cluster categories of water conservancy entity i. v | Represents the sample set C v The number of samples in the sample; Represents the sample set C v The regularized eigenvectors of each water conservancy entity v; v≠y i Representative sample set C v The clustering label is not the clustering label y i .

[0083] Preferably, step S3 specifically includes:

[0084] Step S3.1, Request parsing and data preparation:

[0085] The client receives a tile rendering request and parses the required tile size and geographic range.

[0086] Based on the spatial element index of watershed water conservancy entities and the clustering label index of watershed water conservancy entities, retrieve vector data that accurately matches the geographical range;

[0087] The vector data is initially processed according to the defined slicing rules, including coordinate transformation and data filtering, to obtain the processed vector data;

[0088] Step S3.2, Data Processing and Slice Generation:

[0089] The processed vector data is edited and simplified, and then converted into a vector slice format to obtain vector slice data;

[0090] Step S3.3, Client Operations and Request Transmission:

[0091] The user-selected theme and rendering range are encapsulated into request parameters. The request parameters and the vector tile data obtained in step S3.2 are combined to obtain a tile containing the request parameters. Both the request parameters and the tile containing the request parameters are sent to the server.

[0092] Step S3.4, Slice Request and Response:

[0093] The server receives the request parameters and searches a pre-built style file library based on the request parameters. It then searches the style file library for a theme that matches the user's request and the corresponding style file. The style file library stores adaptive style files for different themes.

[0094] Step S3.5, Rendering Engine and Adaptive Performance:

[0095] The server processes the slice containing the request parameters to obtain the vector slice data, and associates the vector slice data with the matched style file;

[0096] The map rendering engine is started on the client or server, and the rendering rules in the style file are applied to render the vector tile data to generate the final map image.

[0097] The present invention provides a method for indexing and efficiently rendering spatial features of hydraulic entities based on machine learning and WebGL, which has the following advantages:

[0098] (1) A clustering algorithm for water conservancy entities is provided, which can quickly cluster water conservancy entities based on spatial elements, avoid clustering from getting trapped in local optima, and improve the accuracy and physical meaning of clustering analysis.

[0099] (2) The established spatial element index library and cluster label index library of water conservancy entities in the basin can efficiently realize visualization, spatial aggregation and classification retrieval in GIS platforms, databases or application systems.

[0100] (3) A rendering method for water conservancy entities within a watershed is provided to achieve efficient rendering. Attached Figure Description

[0101] Figure 1 The flowchart provided by this invention illustrates the process of establishing a watershed water conservancy entity clustering tag index library.

[0102] Figure 2 A schematic diagram showing the spatial elements provided by this invention each assigned a grid cell;

[0103] Figure 3 The principle diagram of index library optimization provided by this invention;

[0104] Figure 4 This is a flowchart for rendering water conservancy entities within a watershed, provided by the present invention. Detailed Implementation

[0105] To make the technical problems solved, the technical solutions, and the beneficial effects of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the invention.

[0106] This invention provides a method for indexing and rendering spatial elements of water conservancy entities based on machine learning and WebGL. This method enriches the evaluation and clustering methods for water conservancy entities and extends to the field of Web-based rendering technology. This invention plays an important role in the management and function invocation of water conservancy entities.

[0107] This invention provides a method for indexing and efficiently rendering spatial features of hydraulic entities based on machine learning and WebGL, comprising the following steps:

[0108] Step S1: Decompose each water conservancy entity within the basin into spatial elements and establish a spatial element index library for water conservancy entities in the basin.

[0109] Step S2: Based on the spatial elements of each water conservancy entity within the basin, establish the feature vector of each water conservancy entity; based on the feature vector of each water conservancy entity, cluster each water conservancy entity within the basin to obtain the clustering label of each water conservancy entity, and establish a water conservancy entity clustering label index library.

[0110] Step S3: Render the water conservancy entities within the watershed according to the spatial element index library of watershed water conservancy entities and the clustering tag index library of watershed water conservancy entities.

[0111] The following is a detailed description of steps S1 to S3:

[0112] Step S1: Decompose each water conservancy entity within the basin into spatial elements and establish a spatial element index library for water conservancy entities in the basin.

[0113] Step S1 is as follows:

[0114] Step S1.1: Pre-set the grid resolution; divide the watershed into multiple grid cells according to the grid resolution;

[0115] Step S1.2: Decompose each hydraulic entity into spatial elements; wherein, the spatial elements include point elements, line elements, and surface elements;

[0116] Step S1.3: Determine the correspondence between each spatial feature and the grid cells it covers, thereby creating a table showing the relationship between spatial feature IDs and the IDs of the grid cells they cover; for example... Figure 2 The diagram shown illustrates how spatial elements are assigned grid cells.

[0117] in:

[0118] For the point feature, the corresponding grid cell is determined directly based on the point coordinates of the point feature;

[0119] For the line element, each grid cell it passes through is the grid cell it covers;

[0120] For the surface feature, directly determine the grid cells it covers;

[0121] Step S1.4: Based on the relationship table between spatial element ID and the ID of the grid cell it covers, determine the index parameters, and then establish a spatial element index library for watershed water conservancy entities.

[0122] This step can be implemented using the following steps:

[0123] Step (1) Determine the spatial extent and grid resolution:

[0124] Select the spatial range (total number of grids) to be indexed, such as a specific watershed, administrative region, or national scope;

[0125] Determine the grid resolution to be indexed; the higher the resolution, the smaller the grid cells.

[0126] Step (2) Divide the grid into regular grid cells according to the determined spatial range and grid resolution.

[0127] Step (3) Assign spatial features to grid cells:

[0128] Point features can be directly determined to be located in the grid cell based on their point coordinates;

[0129] Line features can identify all grid cells that a line segment passes through and establish a relationship between it and all related grid cells.

[0130] A surface feature can be identified by marking the mesh cells it covers as containing the surface feature.

[0131] Create a relational table in the database to record the relationship between spatial feature IDs and grid cell IDs to support subsequent queries and spatial analysis.

[0132] Step (4) Construct range query and proximity query functions based on spatial index:

[0133] Choose a database that supports spatial data indexing (such as PostGIS, MongoDB);

[0134] Create spatial indexes on the grid cell table and spatial feature table to support fast range queries and proximity queries;

[0135] Adjust index parameters (such as index depth, block size, etc.) based on data volume and query requirements to improve query performance.

[0136] Step S2: Based on the spatial elements of each water conservancy entity within the basin, establish the feature vector for each water conservancy entity; based on the feature vector of each water conservancy entity, cluster the various water conservancy entities within the basin to obtain the clustering label for each water conservancy entity, and establish a watershed water conservancy entity clustering label index library; such as Figure 1 The diagram shows a flowchart for establishing a watershed water conservancy entity clustering label index library.

[0137] Step S2 is as follows:

[0138] Step S2.1: Suppose there are t hydraulic entities in the watershed; for hydraulic entity i, i = 1, 2, ..., t, determine its original feature vector X based on its spatial elements. i :

[0139] X i =[w i1 x i1 ,w i2 x i2 ,...,w in x in (1)

[0140] Where: x ijw represents the j-th characteristic value of hydraulic entity i, where j = 1, 2, ..., n, and n is the number of characteristic values ​​for each hydraulic entity; ij The weight of the j-th feature value of water conservancy entity i satisfies

[0141] Specifically, based on the characteristics of the water conservancy entity, its characteristic values ​​are determined:

[0142] For water conservancy entities that encompass only a single spatial element, such as hydrological stations and rain gauges—point entities with clearly defined locations—their spatial characteristics are reflected only as point elements. In this case, the spatial attributes of this point element can be directly selected as feature values ​​without the need for additional weight allocation.

[0143] For complex water conservancy entities encompassing multiple spatial elements, such as reservoir systems, river networks, and irrigation districts, their spatial representation may simultaneously include various elements such as points, lines, and areas. In this case, corresponding weights w should be assigned based on the spatial proportion or importance of each element within the entity. For example, if area elements (such as rivers or reservoirs) occupy the main spatial area or play a dominant functional role in a water conservancy entity, then area elements should be given higher weights.

[0144] Step S2.2, using formula (2), the original feature vector X of hydraulic entity i is... i Regularization is performed to obtain the regularized feature vector of hydraulic entity i.

[0145]

[0146] Where: ||X i ||2 represents the original feature vector X of water conservancy entity i. i The L2 norm;

[0147] Regularization can prevent certain feature values ​​from being too large or too small from having an adverse effect on the clustering results.

[0148] Through the above weighting and regularization processes, the heterogeneous spatial information of various water conservancy entities can be unified into a standard feature vector that is comparable and computationally friendly, thereby improving the accuracy and physical meaning of subsequent cluster analysis.

[0149] Step S2.3: Based on the regularized feature vectors of each hydraulic entity i within the watershed. Clustering of water conservancy entities within the basin.

[0150] Step S2.3 specifically includes:

[0151] Step S2.3.1: Determine the final number of clusters K;

[0152] Step S2.3.2: Initialize and determine K cluster centers, namely: cluster centers c1, c2, ..., c K ;

[0153] According to the probabilistic selection algorithm, among t water conservancy entities, K water conservancy entities are initially selected as cluster centers;

[0154] Step S2.3.2 specifically includes:

[0155] Step A1: Randomly select one of the t water conservancy entities as the cluster center c1.

[0156] Step A2: Set the variable L to represent the number of selected cluster centers, where 1 ≤ L < K;

[0157] Step A3: Initialize the value of variable L to 1;

[0158] Step A4: The tL water conservancy entities that have not yet been selected as cluster centers are referred to as the water conservancy entity set H; the selection probability of each water conservancy entity h in the water conservancy entity set H is determined using formula (7).

[0159]

[0160] Where: D h The shortest distance from hydraulic entity h in the set of hydraulic entities H to each currently selected cluster center is determined by formula (8):

[0161]

[0162] Where: c l This represents the l-th cluster center among the currently selected cluster centers;

[0163] The regularized feature vector representing hydraulic entity i and cluster center c l The square of the vector difference after Euclidean norm calculation;

[0164] Step A5: According to the selection probability of each hydraulic entity h in the set of hydraulic entities H Select a water conservancy entity as the cluster center;

[0165] Step A6: Determine if variable L is equal to K. If it is, proceed to step A7; otherwise, set variable L = L + 1; update the hydraulic entity set H, and return to step A4.

[0166] Step A7: K cluster centers have now been determined. This step is now complete.

[0167] Using the probabilistic selection algorithm in this step to initialize and determine K cluster centers can ensure the diversity and representativeness of the initial cluster centers and avoid the clusters from getting trapped in local optima.

[0168] Step S2.3.3: For each hydraulic entity i, calculate its relationship to each cluster center c. k membership degree u ik Where k = 1, 2, ..., K;

[0169] Step S2.3.3 specifically refers to:

[0170] Step B1: Using formula (9), calculate the distance from hydraulic entity i to cluster center c. k Distance D ik :

[0171]

[0172] Where: S is the covariance matrix, calculated using formula (10):

[0173]

[0174] in: Let represent the vector mean of t hydraulic entities. The superscript T indicates a change of rank;

[0175] Step B2, using formula (11), calculate the cluster centers c of hydraulic entity i. k membership degree u ik :

[0176]

[0177] Where: p is the fuzzy index, typically taken as 2; D ig This represents the relationship between water conservancy entity i and cluster center c. g The distance between the hydraulic entity i and each cluster center c; g = 1, 2, ..., K; k The membership degree satisfies the formula:

[0178] Step S2.3.4, based on each hydraulic entity i for each cluster center c k membership degree u ik Cluster center c k Updated to cluster center

[0179] This invention provides two methods for updating cluster centers:

[0180] The first type:

[0181] Using formula (12), based on each hydraulic entity i and each cluster center ck membership degree u ik Cluster center c k Updated to cluster center

[0182]

[0183] Where p is the fuzzy index.

[0184] The second type:

[0185] Using formula (13), based on each hydraulic entity i and each cluster center c k membership degree u ik Cluster center c k Updated to cluster center

[0186]

[0187] Where: η is the step size, which controls the magnitude of each update; S is the covariance matrix.

[0188] Step S2.3.5, determine whether formula (3) is satisfied:

[0189]

[0190] Where: Δ represents the change in cluster centers; ε is a preset threshold;

[0191] If formula (3) is satisfied, proceed to step S2.3.6; if formula (3) is not satisfied, return to step S2.3.2.

[0192] Step S2.3.6: Using formula (4), calculate the mean profile coefficient S of all hydraulic entities:

[0193]

[0194] Where: s i The profile coefficient of hydraulic entity i is represented by formula (14).

[0195]

[0196] Where: a i It is the average distance from hydraulic entity i to other hydraulic entities in the same cluster, calculated using formula (15):

[0197]

[0198] in: This represents the set of samples in the cluster category to which water conservancy entity i belongs. Represents the sample set Cyi The regularized feature vectors of all water conservancy entities u except for water conservancy entity i; |C yi | indicates the number of samples in the cluster category to which water conservancy entity i belongs;

[0199] b i It is the average distance from water conservancy entity i to all water conservancy entities in the nearest other cluster categories, calculated by formula (16):

[0200]

[0201] Where: C v Let |C| represent the set of samples from the nearest other cluster categories of water conservancy entity i. v | Represents the sample set C v The number of samples in the sample; Represents the sample set C v The regularized eigenvectors of each water conservancy entity v; v≠y i Representative sample set C v The clustering label is not the clustering label y i .

[0202] Step S2.3.7: Evaluate the clustering effect using the mean silhouette coefficient S; if the evaluation result does not meet the requirements, return to step S2.3.2, or adjust the number of clusters K and then return to step S2.3.2; if the evaluation result meets the requirements, proceed to step S2.3.8.

[0203] In practical applications, the following table can be used to evaluate cluster quality:

[0204]

[0205] Step S2.3.8: Using formula (5), obtain the clustering label y for each water conservancy entity i. i :

[0206]

[0207] Clustering labels for each water conservancy entity y i The (category ID) is stored in the index as the attribute information of the water conservancy entity. This step helps to establish a unified three-element index structure of "attribute-space-category", which facilitates subsequent visualization, spatial aggregation and classification retrieval in GIS platforms, databases or application systems.

[0208] Step S2.3.9: Establish the clustering label index for water conservancy entities as shown in formula (6):

[0209] L(k)={i|y i=k,i∈{1,2,...,t}} (6)

[0210] Where: L(k) represents each cluster center The corresponding set of indexes for cluster categories.

[0211] In practical applications, after the index is built, it can be optimized, such as... Figure 3 The diagram illustrates the principles of index database optimization. Large areas are indexed using multi-level grids, improving query efficiency by progressively narrowing the query scope. Static data is compressed or stored in layers to reduce storage space. Frequently accessed grid or spatial feature data is cached in memory to reduce database access.

[0212] Multiple query interfaces can be developed, enabling application systems to efficiently access spatial feature data, such as grid cell query, proximity query, range query, and multi-condition query.

[0213] Step S3: Render the water conservancy entities within the watershed according to the spatial element index library of watershed water conservancy entities and the clustering tag index library of watershed water conservancy entities.

[0214] like Figure 4 The diagram shown is a flowchart for rendering water conservancy entities within a watershed.

[0215] Step S3 is as follows:

[0216] Step S3.1, Request parsing and data preparation:

[0217] The client receives a tile rendering request and parses the required tile size and geographic range.

[0218] Based on the spatial element index of watershed water conservancy entities and the clustering label index of watershed water conservancy entities, retrieve vector data that accurately matches the geographical range;

[0219] The vector data is initially processed according to the defined slicing rules, including coordinate transformation and data filtering, to obtain the processed vector data;

[0220] Step S3.2, Data Processing and Slice Generation:

[0221] The processed vector data is edited and simplified, and then converted into a vector slice format to obtain vector slice data;

[0222] Step S3.3, Client Operations and Request Transmission:

[0223] The user-selected theme and rendering range are encapsulated into request parameters. The request parameters and the vector tile data obtained in step S3.2 are combined to obtain a tile containing the request parameters. Both the request parameters and the tile containing the request parameters are sent to the server.

[0224] Step S3.4, Slice Request and Response:

[0225] The server receives the request parameters and searches a pre-built style file library based on the request parameters. It then searches the style file library for a theme that matches the user's request and the corresponding style file. The style file library stores adaptive style files for different themes.

[0226] Step S3.5, Rendering Engine and Adaptive Performance:

[0227] The server processes the slice containing the request parameters to obtain the vector slice data, and associates the vector slice data with the matched style file;

[0228] The map rendering engine is started on the client or server, and the rendering rules in the style file are applied to render the vector tile data to generate the final map image.

[0229] By using WebGL adaptive rendering technology, we can ensure that the map maintains the best display effect on different devices and screen sizes.

[0230] Furthermore, research could include automating thematic map generation based on Mapbox GLJS technology.

[0231] Step 1: Define the thematic map configuration and data source:

[0232] In Mapbox Studio, create or edit Mapbox GL JSON style files for each theme to define the visual style, layer order, and interactive properties of the thematic map;

[0233] Specify the URL of the external data source in the Mapbox style file. This data source should contain the data required for the thematic map.

[0234] Add a vector data layer to the Mapbox style file and set the corresponding fields as the basis for data-driven rendering.

[0235] Step 2: Data-driven style

[0236] Based on the requirements of the thematic maps, the Mapbox Style Language (MSL) is used to define data-driven style rules;

[0237] Different data values ​​can be displayed using different visual attributes such as colors, symbols, or sizes to achieve thematic presentation.

[0238] Step 3: Automated generation of thematic maps:

[0239] An automation script was written using Node.js that can parse templated Mapbox style files and populate them with specific data source URLs and style configurations.

[0240] Integrate the parameterized settings of the theme into the automation script, such as different theme colors and interactive effects.

[0241] Step 4: Deploy the thematic map generation service:

[0242] Create a web service interface, through which clients can pass in the topic and parameters to request the generation of the corresponding thematic map;

[0243] Deploy the automation script to the server and ensure it can receive requests and generate thematic maps.

[0244] Step 5: Client Interaction and Query

[0245] Provide client-side interaction through the web interface, allowing clients to select the thematic map's theme and parameters;

[0246] The client's selection is sent to the server via a web service interface, triggering the automated generation process of thematic maps.

[0247] Step 6: Result Return and Display

[0248] After the server generates the thematic map, it returns it to the client as a response.

[0249] The client displays the generated thematic map on a webpage based on the returned thematic map data.

[0250] Taking a water conservancy object in a certain area as an example, this invention demonstrates the specific steps of a method for indexing and efficiently rendering spatial features of water conservancy entities based on machine learning and WebGL:

[0251] Step 1: Divide the area into regular grid cells based on the spatial range and grid resolution. Establish a spatial index by associating point, line, and surface spatial elements with grid cells. Then, perform range queries, proximity queries, and high-progress index queries for spatial elements.

[0252] Step 2: Based on the above steps, the required tile size and geographical range are parsed and retrieved. According to the user's selected theme and rendering range, the corresponding tile style is matched in the style file library. The final map image is generated on different devices and screen sizes using WebGL adaptive rendering technology.

[0253] Step 3: If there is a need to generate thematic maps, you can define thematic map configuration and data source. Based on different data values, apply different visualization attributes such as colors, symbols, or sizes to achieve thematic display and automatically generate thematic maps.

[0254] This invention provides a method for indexing and efficiently rendering spatial elements of hydraulic entities based on machine learning and WebGL, which has the following advantages:

[0255] (1) A clustering algorithm for water conservancy entities is provided, which can quickly cluster water conservancy entities based on spatial elements, avoid clustering from getting trapped in local optima, and improve the accuracy and physical meaning of clustering analysis.

[0256] (2) The established spatial element index library and cluster label index library of water conservancy entities in the basin can efficiently realize visualization, spatial aggregation and classification retrieval in GIS platforms, databases or application systems.

[0257] (3) A rendering method for water conservancy entities within a watershed is provided to achieve efficient rendering.

[0258] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for indexing and efficiently rendering spatial elements of hydraulic entities based on machine learning and WebGL, characterized in that, Includes the following steps: Step S1: Decompose each water conservancy entity within the basin into spatial elements and establish a spatial element index library for water conservancy entities in the basin. Step S1 is as follows: Step S1.1: Pre-set the grid resolution; divide the watershed into multiple grid cells according to the grid resolution; Step S1.2: Decompose each hydraulic entity into spatial elements; wherein, the spatial elements include point elements, line elements, and surface elements; Step S1.3: Determine the correspondence between each spatial feature and the grid cells it covers, thereby creating a table showing the relationship between spatial feature IDs and the grid cell IDs they cover; in: For the point feature, the corresponding grid cell is determined directly based on the point coordinates of the point feature; For the line element, each grid cell it passes through is the grid cell it covers; For the surface feature, directly determine the grid cells it covers; Step S1.4: Based on the relationship table between spatial element IDs and the grid cell IDs they cover, determine the index parameters and then establish a watershed water conservancy entity spatial element index database; adjust the index parameters according to the data volume and query requirements. After establishing the index, optimize the index, including: using multi-level grids for indexing large areas; using data compression or hierarchical storage for static data; and caching frequently accessed grid or spatial feature data in memory. Step S2: Based on the spatial elements of each water conservancy entity within the basin, establish the feature vector of each water conservancy entity; based on the feature vector of each water conservancy entity, cluster each water conservancy entity within the basin to obtain the clustering label of each water conservancy entity, and establish a water conservancy entity clustering label index library. Step S3: Render the water conservancy entities within the watershed according to the spatial element index library of watershed water conservancy entities and the clustering tag index library of watershed water conservancy entities.

2. The method for indexing and efficiently rendering spatial elements of hydraulic entities based on machine learning and WebGL according to claim 1, characterized in that, Step S2 is as follows: Step S2.1, assuming the watershed has Individual water conservancy entities; for water conservancy entities , Based on its spatial elements, determine its original feature vector. : (1) in: Indicates water conservancy entities The 1 eigenvalue, , The number of characteristic values ​​for each hydraulic entity; Indicates water conservancy entities The The weights of the eigenvalues ​​satisfy the following condition: ; Step S2.2, using formula (2), for the hydraulic entity The original feature vector Regularization is performed to obtain the water conservancy entity. The regularized feature vector : (2) in: Indicates water conservancy entities The original feature vector The L2 norm; Step S2.3, based on the various water conservancy entities within the basin The regularized feature vector Clustering of water conservancy entities within the basin.

3. The method for indexing and efficiently rendering spatial elements of hydraulic entities based on machine learning and WebGL according to claim 2, characterized in that, Step S2.3 specifically includes: Step S2.3.1: Determine the final number of clusters required. ; Step S2.3.2, Initialization Determination There are 1 cluster center, namely: cluster center ; According to the probabilistic selection algorithm, in In each water conservancy entity, initial selection Each water conservancy entity serves as a cluster center. Step S2.3.3, for each hydraulic entity Calculate its value for each cluster center membership degree ,in, ; Step S2.3.4, based on each hydraulic entity For each cluster center membership degree Cluster center Updated to cluster center ; Step S2.3.5, determine whether formula (3) is satisfied: (3) in: Represents the change in cluster centers; The preset threshold; If formula (3) is satisfied, proceed to step S2.3.6; if formula (3) is not satisfied, return to step S2.3.

2. Step S2.3.6: Using formula (4), calculate the average profile coefficient of all hydraulic entities. : (4) in: Indicates water conservancy entities The profile coefficient; Step S2.3.7, using the mean of the profile coefficients The clustering effect is evaluated; if the evaluation result does not meet the requirements, return to step S2.3.2, or adjust the number of clusters. Then return to step S2.3.2; if the evaluation result meets the requirements, then proceed to step S2.3.8; Step S2.3.8: Using formula (5), obtain the results for each hydraulic entity. Clustering tags : (5) Step S2.3.9: Establish the clustering label index for water conservancy entities as shown in formula (6): (6) in: Representing each cluster center The corresponding set of indexes for cluster categories.

4. The method for indexing and efficiently rendering spatial elements of hydraulic entities based on machine learning and WebGL according to claim 3, characterized in that, Step S2.3.2 specifically includes: Step A1, in Among the water conservancy entities, one water conservancy entity is randomly selected as the cluster center. ; Step A2: Set the variable for the number of selected cluster centers. , ; Step A3, let the variable The initial value is 1; Step A4: Select cluster centers that are not currently selected. A collection of water conservancy entities is called a set of water conservancy entities. ; Formula (7) is used to determine the set of hydraulic entities. Various water conservancy entities in China Selection probability : (7) in: Representative of the set of water conservancy entities Water conservancy entities in China The shortest distance to each of the currently selected cluster centers is determined by formula (8): (8) in: Represents the first selected cluster center. Cluster centers; Representing water conservancy entities The regularized feature vector and cluster center The square of the vector difference after Euclidean norm calculation; Step A5, according to the set of water conservancy entities Various water conservancy entities in China Selection probability Choose a water conservancy entity as the cluster center; Step A6, determine the variables Is it equal to If they are equal, proceed to step A7; otherwise, set the variable... Update the set of water conservancy entities. Return to step A4; Step A7, initialization confirmed. This step concludes with the identification of cluster centers.

5. The method for indexing and efficiently rendering spatial elements of hydraulic entities based on machine learning and WebGL according to claim 3, characterized in that, Step S2.3.3 specifically refers to: Step B1: Using formula (9), the hydraulic entity is calculated. To the cluster center distance : (9) in: It is the covariance matrix, calculated using formula (10): (10) in: represent The vector mean of each water conservancy entity. ; superscript Represents a change of order; Step B2, using formula (11), calculate the hydraulic entity. Cluster centers membership degree : (11) in: It is a fuzzy index; Indicates water conservancy entities To the cluster center The distance; Water conservancy entities For each cluster center The membership degree satisfies the formula: .

6. The method for indexing and efficiently rendering spatial elements of hydraulic entities based on machine learning and WebGL according to claim 5, characterized in that, Step S2.3.4 specifically includes: Using formula (12), based on each hydraulic entity For each cluster center membership degree Cluster center Updated to cluster center : (12) in: It is a fuzzy index.

7. The method for indexing and efficiently rendering spatial elements of hydraulic entities based on machine learning and WebGL according to claim 5, characterized in that, Step S2.3.4 specifically includes: Using formula (13), based on each hydraulic entity For each cluster center membership degree Cluster center Updated to cluster center : (13) in: The step size controls the magnitude of each update. It is the covariance matrix.

8. The method for indexing and efficiently rendering spatial elements of hydraulic entities based on machine learning and WebGL according to claim 3, characterized in that, Using formula (14), the hydraulic entity is obtained. contour coefficient : (14) in: It is a water conservancy entity The average distance to other hydraulic entities in the same cluster is calculated using formula (15): (15) in: Indicates water conservancy entities The sample set in the corresponding cluster category Represents the sample set Except for water conservancy entities Other water conservancy entities The regularized feature vector; Indicates water conservancy entities The number of samples in the cluster category; It is a water conservancy entity The average distance to each hydraulic entity in the nearest other cluster category is calculated using formula (16): (16) in: Indicates water conservancy entities The set of samples from the most recent other cluster categories, Representative sample set The number of samples in the sample; Represents the sample set Various water conservancy entities in China The regularized feature vector; Representative sample set The clustering label is not a clustering label. .

9. The method for indexing and efficiently rendering spatial elements of hydraulic entities based on machine learning and WebGL according to claim 1, characterized in that, Step S3 is as follows: Step S3.1, Request parsing and data preparation: The client receives a tile rendering request and parses the required tile size and geographic range. Based on the spatial element index of watershed water conservancy entities and the clustering label index of watershed water conservancy entities, retrieve vector data that accurately matches the geographical range; The vector data is initially processed according to the defined slicing rules, including coordinate transformation and data filtering, to obtain the processed vector data; Step S3.2, Data Processing and Slice Generation: The processed vector data is edited and simplified, and then converted into a vector slice format to obtain vector slice data; Step S3.3, Client Operations and Request Transmission: The user-selected theme and rendering range are encapsulated into request parameters. The request parameters and the vector tile data obtained in step S3.2 are combined to obtain a tile containing the request parameters. Both the request parameters and the tile containing the request parameters are sent to the server. Step S3.4, Slice Request and Response: The server receives the request parameters and searches a pre-built style file library based on the request parameters. It then searches the style file library for a theme that matches the user's request and the corresponding style file. The style file library stores adaptive style files for different themes. Step S3.5, Rendering Engine and Adaptive Performance: The server processes the slice containing the request parameters to obtain the vector slice data, and associates the vector slice data with the matched style file; The map rendering engine is started on the client or server, and the rendering rules in the style file are applied to render the vector tile data to generate the final map image.

Citation Information

Patent Citations

  • Vector data space indexing method base on hbase and geohash

    CN104199986A

  • Natural resource data index statistical method and system based on geographic multilevel grid

    CN113010620A