Water conservancy entity space element indexing and efficient rendering method based on machine learning and WebGL
Through machine learning and WebGL technology, spatial element indexing and cluster label indexing of water conservancy entities in the basin is solved, and efficient water conservancy entities management and function calls are achieved.
Patent Information
- Application Number
- CN202510446094.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-04-10
AI Technical Summary
The number of water conservancy entities in the basin is wide, widely distributed and complex, resulting in low screening efficiency and rendering efficiency cannot meet the usage needs.
Using machine learning and WebGL technology, by decomposing water conservancy entities in the basin into spatial elements, establishing a spatial element index library and a cluster label index library, achieving rapid spatial clustering and efficient rendering.
The screening and rendering efficiency of water conservancy entities has been improved, and visual expression and classification retrieval are realized in GIS platforms, databases or application systems.
Smart Images

Figure CN120448606A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of water conservancy geographic information technology and information retrieval technology, and specifically relates to a water conservancy entity spatial element indexing and efficient rendering method based on machine learning and WebGL. Background Art
[0002] The water conservancy entities in the basin are characterized by large number, wide distribution and complex functions. When carrying out the joint calling of water conservancy entities in the basin around themes such as flood control, scheduling, drainage, and irrigation, it is impossible to efficiently screen out water conservancy entities that meet the requirements of relevant query functions, resulting in low water conservancy entity screening efficiency; in addition, when rendering various water conservancy entities in the basin, the rendering efficiency cannot meet the usage requirements. Summary of the Invention
[0003] In response to the defects of the existing technology, the present invention provides a water conservancy entity spatial element indexing and efficient rendering method based on machine learning and WebGL, which can effectively solve the above problems.
[0004] The technical solution adopted in the present invention is as follows:
[0005] The present invention provides a method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL, comprising the following steps:
[0006] Step S1, decomposing each water conservancy entity in the basin into spatial elements, and establishing a water conservancy entity spatial element index database;
[0007] Step S2: establishing a feature vector for each water conservancy entity based on the spatial elements of each water conservancy entity in the watershed; clustering each water conservancy entity in the watershed based on the feature vector of each water conservancy entity to obtain a cluster label for each water conservancy entity, and establishing a watershed water conservancy entity cluster label index library;
[0008] Step S3: Rendering the water conservancy entities in the watershed according to the watershed water conservancy entity spatial element index library and the watershed water conservancy entity cluster label index library.
[0009] Preferably, step S1 is specifically as follows:
[0010] Step S1.1, presetting a grid resolution; dividing the watershed into a plurality of grid cells according to the grid resolution;
[0011] Step S1.2, decomposing each water conservancy entity into spatial elements; wherein the spatial elements include point elements, line elements and surface elements;
[0012] Step S1.3, determining the correspondence between each spatial element and the grid cell it covers, thereby creating a relationship table between the spatial element ID and the grid cell ID it covers;
[0013] in:
[0014] For the point element, directly determining the corresponding grid unit according to the point coordinates of the point element;
[0015] For the line element, each grid cell it passes through is the grid cell it covers;
[0016] For the area element, directly determine the grid cells it covers;
[0017] Step S1.4, determine the index parameters based on the relationship table between the spatial element ID and the grid unit ID it covers, and then establish the basin water conservancy entity spatial element index library.
[0018] Preferably, step S2 is specifically as follows:
[0019] Step S2.1: Assume that there are t water conservancy entities in the basin; for water conservancy entity i, i = 1, 2, ..., t, determine its original eigenvector X according to its spatial elements. i :
[0020] X i =[w i1 x i1 ,w i2 x i2 ,...,w in x in ] (1)
[0021] Where: x ij represents the jth eigenvalue of water conservancy entity i, j = 1, 2, ..., n, n is the number of eigenvalues of each water conservancy entity; w ij Represents the weight of the j-th eigenvalue of water conservancy entity i, satisfying
[0022] Step S2.2: Using formula (2), the original feature vector X of water conservancy entity i is i Perform regularization processing to obtain the regularized feature vector of water conservancy entity i
[0023]
[0024] Where: ||X i ||2 represents the original feature vector X of water conservancy entity i i The L2 norm of
[0025] Step S2.3, based on the regularized feature vector of each water conservancy entity i in the basin Clustering of water conservancy entities within the basin.
[0026] Preferably, step S2.3 is specifically as follows:
[0027] Step S2.3.1, determine the final number of clusters K required;
[0028] Step S2.3.2, initialize and determine K cluster centers, namely: cluster centers c1, c2, ..., c K ;
[0029] According to the probability selection algorithm, among the t water conservancy entities, K water conservancy entities are initially selected as cluster centers;
[0030] Step S2.3.3, for each water conservancy entity i, calculate its cluster center c k The membership degree u ik , where k = 1, 2, ..., K;
[0031] Step S2.3.4, for each water conservancy entity i, each cluster center c k The membership degree u ik , the cluster center c k Update to cluster center
[0032] Step S2.3.5, determine whether formula (3) is satisfied:
[0033]
[0034] Where: Δ represents the change in cluster center; ε is the 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] In step S2.3.6, use formula (4) to calculate the mean value S of the silhouette coefficient of all water conservancy entities:
[0037]
[0038] Where: s i represents the silhouette coefficient of hydraulic entity i;
[0039] Step S2.3.7: Evaluate the clustering effect using the silhouette coefficient mean 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, use formula (5) to obtain the cluster label y of each water conservancy entity i i :
[0041]
[0042] Step S2.3.9: Establish the water conservancy entity cluster label index shown in formula (6):
[0043] L(k)={i|y i =k,i∈{1,2,...,t}} (6)
[0044] Where: L(k) represents the cluster center The index collection of the corresponding cluster categories.
[0045] Preferably, step S2.3.2 is specifically as follows:
[0046] Step A1: randomly select a water conservancy entity from t water conservancy entities as the cluster center c1;
[0047] Step A2, set the variable L of the number of selected cluster centers, 1≤L<K;
[0048] Step A3, set the initial value of variable L to 1;
[0049] Step A4: The tL water conservancy entities that are not currently selected as cluster centers are called the water conservancy entity set H. Formula (7) is used to determine the selection probability of each water conservancy entity h in the water conservancy entity set H.
[0050]
[0051] Where: D h The shortest distance between the water conservancy entity h in the water conservancy entity set H and the currently selected cluster centers is determined by formula (8):
[0052]
[0053] Where: c l Represents the lth cluster center among the currently selected cluster centers;
[0054] Represents the regularized feature vector of water conservancy entity i and cluster center c l The vector difference of , squared after Euclidean norm calculation;
[0055] Step A5: According to the selection probability of each water conservancy entity h in the water conservancy entity set H Select a water conservancy entity as the cluster center;
[0056] Step A6, determine whether the variable L is equal to K. If so, execute step A7; if not, set the variable L=L+1; update the water conservancy entity set H, and return to step A4;
[0057] Step A7: K cluster centers are initialized and determined, and this step ends.
[0058] Preferably, step S2.3.3 is specifically as follows:
[0059] Step B1, using formula (9), calculate the distance from water conservancy entity i to cluster center c k Distance D ik :
[0060]
[0061] Where: S is the covariance matrix, calculated by formula (10):
[0062]
[0063] in: represents the vector mean of t water conservancy entities, The superscript T represents the transition rank;
[0064] Step B2: Use formula (11) to calculate the cluster center c of water conservancy entity i k The membership degree u ik :
[0065]
[0066] Where: p is the fuzzy index; D ig Represents water conservancy entity i to cluster center c g distance; g=1,2,...,K; water conservancy entity i to each cluster center c k The membership degree satisfies the formula:
[0067] Preferably, step S2.3.4 is specifically as follows:
[0068] Using formula (12), according to each water conservancy entity i, each cluster center c k The membership degree u ik , the cluster center c k Update to cluster center
[0069]
[0070] Where: p is the fuzzy index.
[0071] Preferably, step S2.3.4 is specifically as follows:
[0072] Formula (13) is used to classify each cluster center c according to each water conservancy entity i. k The membership degree u ik , the cluster center c k Update to cluster center
[0073]
[0074] Where: η is the step size, which controls the amplitude of each update; S is the covariance matrix.
[0075] Preferably, the silhouette coefficient si of the hydraulic entity i is obtained using formula (14):
[0076]
[0077] Among them: a i is the average distance from water conservancy entity i to other water conservancy entities in the same cluster, calculated by formula (15):
[0078]
[0079] in: represents the sample set in the cluster category to which water conservancy entity i belongs, Represents the sample set C yi The regularized feature vectors of other water conservancy entities u except water conservancy entity i in |C yi | represents the number of samples in the cluster category to which water conservancy entity i belongs;
[0080] b i is the average distance from water conservancy entity i to the nearest water conservancy entities in other cluster categories, calculated by formula (16):
[0081]
[0082] Where: C v represents the sample set in other cluster categories closest to water conservancy entity i, |C v | represents the sample set C v The number of samples in ; Represents the sample set C v The regularized feature vector of each water conservancy entity v in; v≠y i Representative sample set C v The cluster label of is not the cluster label y i .
[0083] Preferably, step S3 is specifically as follows:
[0084] Step S3.1, request parsing and data preparation:
[0085] The client receives the tile rendering request and parses the required tile size and geographic extent;
[0086] Retrieving vector data that accurately matches the geographic range based on the watershed water conservancy entity spatial element index library and the watershed water conservancy entity cluster label index library;
[0087] Performing preliminary processing on the vector data according to defined slicing rules, including coordinate conversion and data screening, to obtain processed vector data;
[0088] Step S3.2, data processing and slice generation:
[0089] Editing and simplifying the processed vector data, and converting it into a vector slice format to obtain vector slice data;
[0090] Step S3.3, client operation and request transmission:
[0091] Encapsulating the theme and rendering range selected by the user as request parameters, combining the request parameters with the vector slice data obtained in step S3.2 to obtain a slice containing the request parameters; and sending both the request parameters and the slice containing the request parameters 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 according to the request parameters, and searches the style file library for a theme and a corresponding style file that matches the user request; wherein 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] A 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 a final map image.
[0097] The present invention provides a method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL, which has the following advantages:
[0098] (1) A water conservancy entity clustering algorithm is provided, which can quickly perform spatial clustering of water conservancy entities based on spatial elements, avoid clustering falling into local optimality, and improve the accuracy and physical significance of clustering analysis.
[0099] (2) The established watershed water conservancy entity spatial element index library and watershed water conservancy entity cluster label index library can efficiently realize visual expression, spatial aggregation and classification retrieval in GIS platform, database or application system.
[0100] (3) Provide a rendering method for water conservancy entities within a watershed to achieve efficient rendering. BRIEF DESCRIPTION OF THE DRAWINGS
[0101] Figure 1 The flowchart of establishing a watershed water conservancy entity clustering label index library provided by the present invention;
[0102] Figure 2 A schematic diagram of the spatial elements provided by the present invention being respectively assigned to grid units;
[0103] Figure 3 Schematic diagram of index library optimization provided by the present invention;
[0104] Figure 4 This is a flowchart for rendering water conservancy entities within a watershed provided by the present invention. DETAILED DESCRIPTION
[0105] In order to make the technical problems, technical solutions and beneficial effects solved by the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0106] The present invention provides a method for indexing and efficiently rendering spatial elements of water conservancy entities based on machine learning and WebGL. This method enriches the evaluation and clustering methods of water conservancy entities and expands the field of Web-side rendering technology. This invention plays an important role in water conservancy entity management and function calling.
[0107] The present invention provides a method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL, comprising the following steps:
[0108] Step S1, decomposing each water conservancy entity in the basin into spatial elements, and establishing a water conservancy entity spatial element index database;
[0109] Step S2: establishing a feature vector for each water conservancy entity based on the spatial elements of each water conservancy entity in the watershed; clustering each water conservancy entity in the watershed based on the feature vector of each water conservancy entity to obtain a cluster label for each water conservancy entity, and establishing a watershed water conservancy entity cluster label index library;
[0110] Step S3: Rendering the water conservancy entities in the watershed according to the watershed water conservancy entity spatial element index library and the watershed water conservancy entity cluster label index library.
[0111] The following describes steps S1 to S3 in detail:
[0112] Step S1, decomposing each water conservancy entity in the basin into spatial elements, and establishing a water conservancy entity spatial element index database;
[0113] Step S1 is specifically as follows:
[0114] Step S1.1, presetting a grid resolution; dividing the watershed into a plurality of grid cells according to the grid resolution;
[0115] Step S1.2, decomposing each water conservancy entity into spatial elements; wherein the spatial elements include point elements, line elements and surface elements;
[0116] Step S1.3, determine the corresponding relationship between each spatial element and the grid unit it covers, so as to create a relationship table between the spatial element ID and the grid unit ID it covers; Figure 2 As shown in the figure, it is a schematic diagram of the spatial elements being assigned grid units.
[0117] in:
[0118] For the point element, directly determining the corresponding grid unit according to the point coordinates of the point element;
[0119] For the line element, each grid cell it passes through is the grid cell it covers;
[0120] For the area element, directly determine the grid cells it covers;
[0121] Step S1.4, determine the index parameters based on the relationship table between the spatial element ID and the grid unit ID it covers, and then establish the basin water conservancy entity spatial element index library.
[0122] This step can be implemented by the following steps:
[0123] Step (1) Determine the spatial range and grid resolution:
[0124] Select the spatial extent (total number of grids) to be indexed, such as a specific river basin, administrative region, or the entire country;
[0125] Determine the grid resolution to be indexed. The higher the resolution, the smaller the grid cells.
[0126] Step (2) Divide regular grid cells according to the determined spatial range and grid resolution
[0127] Step (3) assigns spatial elements to grid cells:
[0128] The grid cell where the point feature is located can be directly determined based on the point coordinates;
[0129] Line features can determine all grid cells that the line segment passes through and associate it with all related grid cells;
[0130] Area features can be marked as containing the area feature by determining the grid cells covered by the area 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) builds 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 grid cell tables and spatial feature tables to support fast range and proximity queries;
[0135] According to the data volume and query requirements, adjust the index parameters (such as index depth, block size, etc.) to improve query performance.
[0136] Step S2: Based on the spatial elements of each water conservancy entity in the watershed, establish the characteristic vector of each water conservancy entity; based on the characteristic vector of each water conservancy entity, cluster the water conservancy entities in the watershed to obtain the cluster label of each water conservancy entity, and establish the watershed water conservancy entity cluster label index library; Figure 1 The figure shows a flowchart for establishing a watershed water conservancy entity clustering label index library.
[0137] Step S2 is specifically as follows:
[0138] Step S2.1: Assume that there are t water conservancy entities in the basin; for water conservancy entity i, i = 1, 2, ..., t, determine its original eigenvector X according to its spatial elements. i :
[0139] X i =[w i1 x i1 ,w i2 x i2 ,...,w in x in ] (1)
[0140] Where: x ijrepresents the jth eigenvalue of water conservancy entity i, j = 1, 2, ..., n, n is the number of eigenvalues of each water conservancy entity; w ij Represents the weight of the j-th eigenvalue of water conservancy entity i, satisfying
[0141] Specifically, according to the characteristics of the water conservancy entity, its characteristic value is determined:
[0142] For water conservancy entities that only cover a single spatial element, such as hydrological stations and rain gauges, which are point-like entities with clear locations, their spatial characteristics are reflected only as point features. In this case, the spatial attributes of the point feature can be directly selected as the feature value without the need for additional weight assignment.
[0143] For complex water conservancy entities encompassing multiple spatial elements, such as reservoir systems, river networks, and irrigation areas, their spatial representations may include multiple elements, including points, lines, and surfaces. In this case, weights w should be assigned to each element based on its spatial proportion or importance within the entity. For example, if surface elements (such as river channels and reservoir areas) within a water conservancy entity occupy the majority of the spatial extent or play a dominant role in terms of function, the surface elements should be given a higher weight.
[0144] Step S2.2: Using formula (2), the original feature vector X of water conservancy entity i is i Perform regularization processing to obtain the regularized feature vector of water conservancy entity i
[0145]
[0146] Where: ||X i ||2 represents the original feature vector X of water conservancy entity i i The L2 norm of
[0147] Regularization can prevent some eigenvalues from being too large or too small and having adverse effects on clustering results.
[0148] Through the above-mentioned weighting and regularization processing, the heterogeneous spatial information of various water conservancy entities can be unified into comparable and computationally friendly standard feature vectors, thereby improving the accuracy and physical significance of subsequent clustering analysis.
[0149] Step S2.3, based on the regularized feature vector of each water conservancy entity i in the basin Clustering of water conservancy entities within the basin.
[0150] Step S2.3 is specifically as follows:
[0151] Step S2.3.1, determine the final number of clusters K required;
[0152] Step S2.3.2, initialize and determine K cluster centers, namely: cluster centers c1, c2, ..., c K ;
[0153] According to the probability selection algorithm, among the t water conservancy entities, K water conservancy entities are initially selected as cluster centers;
[0154] Step S2.3.2 is specifically as follows:
[0155] Step A1: randomly select a water conservancy entity from t water conservancy entities as the cluster center c1;
[0156] Step A2, set the variable L of the number of selected cluster centers, 1≤L<K;
[0157] Step A3, set the initial value of variable L to 1;
[0158] Step A4: The tL water conservancy entities that are not currently selected as cluster centers are called the water conservancy entity set H. Formula (7) is used to determine the selection probability of each water conservancy entity h in the water conservancy entity set H.
[0159]
[0160] Where: D h The shortest distance between the water conservancy entity h in the water conservancy entity set H and the currently selected cluster centers is determined by formula (8):
[0161]
[0162] Where: c l Represents the lth cluster center among the currently selected cluster centers;
[0163] Represents the regularized feature vector of water conservancy entity i and cluster center c l The vector difference of , squared after Euclidean norm calculation;
[0164] Step A5: According to the selection probability of each water conservancy entity h in the water conservancy entity set H Select a water conservancy entity as the cluster center;
[0165] Step A6, determine whether the variable L is equal to K. If so, execute step A7; if not, set the variable L=L+1; update the water conservancy entity set H, and return to step A4;
[0166] Step A7: K cluster centers are initialized and determined, and this step ends.
[0167] The probability selection algorithm in this step is used to initialize and determine K cluster centers, which can ensure the diversity and representativeness of the initial cluster centers and prevent the cluster from falling into local optimality.
[0168] Step S2.3.3, for each water conservancy entity i, calculate its cluster center c k The membership degree u ik , where k = 1, 2, ..., K;
[0169] Step S2.3.3 is specifically as follows:
[0170] Step B1, using formula (9), calculate the distance from water conservancy entity i to cluster center c k Distance D ik :
[0171]
[0172] Where: S is the covariance matrix, calculated by formula (10):
[0173]
[0174] in: represents the vector mean of t water conservancy entities, The superscript T represents the transition rank;
[0175] Step B2: Use formula (11) to calculate the cluster center c of water conservancy entity i k The membership degree u ik :
[0176]
[0177] Where: p is the fuzzy index, usually 2; D ig Represents water conservancy entity i to cluster center c g distance; g=1,2,...,K; water conservancy entity i to each cluster center c k The membership degree satisfies the formula:
[0178] Step S2.3.4, for each water conservancy entity i, each cluster center c k The membership degree u ik , the cluster center c k Update to cluster center
[0179] The present invention provides two cluster center update methods:
[0180] The first one:
[0181] Using formula (12), according to each water conservancy entity i, each cluster center ck The membership degree u ik , the cluster center c k Update to cluster center
[0182]
[0183] Where: p is the fuzzy index.
[0184] The second type:
[0185] Formula (13) is used to classify each cluster center c according to each water conservancy entity i. k The membership degree u ik , the cluster center c k Update to cluster center
[0186]
[0187] Where: η is the step size, which controls the amplitude 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 center; ε is the 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] In step S2.3.6, use formula (4) to calculate the mean value S of the silhouette coefficient of all water conservancy entities:
[0193]
[0194] Where: s i Represents the silhouette coefficient of water conservancy entity i; it is calculated using formula (14):
[0195]
[0196] Among them: a i is the average distance from water conservancy entity i to other water conservancy entities in the same cluster, calculated by formula (15):
[0197]
[0198] in: represents the sample set in the cluster category to which water conservancy entity i belongs, Represents the sample set Cyi The regularized feature vectors of other water conservancy entities u except water conservancy entity i in |C yi | represents the number of samples in the cluster category to which water conservancy entity i belongs;
[0199] b i is the average distance from water conservancy entity i to the nearest water conservancy entities in other cluster categories, calculated by formula (16):
[0200]
[0201] Where: C v represents the sample set in other cluster categories closest to water conservancy entity i, |C v | represents the sample set C v The number of samples in ; Represents the sample set C v The regularized feature vector of each water conservancy entity v in; v≠y i Representative sample set C v The cluster label of is not the cluster label y i .
[0202] Step S2.3.7: Evaluate the clustering effect using the silhouette coefficient mean 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 clustering quality:
[0204]
[0205] Step S2.3.8, use formula (5) to obtain the cluster label y of each water conservancy entity i i :
[0206]
[0207] The cluster label y of each water conservancy entity i (Category ID) is stored in the index library as the attribute information of the water conservancy entity. This step helps to establish a unified 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 water conservancy entity cluster label index shown in formula (6):
[0209] L(k)={i|y i=k,i∈{1,2,...,t}} (6)
[0210] Where: L(k) represents the cluster center The index collection of the corresponding cluster categories.
[0211] In practical applications, after the index library is established, the index library can be optimized, such as Figure 3 Figure 2 shows the schematic diagram of the index library optimization principle. Large areas are indexed using multi-level grids, improving query efficiency by gradually narrowing the query scope. Static data uses data compression or tiered storage to reduce storage space. Frequently accessed grid or spatial feature data is cached in memory to reduce database access.
[0212] A variety of query interfaces can be developed to enable application systems to efficiently access spatial feature data, such as grid cell query, proximity query, range query, and multi-condition query.
[0213] Step S3: Rendering the water conservancy entities in the watershed according to the watershed water conservancy entity spatial element index library and the watershed water conservancy entity cluster label index library.
[0214] like Figure 4 As shown, this is a flowchart for rendering water conservancy entities within the basin.
[0215] Step S3 is specifically as follows:
[0216] Step S3.1, request parsing and data preparation:
[0217] The client receives the tile rendering request and parses the required tile size and geographic extent;
[0218] Retrieving vector data that accurately matches the geographic range based on the watershed water conservancy entity spatial element index library and the watershed water conservancy entity cluster label index library;
[0219] Performing preliminary processing on the vector data according to defined slicing rules, including coordinate conversion and data screening, to obtain processed vector data;
[0220] Step S3.2, data processing and slice generation:
[0221] Editing and simplifying the processed vector data, and converting it into a vector slice format to obtain vector slice data;
[0222] Step S3.3, client operation and request transmission:
[0223] Encapsulating the theme and rendering range selected by the user as request parameters, combining the request parameters with the vector slice data obtained in step S3.2 to obtain a slice containing the request parameters; and sending both the request parameters and the slice containing the request parameters 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 according to the request parameters, and searches the style file library for a theme and a corresponding style file that matches the user request; wherein 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] A 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 a final map image.
[0229] Through WebGL adaptive rendering technology, the map can maintain the best display effect on different devices and screen sizes.
[0230] Further research may include automated generation of thematic maps based on Mapbox GLJS technology:
[0231] Step 1: Define the thematic map configuration and data source:
[0232] In Mapbox Studio, create or edit a Mapbox GL JSON style file for each theme to define the visual style, layer order, and interactive properties of the thematic map.
[0233] Specify the external data source URL 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 thematic maps, Mapbox Style Language (MSL) is used to define data-driven style rules.
[0237] Apply different visualization attributes such as color, symbol, or size based on different data values to achieve thematic display.
[0238] Step 3: Automatically generate thematic maps:
[0239] Use Node.js to write an automation script that can parse the templated Mapbox style file and fill in the specific data source URL and style configuration;
[0240] Integrate the theme's parameterized settings into automation scripts, such as different theme colors, interactive effects, etc.
[0241] Step 4: Deploy the thematic map generation service:
[0242] Create a Web service interface through which the client can pass in themes and parameters and request the generation of corresponding thematic maps;
[0243] Deploy the automation script to the server to ensure that it can receive requests and generate thematic maps.
[0244] Step 5: Client interaction and query:
[0245] Provide client interaction in the web interface, allowing the client to select the theme and parameters of the thematic map;
[0246] The client's selection is sent to the server through the Web service interface, triggering the automatic generation process of the thematic map.
[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 the web page based on the returned thematic map data.
[0250] Taking water conservancy objects in a certain area as an example, the present invention demonstrates the specific steps of a method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL:
[0251] Step 1: Divide the area into regular grid cells according to the spatial range and grid resolution. Use the spatial index established by the relationship between point, line, and surface spatial elements and grid cells to carry out range query, proximity query, and high-level index query of spatial elements.
[0252] Step 2: Based on the above steps, the required slice size and geographic range are parsed and queried, and the corresponding slice style is matched in the style file library according to the theme and rendering range selected by the user. The final map image is generated on different devices and screen sizes through WebGL adaptive rendering technology.
[0253] Step 3: If you need to generate a thematic map, you can define the thematic map configuration and data source. According to different data values, apply different visual attributes such as color, symbol or size to achieve thematic display and automatically generate the thematic map.
[0254] The present invention provides a method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL, which has the following advantages:
[0255] (1) A water conservancy entity clustering algorithm is provided, which can quickly perform spatial clustering of water conservancy entities based on spatial elements, avoid clustering falling into local optimality, and improve the accuracy and physical significance of clustering analysis.
[0256] (2) The established watershed water conservancy entity spatial element index library and watershed water conservancy entity cluster label index library can efficiently realize visual expression, spatial aggregation and classification retrieval in GIS platform, database or application system.
[0257] (3) Provide a rendering method for water conservancy entities within a watershed to achieve efficient rendering.
[0258] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. 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 water conservancy entity spatial elements based on machine learning and WebGL, characterized by: The following steps are involved: Step S1, decomposing each water conservancy entity in the basin into spatial elements, and establishing a water conservancy entity spatial element index database; Step S2: establishing a feature vector for each water conservancy entity based on the spatial elements of each water conservancy entity in the watershed; clustering each water conservancy entity in the watershed based on the feature vector of each water conservancy entity to obtain a cluster label for each water conservancy entity, and establishing a watershed water conservancy entity cluster label index library; Step S3: Rendering the water conservancy entities in the watershed according to the watershed water conservancy entity spatial element index library and the watershed water conservancy entity cluster label index library.
2. The method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL according to claim 1 is characterized in that: Step S1 is specifically as follows: Step S1.1, presetting a grid resolution; dividing the watershed into a plurality of grid cells according to the grid resolution; Step S1.2, decomposing each water conservancy entity into spatial elements; wherein the spatial elements include point elements, line elements and surface elements; Step S1.3, determining the correspondence between each spatial element and the grid cell it covers, thereby creating a relationship table between the spatial element ID and the grid cell ID it covers; in: For the point element, directly determining the corresponding grid unit according to the point coordinates of the point element; For the line element, each grid cell it passes through is the grid cell it covers; For the area element, directly determine the grid cells it covers; Step S1.4, determine the index parameters based on the relationship table between the spatial element ID and the grid unit ID it covers, and then establish the basin water conservancy entity spatial element index library.
3. The method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL according to claim 1 is characterized in that: Step S2 is specifically as follows: Step S2.1: Assume that there are t water conservancy entities in the basin; for water conservancy entity i, i = 1, 2, ..., t, determine its original eigenvector X according to its spatial elements. i : X i =[w i1 x i1 ,w i2 x i2 ,...,w in x in ] (1) Where: x ij represents the jth eigenvalue of water conservancy entity i, j = 1, 2, ..., n, n is the number of eigenvalues of each water conservancy entity; w ij Represents the weight of the j-th eigenvalue of water conservancy entity i, satisfying Step S2.2: Using formula (2), the original feature vector X of water conservancy entity i is i Perform regularization processing to obtain the regularized feature vector of water conservancy entity i Where: ||X i ||2 represents the original feature vector X of water conservancy entity i i The L2 norm of Step S2.3, based on the regularized feature vector of each water conservancy entity i in the basin Clustering of water conservancy entities within the basin.
4. The method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL according to claim 3 is characterized in that: Step S2.3 is specifically as follows: Step S2.3.1, determine the final number of clusters K required; Step S2.3.2, initialize and determine K cluster centers, namely: cluster centers c1, c2, ..., c K ; According to the probability selection algorithm, among the t water conservancy entities, K water conservancy entities are initially selected as cluster centers; Step S2.3.3, for each water conservancy entity i, calculate its cluster center c k The membership degree u ik , where k = 1, 2, ..., K; Step S2.3.4, for each water conservancy entity i, each cluster center c k The membership degree u ik , the cluster center c k Update to cluster center Step S2.3.5, determine whether formula (3) is satisfied: Where: Δ represents the change in cluster center; ε is 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; In step S2.3.6, use formula (4) to calculate the mean value S of the silhouette coefficient of all water conservancy entities: Where: s i represents the silhouette coefficient of hydraulic entity i; Step S2.3.7: Evaluate the clustering effect using the silhouette coefficient mean 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. Step S2.3.8, use formula (5) to obtain the cluster label y of each water conservancy entity i i : Step S2.3.9: Establish the water conservancy entity cluster label index shown in formula (6): L(k)={i|y i =k,i∈{1,2,...,t}} (6) Where: L(k) represents the cluster center The index collection of the corresponding cluster categories.
5. The method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL according to claim 4 is characterized in that: Step S2.3.2 is specifically as follows: Step A1: randomly select a water conservancy entity from t water conservancy entities as the cluster center c1; Step A2, set the variable L of the number of selected cluster centers, 1≤L<K; Step A3, set the initial value of variable L to 1; Step A4: The tL water conservancy entities that are not currently selected as cluster centers are called the water conservancy entity set H. Formula (7) is used to determine the selection probability of each water conservancy entity h in the water conservancy entity set H. Where: D h The shortest distance between the water conservancy entity h in the water conservancy entity set H and the currently selected cluster centers is determined by formula (8): Where: c l Represents the lth cluster center among the currently selected cluster centers; Represents the regularized feature vector of water conservancy entity i and cluster center c l The vector difference of , squared after Euclidean norm calculation; Step A5: According to the selection probability of each water conservancy entity h in the water conservancy entity set H Select a water conservancy entity as the cluster center; Step A6, determine whether the variable L is equal to K. If so, execute step A7; if not, set the variable L=L+1; update the water conservancy entity set H, and return to step A4; Step A7: K cluster centers are initialized and determined, and this step ends.
6. The method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL according to claim 4 is characterized in that: Step S2.3.3 is specifically as follows: Step B1, using formula (9), calculate the distance from water conservancy entity i to cluster center c k Distance D ik : Where: S is the covariance matrix, calculated by formula (10): in: represents the vector mean of t water conservancy entities, The superscript T represents the transition rank; Step B2: Use formula (11) to calculate the cluster center c of water conservancy entity i k The membership degree u ik : Where: p is the fuzzy index; D ig Represents water conservancy entity i to cluster center c g distance; g=1,2,...,K; water conservancy entity i to each cluster center c k The membership degree satisfies the formula:
7. The method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL according to claim 6 is characterized in that: Step S2.3.4 is specifically as follows: Using formula (12), according to each water conservancy entity i, each cluster center c k The membership degree u ik , the cluster center c k Update to cluster center Where: p is the fuzzy index.
8. The method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL according to claim 6 is characterized in that: Step S2.3.4 is specifically as follows: Formula (13) is used to classify each cluster center c according to each water conservancy entity i. k The membership degree u ik , the cluster center c k Update to cluster center Where: η is the step size, which controls the amplitude of each update; S is the covariance matrix.
9. The method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL according to claim 4 is characterized in that: Using formula (14), we can get the silhouette coefficient s of water conservancy entity i: i : Among them: a i is the average distance from water conservancy entity i to other water conservancy entities in the same cluster, calculated by formula (15): in: represents the sample set in the cluster category to which water conservancy entity i belongs, Represents a sample set The regularized feature vectors of other water conservancy entities u except water conservancy entity i; represents the number of samples in the cluster category to which water conservancy entity i belongs; b i is the average distance from water conservancy entity i to the nearest water conservancy entities in other cluster categories, calculated by formula (16): Where: C v represents the sample set in other cluster categories closest to water conservancy entity i, |C v | represents the sample set C v The number of samples in ; Represents the sample set C v The regularized feature vector of each water conservancy entity v in; v≠y i Representative sample set C v The cluster label of is not the cluster label y i .
10. The method for indexing and efficiently rendering water conservancy entity spatial elements based on machine learning and WebGL according to claim 1, characterized in that: Step S3 is specifically as follows: Step S3.1, request parsing and data preparation: The client receives the tile rendering request and parses the required tile size and geographic extent; Retrieving vector data that accurately matches the geographic range based on the watershed water conservancy entity spatial element index library and the watershed water conservancy entity cluster label index library; Performing preliminary processing on the vector data according to defined slicing rules, including coordinate conversion and data screening, to obtain processed vector data; Step S3.2, data processing and slice generation: Editing and simplifying the processed vector data, and converting it into a vector slice format to obtain vector slice data; Step S3.3, client operation and request transmission: Encapsulating the theme and rendering range selected by the user as request parameters, combining the request parameters with the vector slice data obtained in step S3.2 to obtain a slice containing the request parameters; and sending both the request parameters and the slice containing the request parameters to the server; Step S3.4, slice request and response: The server receives the request parameters and searches a pre-built style file library according to the request parameters, and searches the style file library for a theme and a corresponding style file that matches the user request; wherein 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; A 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 a final map image.
Citation Information
Patent Citations
Vector data space indexing method base on hbase and geohash
CN104199986A
Geographic information based cartographic data three-dimensional display system
CN108572951A
Natural resource data index statistical method and system based on geographic multilevel grid
CN113010620A
Steel structure welding process quality management recommendation method based on big data processing
CN118132849A
Georaster physical data model for storing georeferenced raster data
US20050055376A1