Database-based online data editing method and device
By performing grid encoding and vector tiling in the database, online editing of vector data in the database was realized, solving the problems of low efficiency and feature conflicts in existing technologies, and improving editing efficiency and data management accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN DAMENG DATABASE
- Filing Date
- 2026-05-11
- Publication Date
- 2026-06-09
AI Technical Summary
Existing spatial data update methods are time-consuming and labor-intensive, and are prone to topological errors. Traditional version editing methods face feature conflict problems and cannot achieve the editing function of vector data in the database.
After importing the data into the database, it is converted into existing vector data through grid encoding, and then converted into vector tiles for visualization and encapsulation. User instructions are obtained for editing. The grid encoding is used to distinguish the data, and only the vector tiles at the specified positions are called for editing and updating. Timestamps and version numbers are generated to manage data versions.
It implemented online editing functionality for vector data in the database, avoiding impact on data in other locations, improving editing efficiency, reducing topological errors, and resolving feature conflict issues.
Smart Images

Figure CN122173586A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of database processing technology, and more specifically, relates to a database-based online data editing method and apparatus. Background Technology
[0002] Existing DM spatial data, when loaded using Geographic Information System (GIS) tools, can only be viewed and displayed; data editing is not possible. Furthermore, the traditional spatial data update process involves: first, based on the area of change, cutting out the data to be updated (i.e., the data to be updated) from the source data; after all the data to be updated is updated, then joining it with the unchanged data in the original data to finally complete the spatial data update. If the changed areas are numerous or scattered, the subsequent data joining work will consume a significant amount of time and effort, and the joining operation is prone to topological errors, affecting the quality of the updated data. Traditional version editing methods based on spatial databases also face the problem of feature conflicts caused by cross-regional lines and polygons.
[0003] Therefore, overcoming the shortcomings of the existing technology is an urgent problem to be solved in this technical field. Summary of the Invention
[0004] The problem this invention aims to solve is how to implement the editing function of vector data in a database.
[0005] Firstly, a database-based online data editing method is provided, including: Import the data into the database and then convert the data into existing vector data using grid encoding; Convert the existing vector data in each grid into vector slices, and then encapsulate all vector slices for visualization. Obtain the user-issued command and, based on the command, retrieve the target vector slice from all vector slices; The existing vector data in the target vector slice is edited and updated according to the instructions.
[0006] Preferably, the step of converting the existing vector data in each grid into vector slices and visually encapsulating all vector slices specifically includes: The existing vector data in each grid is converted into PBF slices and stored in the memory cache as the vector slices; Use the grid code of the corresponding grid as the key for the vector slice.
[0007] Preferably, the step of importing data into the database and converting the data into existing vector data through grid encoding specifically includes: Import all data into the spatial data table of the spatial database through the spatial database engine; The data in the spatial data table is divided into multiple grid data by performing grid partitioning on the spatial grid. Obtain the latitude and longitude coordinates corresponding to each grid data, convert the latitude and longitude coordinates corresponding to each grid data into a two-dimensional grid location code, and obtain the stored vector data of each grid data.
[0008] Preferably, the step of obtaining the user-issued instruction and obtaining the target vector slice from all vector slices according to the instruction specifically includes: Retrieve the target location code from the user-issued command; Obtain the slice vector corresponding to the target location code in the spatial data table based on the target location code; The obtained slice vector is used as the target vector slice corresponding to the instruction.
[0009] Preferably, the step of editing and updating the existing vector data in the target vector slice according to the instruction specifically includes: Determine the type of instruction issued by the user; When the user issues a new instruction, the new data is obtained according to the instruction, and the new data is edited into the existing vector data in the target vector slice; When the user issues a deletion command, the existing vector data in the target vector slice is deleted. When the user issues an update command, update data is obtained according to the command, and the update data is edited into the existing vector data in the target vector slice.
[0010] Preferably, when the user issues a new instruction, obtaining the new data according to the instruction and editing the new data into the existing vector data in the target vector slice specifically includes: The new data is obtained according to the instructions, the format of the new data is converted and verified, and the new data is imported into the spatial data table; The newly added data is meshed using a spatial grid and then converted into new vector slices. The newly added vector slice and the target vector slice are integrated and rendered to complete the editing task of the new instruction.
[0011] Preferably, the step of obtaining the user-issued instruction and obtaining the target vector slice from all vector slices according to the instruction further includes: After the target vector slice is obtained according to the instruction, the target vector slice is locked to prevent other users from issuing instructions to the target vector slice simultaneously. After the existing vector data in the target vector slice is edited and updated according to the instructions, the data in the target vector slice is unlocked.
[0012] Preferably, the database-based online data editing method further includes: Each time an edit or update is completed, a new timestamp and version number are generated, and the difference data of this round of edits and updates are stored. The difference data is then mapped to the timestamp and version number.
[0013] In a second aspect, a database-based online data editing device is provided, comprising at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the processor to perform the database-based online data editing method.
[0014] Thirdly, the present invention also provides a non-volatile computer storage medium storing computer-executable instructions that are executed by one or more processors to perform the method described in the first aspect.
[0015] Fourthly, a chip is provided, comprising: a processor and an interface for calling and running a computer program stored in memory, performing the method as described in the first aspect.
[0016] Fifthly, a computer program product containing instructions is provided that, when executed on a computer or processor, causes the computer or processor to perform the method as described in the first aspect.
[0017] Sixthly, a database-based online data editing device is provided, comprising the database-based online data editing device as described in the second aspect, and using the database-based online data editing method as described in the first aspect. Unlike the prior art, the present invention has at least the following beneficial effects: Unlike existing technologies, the present invention has at least the following beneficial effects: The above method imports data into the database for grid division and grid encoding, which distinguishes different vector data. When the user needs to edit the data at a specified location, the corresponding vector slice data is called according to the location information in the instruction, and the corresponding data is edited and updated. Since only the vector data required by the user is called, it will not affect the data at other locations, thus realizing the online editing function of spatial data. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly described below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0019] Figure 1 This is a flowchart of a database-based online data editing method provided in this embodiment; Figure 2 This is a flowchart of the grid encoding method in a database-based online data editing method provided in this embodiment; Figure 3 This is a schematic diagram of mesh partitioning in a database-based online data editing method provided in this embodiment; Figure 4 This is a flowchart illustrating the acquisition of target vector slices in a database-based online data editing method provided in this embodiment; Figure 5 This is a flowchart illustrating the method of editing according to instructions in an online data editing method based on a database provided in this embodiment; Figure 6 This embodiment provides a flowchart of the method for completing a new instruction in an online data editing method based on a database. Figure 7 This is a flowchart illustrating the method of editing according to instructions in an online data editing method based on a database provided in this embodiment; Figure 8 This is a flowchart of a data locking method in a database-based online data editing method provided in this embodiment; Figure 9 This is a flowchart of a data rollback method in a database-based online data editing method provided in this embodiment; Figure 10 This is a schematic diagram of a database-based online data editing device provided in this embodiment. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages 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 not intended to limit the invention.
[0021] Unless the context otherwise requires, throughout the specification and claims, the term "comprising" is interpreted as openly inclusive, meaning "including, but not limited to." In the description of the specification, terms such as "one embodiment," "some embodiments," "exemplary embodiment," "example," "specific example," or "some examples" are intended to indicate that a particular feature, structure, material, or characteristic associated with that embodiment or example is included in at least one embodiment or example of this disclosure. The illustrative representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics mentioned may be included in any suitable manner in any one or more embodiments or examples; that is, although they may be incorporated into embodiments or examples using the above terms for reasons such as order and position, it does not limit them to be incorporated in combination by a single embodiment or example.
[0022] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of embodiments of this disclosure, unless otherwise stated, "a plurality of" means two or more. Furthermore, for example, the description may use the prefix "A" or "B" to describe the same type of nouns as two independent entities. In this case, the corresponding features defined with "A" and "B" are used only to distinguish between similar entities and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features.
[0023] In the description of this invention, the expression “A and / or B” (where A and B are used to formally represent specific features) will be used. The corresponding expression includes the following three combinations: only A, only B, and a combination of A and B.
[0024] As used in this invention, “about,” “approximately,” or “approximately” includes the stated value and the average value within an acceptable range of deviation from a particular value, wherein the acceptable range of deviation is determined by a person skilled in the art taking into account the measurement under discussion and the error associated with the measurement of the particular quantity (i.e., the limitations of the measurement system).
[0025] Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0026] Example 1: This embodiment provides a database-based online data editing method, such as... Figure 1 As shown, the method flow includes the following.
[0027] In step 101, the data is imported into the database and then converted into stock vector data through grid encoding.
[0028] In this embodiment, the database can be the DM database, and the corresponding method is used to edit and control the vector data (i.e., spatial data) in the database online. The data can be a business data shp file. The application scenario of the method is that users edit and control the data at a specified location on the map. Therefore, the data needs to be divided into the form of a BeiDou spatial grid and converted into the corresponding grid code according to the location information of the data, i.e., existing vector data. When users need to edit and update the data at a specified location later, they can call the corresponding existing vector data for processing and editing according to the location information.
[0029] Furthermore, when a user needs to edit the vector data in the database, the corresponding existing vector data needs to be displayed in a visual form on the front end for user interaction. Therefore, this embodiment also involves the following steps.
[0030] In step 102, the existing vector data in each grid is converted into vector slices, and all vector slices are visualized and encapsulated.
[0031] In this embodiment, vector data in the GeoSOT-BeiDou spatial grid cells are converted into Protocol Buffers (PBF) vector slices and stored in a Redis memory cache, using the grid code of the grid data as the key. Since the GeoSOT-BeiDou spatial grid is divided using latitude and longitude lines, it can be well aggregated and associated with national basic scale topographic maps, and is easier to convert with various types of data currently available. The GeoSOT-BeiDou spatial grid is divided into 32 levels, ranging from global to centimeter-level, uniformly dividing the Earth's surface space into multi-level grids, forming a global quadtree system. The area ratio between upper and lower levels of the GeoSOT-BeiDou spatial grid is approximately 4:1.
[0032] When a user needs to edit specified data in the database, the corresponding vector slice is retrieved, and the corresponding data is retrieved and edited based on the vector slice.
[0033] In step 103, the user-issued instruction is obtained, and the target vector slice is obtained from all vector slices according to the instruction.
[0034] In this embodiment, the types of instructions issued by the user include: deletion type, addition type and update type. The target vector slice is the vector slice corresponding to the data that the user needs to edit. The instruction includes the position code corresponding to the target vector slice. Based on the position code, the data corresponding to the target vector slice can be retrieved from the database.
[0035] When the instruction type is either add or update, the instruction also includes the corresponding add or update data. The add and update data are pre-imported into the database.
[0036] In step 104, the existing vector data in the target vector slice is edited and updated according to the instructions.
[0037] When a user opens an editing task, the system retrieves the corresponding data from the database based on the location code of the target vector slice and displays it visually on the editing interface. The user then performs the corresponding editing operation based on the type of instruction.
[0038] In this embodiment, by importing data into a database for grid division and grid encoding, different vector data are distinguished. When a user needs to edit data at a specified location, the corresponding vector slice data is called according to the location information in the instruction, and the corresponding data is edited and updated. Since only the vector data required by the user is called, it will not affect the data at other locations, thus realizing the online editing function of spatial data.
[0039] Furthermore, in this embodiment, in order to map the data to the location coordinates on the map so as to facilitate the visualization of the data on the front end, the following design is also involved.
[0040] The process involves importing data into a database and then converting the data into existing vector data using grid encoding, such as... Figure 2 As shown, the specific methods and processes include the following.
[0041] In step 201, all data is imported into the spatial data table of the spatial database through the spatial database engine.
[0042] In step 202, the data in the spatial data table is divided into multiple grid data by using a spatial grid.
[0043] like Figure 3 The diagram shown is a schematic of mesh generation.
[0044] In step 203, the latitude and longitude coordinates corresponding to each grid data are obtained, and the latitude and longitude coordinates corresponding to each grid data are converted into two-dimensional grid location codes to obtain the stored vector data of each grid data.
[0045] In this embodiment, the implementation code for converting the known latitude and longitude coordinates of the grid data into a two-dimensional grid location code is as follows.
[0046] / / 2D encoding strategy private static final GridEncoder <gridinfo>GRID_ENCODER_2D = newGridEncoder<>(); static { / / Register 2D encoders register2DEncoders(); } / Register all 2D encoders / private void register2DEncoders() { GRID_ENCODER_2D.register(1, BeidouGridUtil::calculate2DFirstLevelCode); GRID_ENCODER_2D.register(2, BeidouGridUtil::calculate2DSecondLevelCode); GRID_ENCODER_2D.register(3, BeidouGridUtil::calculate2DThirdLevelCode); GRID_ENCODER_2D.register(4, BeidouGridUtil::calculate2DForthLevelCode); GRID_ENCODER_2D.register(5, BeidouGridUtil::calculate2DFifthLevelCode); GRID_ENCODER_2D.register(6, BeidouGridUtil::calculate2DSixthLevelCode); GRID_ENCODER_2D.register(7, BeidouGridUtil::calculate2DSeventhLevelCode); GRID_ENCODER_2D.register(8, BeidouGridUtil::calculate2DEighthLevelCode); GRID_ENCODER_2D.register(9, BeidouGridUtil::calculate2DNinthLevelCode); GRID_ENCODER_2D.register(10, BeidouGridUtil::calculate2DTenthLevelCode); } / Generate two-dimensional BeiDou grid code @param longitude Longitude (unit: seconds) @param latitude (in seconds) @param level Encoding level (1-10) @return BeiDou grid coding / public String generate2DGridCode(BigDecimal longitude, BigDecimallatitude, int level) { validateCoordinates(longitude.doubleValue(), latitude.doubleValue()); validateLevel(level); GridInfo gridInfo = createInitialGridInfo(longitude, latitude); for (int i = 1; i<= level; i++) { Function<GridInfo, GridInfo> encoder = GRID_ENCODER_2D.get(i); if (encoder == null) { throw new BeidouGridException("Unsupported encoding level: " + i); } gridInfo = encoder.apply(gridInfo); } return gridInfo.getGridCode(); } Furthermore, in this embodiment, since users need to visualize the data when calling and editing it, the following design is involved for all data in the database.
[0047] The step of converting the existing vector data in each grid into vector slices and encapsulating all vector slices into a vector slice service specifically includes: converting the existing vector data in each grid into PBF slices and storing them in a memory cache as the vector slices; and using the grid code of the corresponding grid as the key of the vector slice. In this embodiment, vector tile information is obtained based on the vector tile request URL address. This information includes the map level where the vector tile is located, the map server name, and the row and column numbers of the vector tile. A tile pyramid object is instantiated based on the obtained vector tile information. The coordinates of the four corner points of the vector tile sought by the vector tile request URL are calculated based on the map resolution corresponding to the map level of the instantiated tile pyramid object and the obtained vector tile information. Based on the range of the four corner point coordinates and the map service name, vector data corresponding to the vector tile is obtained from the spatial data source. The map resolution of the requested vector tile is obtained. The vector data is then thinned based on the map resolution, followed by data assembly and format conversion. The thinned vector data is then presented, completing the visualization encapsulation of the vector tile.
[0048] In this embodiment, because the GeoSOT-BeiDou spatial grid is divided using latitude and longitude lines, it can be well aggregated and correlated with national basic scale topographic maps, and is easier to convert with various types of data currently available. The GeoSOT-BeiDou spatial grid is divided into 32 levels, ranging from global to centimeter-level, uniformly dividing the Earth's surface into multi-level grids that form a global quadtree system. The area ratio between different levels of the GeoSOT-BeiDou spatial grid is approximately 4:1. The number of GeoSOT grids at each level and their approximate spatial scale on the ground are shown in Table 1 below.
[0049] Table 1. Correspondence between grid number and spatial size
[0050] Among them, the 1:1,000,000 and 1:500,000 topographic map sheets are equivalent to the first and third layers of two-dimensional grids, respectively. Other scale series topographic maps can also be formed by aggregating two-dimensional grids of appropriate levels. The conversion relationship between BeiDou grid location codes and national basic scale topographic map sheets is shown in the table below.
[0051] Table 2 Conversion Relationship Table
[0052] Vector tile request URL: Load vector tile service in the web map. The tile request URL is generated based on the map level and row and column numbers according to the tile pyramid of the map base map.
[0053] The complete vector tile request URL above has the following format: http: / / IP:8788 / dmglobe-serverx / dmglobe / services / mvt / {workspace} / {serviceName} / {coordinateSystem} / {z} / {x} / {y}.pbf layerName (representing the layer name) = {layerName} &tileSize (representing slice size) = 256 Among them, the coordinateSystem parameter is the map coordinate system; the serviceName parameter is the map service name; the workspace parameter is the workspace name; the z parameter is the map level; the x parameter is the map coordinate column number; and the y parameter is the map coordinate row number.
[0054] Furthermore, when a user issues a command, the data that the user needs to interact with in the database needs to be found in advance based on the command. Therefore, this embodiment also involves the following design.
[0055] The process involves obtaining user-issued instructions and retrieving the target vector slice from all vector slices based on those instructions. Figure 4 As shown, the method flow includes the following.
[0056] In step 301, the target location code in the instruction issued by the user is obtained.
[0057] In step 302, the slice vector corresponding to the target location code in the spatial data table is obtained according to the target location code.
[0058] In step 303, the obtained slice vector is used as the target vector slice corresponding to the instruction.
[0059] Furthermore, since there are various types of instructions issued by users, different corresponding operations are required for different instruction types. Therefore, this embodiment also involves the following design.
[0060] The existing vector data in the target vector slice is edited and updated according to the instructions, such as... Figure 5 As shown, the method flow includes the following steps.
[0061] In step 401, the instruction type of the user-issued command is determined.
[0062] In this embodiment, the instruction types include add instructions, delete instructions, and update instructions. The add instruction adds new data content to the existing data, the delete instruction deletes some data content to the existing data, and the update instruction changes some data content to the existing data.
[0063] In step 402, when the user issues a new instruction, the new data is obtained according to the instruction, and the new data is edited into the existing vector data in the target vector slice.
[0064] In this embodiment, the new instruction includes the location information of the target vector slice and the data content of the new data. Based on the new instruction, the target vector slice that the user needs to interact with is located and visualized on the front end. The new data from the new instruction is then integrated into the target vector slice to complete the editing task of the new instruction.
[0065] In step 403, when the user issues a deletion instruction, the existing vector data in the target vector slice is deleted.
[0066] In this embodiment, the deletion instruction includes the location information of the target vector slice. The deletion instruction is completed by finding the target vector slice that the user needs to interact with, and then deleting the target vector slice.
[0067] In step 404, when the user issues an update command, update data is obtained according to the command, and the update data is edited into the existing vector data in the target vector slice.
[0068] In this embodiment, the update instruction includes the location information of the target vector tile and the data content of the update data. Based on the update instruction, the target vector tile that the user needs to interact with is located and visualized on the front end. The update data from the update instruction is then integrated into the target vector tile to complete the editing task of the update instruction.
[0069] Furthermore, in this embodiment, when the user issues a new instruction, it is necessary to process the new data and the target vector slice data accordingly to complete the integration between the two data. Therefore, this embodiment also involves the following design.
[0070] When the user issues a new command, the system retrieves the new data according to the command and edits the new data into the existing vector data in the target vector slice, such as... Figure 6 As shown, the method flow includes: In step 501, new data is obtained according to the instruction, the new data is formatted and validated, and then imported into the spatial data table.
[0071] In step 502, the newly added data is meshed using a spatial grid and converted into new vector slices.
[0072] In this embodiment, the newly added data is meshed and encoded so that the editing task can access the newly added data more quickly.
[0073] In step 503, the newly added vector slice and the target vector slice are integrated and rendered to complete the editing task of the new instruction.
[0074] Similarly, in this embodiment, when the user issues an update command, the update data and the target vector slice data need to be processed accordingly to complete the integration between the two data. Therefore, this embodiment also involves the following design.
[0075] When the user issues an update command, the system retrieves update data based on the command and edits the update data into the existing vector data in the target vector slice, such as... Figure 7 As shown, the method flow includes: In step 601, updated data is obtained according to the instruction, the updated data is formatted and validated, and the updated data is imported into the spatial data table.
[0076] In step 602, the updated data is meshed using a spatial grid and converted into new vector slices.
[0077] In this embodiment, the data is meshed and encoded so that the editing task can access updated data more quickly.
[0078] In step 603, the updated vector slice and the target vector slice are integrated and rendered to complete the update instruction.
[0079] Furthermore, considering that multiple users may edit data in different locations within the database simultaneously, leading to conflicts due to different editing operations by different users, this embodiment also involves the following design: Based on user-issued instructions, the target vector slice is obtained from all vector slices, such as... Figure 8 As shown, it also includes the following steps.
[0080] In step 701, after obtaining the target vector slice according to the instruction, the target vector slice is data locked to prevent other users from simultaneously issuing instructions to the target vector slice.
[0081] In this embodiment, when a user initiates an editing command, relevant data is extracted from the database based on the grid code of the object to be edited. The extracted data is then visually displayed on the editing interface. After the user confirms the data extraction, the system locks the currently extracted data in the table recording locked data. Simultaneously, when other users attempt to extract the data, the system performs a conflict check to prevent unauthorized editing of the locked data. When a user performs comprehensive data editing, this process involves spatial positioning adjustments, attribute information modification and entry, as well as crucial topological relationship maintenance, ultimately generating a completed dataset. Users can directly edit individual vector data geometric objects or use the attribute brush tool to select multiple vector data geometric objects for batch attribute editing. This step allows users to perform detailed attribute modifications on newly acquired or existing data.
[0082] In step 702, after the existing vector data in the target vector slice is edited and updated according to the instruction, the data of the target vector slice is unlocked.
[0083] Once the target vector slice is removed from the table recording locked data, it is unlocked and can be accessed by other users. It's worth noting that existing technologies lock data according to its region to prevent multiple users from simultaneously editing the same data. However, this may lock data that is not being edited, potentially affecting data editing in other regions. In this embodiment, because the data in the database is pre-divided into grids and encoded, the data locking is more precise, better avoiding the problem of data that does not need to be edited being synchronously locked.
[0084] Furthermore, after the user completes the editing task, in order to avoid the edited data being non-compliant or containing errors, it is also necessary to check the edited data. The specific methods are as follows.
[0085] The edited data is checked and reviewed to determine if there are any errors. If so, the editing task is redone; if there are no errors, the data is approved.
[0086] Specifically, when a user performs visual editing operations, the server receives and verifies the legality of the editing operation in real time. For example, for the extension of a line segment, the server needs to verify whether the extended line segment is still within a reasonable spatial range and whether it conflicts with other elements. If the verification passes, the actual editing process is performed, updating the geometric and attribute information of the data.
[0087] Furthermore, once the edited data has been verified to be correct, the edited data is merged with the data in the spatial data table of the database, the existing vector data in the spatial data table is updated, and the locked data is unlocked.
[0088] Furthermore, in this embodiment, considering that users may need to revisit previous edit versions during actual editing for viewing or modification, therefore, as Figure 9 As shown, this embodiment also involves the following design.
[0089] In step 801, when each editing update is completed, a new timestamp and version number are generated, and the difference data of this round of editing updates is stored, and the difference data is matched with the timestamp and version number.
[0090] In step 802, when a user needs to revert to a specified historical version, all the difference data between the current version and the specified historical version are obtained as rollback data. The data corresponding to the current version is processed according to the rollback data to obtain the data corresponding to the specified historical version.
[0091] Specifically, after each editing operation on spatial data, the system automatically generates a new timestamp and increments the version number. For example, the version number starts from V1.0 and becomes V1.1, V1.2, etc. after each edit, while also recording the specific time of the editing operation. To efficiently store different versions of data, the system uses incremental storage, meaning it only stores the differences between adjacent versions, rather than storing all the data for each version. After editing, the server re-stores the updated data into the database according to the original grid coding rules, while simultaneously logging the editing operation, including the operation type, operator, and operation time. This operation log, combined with GeoSOT-BeiDou spatial grid coding, allows for precise location of historical operation records for each grid cell.
[0092] First, the system merges the newly edited vector data into the database. This merging operation includes inserting new vector data and updating or deleting previously locked existing vector data. After this operation, the system unlocks the previously applied data locks, allowing other tasks to safely retrieve and edit this data. Next, the system precisely identifies the vector data of the changed meshes and updates the corresponding mesh vector tiles accordingly. This fine-grained update process ensures that only affected data is refreshed, optimizing update efficiency. Finally, once the vector tile updates are complete, the system automatically pushes an update notification to the client. Upon receiving the notification, the browser client re-renders the existing vector data, ensuring that the user interface displays the latest and most accurate vector data information.
[0093] For edited vector data, the merging and updating process is implemented by generating corresponding SQL statements based on the vector data. This involves using SQL statements supported by the Dameng (geo2) spatial database to update the current spatial data tables. In other words, the modified data replaces the original data in the Dameng (geo2) spatial tables using SQL statements, thus achieving real-time database entry of the edited results. For example, converting the impact range data of potential hazards into SQL statements recognizable by the Dameng (geo2) spatial database is shown in the following code.
[0094] UPDATE 'yhdfw' SET 'id' = 'S202401KMWH0047','attrjson' = '{"districtCode":"530102","deformationFeature":"","mainDamageObjects":"","deformationNum":"","otherDamageObject":"","addTime":"","disasterDeco deType":"00","sentry":"","speedNum":"","startDate":"","endDate":"","area":"2273942179","volume":"","maxAltitude":"2512.30","syncId":""}','year' = 2024,'batch' = 1,'status' = '1','SHAPE' = dmgeo2.ST_GeomFromText('POLYGON((102.409249 25.466517, 102.832029 25.515742, 102.864143 25.20958, 102.58224225.105715, 102.231528 25.199204, 102.148508 25.332176, 102.40924925.466517))', 4326)WHERE ('OGR_FID' = '47') The newly added hazard point impact range data is converted into SQL statements recognizable by the Dameng (geo2) database, and a record is inserted into the corresponding table. The corresponding code is as follows: INSERT INTO 'yhdfw' ( 'SHAPE','id','attrjson','year','batch','status' ) VALUES ( dmgeo2.ST_GeomFromText('POLYGON((102.409249 25.466517, 102.832029 25.515742, 102.864143 25.20958, 102.58224225.105715, 102.231528 25.199204, 102.148508 25.332176, 102.40924925.466517))', 4326),'S202401KMWH0000','{"districtCode":"530102","deformationFeature":"","mainDamageObjects":"","deformationNum":"","otherDamageObject":"","addTime":"","dis asterDecodeType":"00","sentry":"","speedNum":"","startDate":"","endDate":"","area":"2273942179","volume":"","maxAltitude":"2512.30","syncId":""}',2024,1,'1') Furthermore, each user's editing operations on vector data in the BeiDou grid by loading vector tile services through the Web map client and rendering the data are all achieved by parsing the GeoSOT-BeiDou spatial grid code to quickly locate the grid cell containing the vector data to be edited, thereby enabling precise data manipulation.
[0095] Furthermore, when multiple users edit the same spatial data simultaneously, a pessimistic locking mechanism is adopted. When editing conflicts occur and cannot be resolved through a simple locking mechanism, a version merging strategy is adopted. Based on the coding of the GeoSOT-BeiDou spatial grid, the conflicting data areas are further subdivided, the content edited by different users is analyzed, and versions are automatically or manually merged to integrate the edited elements into a new version.
[0096] This invention, by adopting the above technical solutions, has the following advantages: It enables online drawing and editing of spatial data through a Web map client, solving the problem that GIS clients can only view but not edit spatial layer data loaded from the database. Through reasonable spatial database version control, it effectively avoids element conflicts, making it possible for multiple users and multiple versions to concurrently edit spatial layer data in the database. By parsing GeoSOT-BeiDou spatial grid encoding, it quickly locates the grid cell containing the data to be edited, thereby achieving precise data manipulation. Utilizing the advantages of GeoSOT-based BeiDou spatial grid encoding, it enables efficient management and layered display of massive vector data.
[0097] Example 2: like Figure 10 The diagram shown is a schematic representation of a database-based online data editing device according to an embodiment of the present invention. This database-based online data editing device includes one or more processors 41 and a memory 42.
[0098] Processor 41 and memory 42 can be connected via a bus or other means. Figure 10 Taking the example of a connection between China and Israel via a bus.
[0099] The memory 42, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs and non-volatile computer-executable programs, such as the database-based online data editing method in the above embodiments. The processor 41 executes the database-based online data editing method by running the non-volatile software programs and instructions stored in the memory 42.
[0100] Memory 42 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 42 may optionally include memory remotely located relative to processor 41, which can be connected to processor 41 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0101] The program instructions / modules are stored in the memory 42, and when executed by one or more processors 41, they execute the database-based online data editing method described in the above embodiments.
[0102] This invention also provides a computer storage medium storing computer program instructions; when these computer program instructions are executed by a processor, they implement the database-based online data editing method provided in this invention.
[0103] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.< / gridinfo>
Claims
1. A database-based online data editing method, characterized in that, include: Import the data into the database and then convert the data into existing vector data using grid encoding; Convert the existing vector data in each grid into vector slices, and then encapsulate all vector slices for visualization. Obtain the user-issued command and, based on the command, retrieve the target vector slice from all vector slices; The existing vector data in the target vector slice is edited and updated according to the instructions.
2. The online data editing method based on a database according to claim 1, characterized in that, The process of converting the existing vector data in each grid into vector slices and then visually encapsulating all vector slices specifically includes: The existing vector data in each grid is converted into PBF slices and stored in the memory cache as the vector slices; Use the grid code of the corresponding grid as the key for the vector slice.
3. The online data editing method based on a database according to claim 1, characterized in that, The process of importing data into a database and converting the data into existing vector data using grid encoding specifically includes: Import all data into the spatial data table of the spatial database through the spatial database engine; The data in the spatial data table is divided into multiple grid data by performing grid partitioning on the spatial grid. Obtain the latitude and longitude coordinates corresponding to each grid data, convert the latitude and longitude coordinates corresponding to each grid data into a two-dimensional grid location code, and obtain the stored vector data of each grid data.
4. The online data editing method based on a database according to claim 1, characterized in that, The step of obtaining the user-issued command and retrieving the target vector slice from all vector slices according to the command specifically includes: Retrieve the target location code from the user-issued command; Obtain the slice vector corresponding to the target location code in the spatial data table based on the target location code; The obtained slice vector is used as the target vector slice corresponding to the instruction.
5. The online data editing method based on a database according to claim 4, characterized in that, The step of editing and updating the existing vector data in the target vector slice according to the instruction specifically includes: Determine the type of instruction issued by the user; When the user issues a new instruction, the new data is obtained according to the instruction, and the new data is edited into the existing vector data in the target vector slice; When the user issues a deletion command, the existing vector data in the target vector slice is deleted. When the user issues an update command, update data is obtained according to the command, and the update data is edited into the existing vector data in the target vector slice.
6. The online data editing method based on a database according to claim 5, characterized in that, When the user issues a new command, the process of obtaining new data according to the command and editing the new data into the existing vector data in the target vector slice specifically includes: The new data is obtained according to the instructions, the format of the new data is converted and verified, and the new data is imported into the spatial data table; The newly added data is meshed using a spatial grid and then converted into new vector slices. The newly added vector slice and the target vector slice are integrated and rendered to complete the editing task of the new instruction.
7. The online data editing method based on a database according to claim 5, characterized in that, The step of obtaining the user-issued instruction and retrieving the target vector slice from all vector slices according to the instruction further includes: After the target vector slice is obtained according to the instruction, the target vector slice is locked to prevent other users from issuing instructions to the target vector slice simultaneously. After the existing vector data in the target vector slice is edited and updated according to the instructions, the data in the target vector slice is unlocked.
8. The online data editing method based on a database according to claim 1, characterized in that, The database-based online data editing method also includes: Each time an edit or update is completed, a new timestamp and version number are generated, and the difference data of this round of edits and updates are stored, and the difference data is mapped to the timestamp and version number; When a user needs to revert to a specified historical version, all the difference data between the current version and the specified historical version is obtained as the revert data. The data corresponding to the current version is then processed based on the revert data to obtain the data corresponding to the specified historical version.
9. A database-based online data editing device, characterized in that, The method includes at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor for performing the database-based online data editing method according to any one of claims 1-8.
10. A non-volatile computer storage medium, characterized in that, The computer storage medium stores computer program instructions that, when executed by one or more processors, implement the database-based online data editing method as described in any one of claims 1-8.