Spatial data version processing method and device based on Postgres and readable medium
By creating extended version management tables and branch extension tables in the Postgres database, independent local architecture and version management are implemented, and the problem of binding of spatial data version management and geographic information system in the existing technology is solved, and multiple users are simultaneously edited and automatically conflict processing is realized, reducing data redundancy and management complexity.
Patent Information
- Application Number
- CN202410292195.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-14
- Publication Date
- 2025-03-04
AI Technical Summary
The existing spatial data version management system is bound to the geographic information system, and other systems cannot call the version management function or read data. Moreover, the multi-user synchronous editing management has defects in locking or copying methods, resulting in data redundancy and complex management.
Using Postgres-based spatial data version processing method, by importing vector data of the spatial layer, creating an extended version management table and branch extension table, realizing independent local architecture and version management, and supporting multiple users to edit simultaneously and automatically determine and resolve conflicts.
Different software directly browses and edits spatial data based on Postgres database, without the need to associate data tables, reducing data redundancy and management complexity, and supporting multiple users to edit simultaneously without affecting other users.
Smart Images

Figure CN119557298A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of spatial data processing, and in particular to a spatial data version processing method, device and readable medium based on Postgres. Background Art
[0002] Now many countries' surveying and mapping and geographic information agencies and related departments have completed a large number of basic geographic information databases and other spatial data results. At the same time, the development and application of geographic information systems have also led to the continuous growth of spatial data. Therefore, the storage and management of massive spatial data has become very important and has become a bottleneck in the development of geographic information systems. At present, the existing spatial data storage is not sufficient in version management and may be incompatible with existing systems.
[0003] In order to solve these problems, a suitable version control system can be introduced. The version control system can track and record the modification of data, ensuring that the previous version can be traced back at any time. This not only improves the efficiency of data management, but also reduces the risk of data inconsistency. At present, some geographic information systems have introduced version control and realized version management of data. However, its version control function is bound to the geographic information system. Other systems can neither call the version management function nor read or call these process data, and cannot realize the universality of the version management function.
[0004] The existing spatial data version management has the following shortcomings:
[0005] 1. The version control function is bound to the geographic information system, and other systems cannot call the version management function or read data. Taking the Postgres database as an example, spatial data is saved by layer, and the layer data can be browsed and edited by reading the table data. However, after versioning, obtaining the latest version of data and editing data need to be done through the version management function, otherwise the complete data cannot be obtained. Therefore, other systems cannot directly read or edit data, nor can they call the version management function.
[0006] 2. The editing function of the current version management usually implements multi-user synchronous editing management of data through locking or copying:
[0007] 1) Locking mode: When a user is editing, the data is locked and other users cannot edit at the same time;
[0008] 2) Copy method: back up the data and then edit it, but it will generate a lot of redundant data.
[0009] 3. When managing multiple users, data is integrated into one or more tables and is closely associated with the user information management table, which makes it inconvenient to identify and process data. When deleting a user, it is necessary to delete the associated data in different associated tables, otherwise redundant data will be generated and data errors will occur. Summary of the invention
[0010] In view of the technical problems mentioned above, the purpose of the embodiments of the present application is to propose a spatial data version processing method, device and readable medium based on Postgres to solve the technical problems mentioned in the above background technology part.
[0011] In a first aspect, the present invention provides a spatial data version processing method based on Postgres, comprising the following steps:
[0012] Import the vector data of the spatial layer into the Postgres database, which corresponds to the server architecture, and generate the layer data table;
[0013] Create an extended version management table, add version management related information to the layer data table according to the extended version management table, and obtain the corresponding branch extension table;
[0014] A new current user is created and a corresponding local architecture and local version management table are created. In response to determining to migrate the vector data of the spatial layer to the local architecture corresponding to the current user, the local version management table is updated, and a differential table, a local version view, and a view trigger corresponding to the branch extension table are created. The differential table is used to record the edited content of the current user, and the view trigger is used to edit the vector data of the spatial layer corresponding to the server architecture.
[0015] In response to determining that the current user edits the vector data of the spatial layer in the local architecture, or determining that the data in the branch extension table is updated, conflict judgment and resolution are performed. In response to determining that there is no conflict or the conflict has been resolved, the version number of the corresponding layer in the local version management table is updated, and the version record information corresponding to the current user's editing content is submitted to the branch extension table.
[0016] Preferably, the main fields of the layer data table include feature identifiers, spatial fields and attribute fields, the main fields of the extended version management table include version numbers, remarks, operation time and user ID, version management related information includes the start version number of the current record, the end version number of the current record and the parent primary key number and child primary key number associated therewith, the start version number of the current record corresponds to the version number in the extended version management table, the end version number of the current record indicates the version number when the current record is edited and saved and uploaded to the server architecture, the parent primary key number corresponds to the feature identifier of the source of the current record, indicating that the current record is a new record generated after editing the record corresponding to the feature identifier of the source, the child primary key number indicates the feature identifier of the new record generated after editing the current record, when the start version number of the current record is equal to the end version number of the current record, it means that the corresponding record has been deleted; the main fields of the local version management table are the serial number ID, the maximum value of the version number in the extended version management table when migrating out or updating, the table name, the maximum value of the feature identifier in the branch extension table when migrating out or updating and the migration time, and the main fields of the differential table are the same as the main fields of the extended branch table.
[0017] As a preference, it also includes:
[0018] Create a data browsing architecture, and create a view corresponding to the branch extension table under the data browsing architecture. The view displays the latest version record information.
[0019] Preferably, the local version view displays a collection of information in the branch extension table and the difference table, and the condition for obtaining the record from the difference table is: the end version number in the difference table is empty or the end version number in the difference table is greater than or equal to Maxrev, and the start version number in the difference table is not empty;
[0020] The conditions for obtaining records from the branch extension table are: the start version number in the branch extension table is less than or equal to Maxrev, and the end version number in the branch extension table is empty, or the end version number in the branch extension table is greater than or equal to Maxrev, and the start version number in the branch extension table is not empty;
[0021] Among them, Maxrev is the maximum value of the version number in the extended version management table when migrating out of the local version management table or updating.
[0022] Preferably, the view trigger includes an insert trigger, an update trigger, and a delete trigger corresponding to the local version view.
[0023] As a preferred embodiment, the conflict judgment and resolution process specifically includes:
[0024] Check whether the server version number is greater than the local current version number, where the server version number is the maximum value of the version numbers in the extended version management table, and the local current version number is the version number with the same table name in the local version management table. If so, perform a conflict judgment, otherwise determine that the current user's edited content does not conflict with the edited content of other users;
[0025] Get the data in the difference table and determine whether it is empty. If so, determine whether the edited content of the current user conflicts with the edited content of other users. Otherwise, perform conflict determination.
[0026] Check whether the update table "layer name_update_diff" between the local and server versions exists. If so, clear the update table. The structure of the update table is the same as that of the branch extension table. Otherwise, create the update table.
[0027] Obtain the information difference between the branch extension table and the version record information corresponding to the current user's edited content according to the version number, and save it in the update table;
[0028] Compare the update table with the difference table to determine conflicting information;
[0029] Create a conflict table, generate conflict records based on the conflict information and store them in the conflict table. The conflict table adds a source field and an operation type field based on the branch extension table. The value of the source field is a difference table or a branch extension table, and the value of the operation type field includes edit or delete.
[0030] In response to determining the conflicting record that the user needs to delete in the conflict table, and determining the value of the source field of the conflicting record that needs to be deleted based on the source field in the conflicting record that needs to be deleted, and deleting the record corresponding to the differential table or branch extension table in combination with the operation type field.
[0031] As a preference, it also includes:
[0032] In response to determining that the edited content of the current user does not conflict with the edited content of other users or the conflict has been resolved, adding version number information in the extended version management table according to the difference table, adding update record information in the branch extension table, modifying the original record information, and clearing the difference table;
[0033] Determine whether the data in the branch extension table is updated in the following way:
[0034] Check whether the server version number is larger than the local current version number, where the server version number is the maximum value of the version number in the extended version management table, and the local current version number is the version number with the same table name in the local version management table. If so, it is determined that the data in the branch extension table is updated, otherwise it is determined that the data in the branch extension table is not updated.
[0035] In a second aspect, the present invention provides a spatial data version processing device based on Postgres, comprising:
[0036] The data import module is configured to import the vector data of the spatial layer into a Postgres database corresponding to the server architecture and generate a layer data table;
[0037] The table creation module is configured to create an extended version management table, add version management related information to the layer data table according to the extended version management table, and obtain a corresponding branch extension table;
[0038] The local editing module is configured to create a new current user and a corresponding local architecture and a local version management table. In response to determining to migrate the vector data of the spatial layer to the local architecture corresponding to the current user, the local version management table is updated, and a difference table, a local version view and a view trigger corresponding to the branch extension table are created. The difference table is used to record the editing content of the current user, and the view trigger is used to edit the vector data of the spatial layer corresponding to the server architecture.
[0039] The update submission module is configured to perform conflict judgment and resolution in response to determining that the current user edits the vector data of the spatial layer in the local architecture, or determines that the data in the branch extension table is updated. In response to determining that there is no conflict or the conflict has been resolved, the version number of the corresponding layer in the local version management table is updated, and the version record information corresponding to the current user's editing content is submitted to the branch extension table.
[0040] In a third aspect, the present invention provides an electronic device comprising one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.
[0041] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any implementation manner in the first aspect.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] (1) The advantage of the Postgres-based spatial data version processing method proposed in the present invention is that different software can directly implement data browsing and editing based on the Postgres database without adding or considering the association of data tables. Based on the Postgres database, the latest version of spatial data can be directly read, and the data currently being edited by all users can be read. Each user has an independent architecture space, and the related versions and editing data are independent. The addition and deletion of users will not affect the main version and other users, and different users can perform editing operations at the same time without affecting other users.
[0044] (2) In the Postgres-based spatial data version processing method proposed by the present invention, all user operations are based on the master version and the data to which the user belongs, and no redundant data is required. In addition, the edit records are stored in the user's corresponding architecture space rather than in the memory, and are not affected by the program running state, the master version and other users; the migrated data of different users are displayed in the form of views, which can minimize data redundancy.
[0045] (3) The Postgres-based spatial data version processing method proposed in the present invention adds corresponding triggers to relevant tables and views, thereby realizing both the user's editing operations and the relevant version management functions to be suitable for existing systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 is an exemplary device architecture diagram to which an embodiment of the present application may be applied;
[0048] Figure 2 A schematic diagram of a flow chart of a spatial data version processing method based on Postgres according to an embodiment of the present application;
[0049] Figure 3 This is an overall flow chart of the spatial data version processing method based on Postgres according to an embodiment of the present application;
[0050] Figure 4 A flowchart of conflict judgment and resolution of a spatial data version processing method based on Postgres according to an embodiment of the present application;
[0051] Figure 5A flowchart of data submission of a spatial data version processing method based on Postgres according to an embodiment of the present application;
[0052] Figure 6 The experimental structure of the spatial data version processing method based on Postgres of the embodiment of the present application Figure 1 ;
[0053] Figure 7 The experimental structure of the spatial data version processing method based on Postgres of the embodiment of the present application Figure 2 ;
[0054] Figure 8 A schematic diagram of a spatial data version processing device based on Postgres according to an embodiment of the present application;
[0055] Fig. 9 It is a schematic diagram of the structure of a computer device suitable for implementing the electronic device of the embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0057] Figure 1 An exemplary device architecture 100 is shown to which a Postgres-based spatial data version processing method or a Postgres-based spatial data version processing device according to an embodiment of the present application can be applied.
[0058] like Figure 1 As shown, the device architecture 100 may include a terminal device 1 101, a terminal device 2 102, a terminal device 3 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the terminal device 1 101, the terminal device 2 102, the terminal device 3 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0059] The user can use the terminal device 101, the terminal device 2 102, and the terminal device 3 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various applications, such as data processing applications, file processing applications, etc., can be installed on the terminal device 101, the terminal device 2 102, and the terminal device 3 103.
[0060] Terminal device 1 101, terminal device 2 102, and terminal device 3 103 can be hardware or software. When terminal device 1 101, terminal device 2 102, and terminal device 3 103 are hardware, they can be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc. When terminal device 1 101, terminal device 2 102, and terminal device 3 103 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0061] The server 105 may be a server that provides various services, such as a background data processing server that processes files or data uploaded by the terminal device 101, the terminal device 2 102, and the terminal device 3 103. The background data processing server may process the acquired files or data and generate processing results.
[0062] It should be noted that the Postgres-based spatial data version processing method provided in the embodiment of the present application can be executed by the server 105, and can also be executed by the terminal device 1 101, the terminal device 2 102, and the terminal device 3 103. Accordingly, the Postgres-based spatial data version processing device can be set in the server 105, and can also be set in the terminal device 1 101, the terminal device 2 102, and the terminal device 3 103.
[0063] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided as required. In the case where the processed data does not need to be obtained remotely, the above device architecture may not include a network, but only a server or a terminal device.
[0064] Figure 2 A spatial data version processing method based on Postgres provided in an embodiment of the present application is shown, comprising the following steps:
[0065] S1, import the vector data of the spatial layer into the Postgres database, which corresponds to the server architecture, and generate the layer data table.
[0066] Specifically, refer to Figure 3 , import the vector data into the Postgres database (taking the architecture kingmap as an example), import the data and set the feature identifier to fid, the spatial field to Geom, and the attribute field to Attr to construct the layer data table.
[0067] S2, create an extended version management table, add version management related information in the layer data table according to the extended version management table, and obtain the corresponding branch extension table.
[0068] In a specific embodiment, the main fields of the layer data table include feature identifiers, spatial fields and attribute fields, the main fields of the extended version management table include version numbers, remark information, operation time and user ID, version management related information includes the start version number of the current record, the end version number of the current record and the parent primary key number and child primary key number associated therewith, the start version number of the current record corresponds to the version number in the extended version management table, the end version number of the current record indicates the version number when the current record is edited and saved and uploaded to the server architecture, the parent primary key number corresponds to the feature identifier of the source of the current record, indicating that the current record is a new record generated after editing the record corresponding to the feature identifier of the source, the child primary key number indicates the feature identifier of the new record generated after editing the current record, and when the start version number of the current record is equal to the end version number of the current record, it means that the corresponding record has been deleted; the main fields of the local version management table are the serial number ID, the maximum value of the version number in the extended version management table when migrating out or updating, the table name, the maximum value of the feature identifier in the branch extension table when migrating out or updating, and the migration time, and the main fields of the differential table are the same as the main fields of the extended branch table.
[0069] Specifically, add version management related information to the original coating data sheet, including:
[0070] 1) Create an extended version management table kingmap.revisions, the main fields of which are version number (rev), comment information (commit_msg), operation time (date) and user ID (user id). This extended version management table is used to record version creation and operation information, and also obtain the current latest version number through this table.
[0071] 2) Version the layer data table, that is, add a version management field to the table. The versioned table is a branch extension table of the layer data table. The added fields are:
[0072] trunk_rev_begin: the starting version number of the current record, corresponding to the rev in the extended version management table kingmap.revisions, indicating the version number when the record was created, which cannot be empty;
[0073] trunk_rev_end: The end version number of the current record, which indicates the version number when the record is edited and saved and uploaded to the server. If the end version number is empty, it means that the current record is the latest record; if it is not empty, it means that the current record is deleted or edited at the corresponding version number;
[0074] trunk_parent: corresponds to the element identifier fid of the source of the current record, indicating that this record is a new record generated after the record corresponding to the element identifier fid is edited. If it is empty, it means that the current record is the initial record and has not been edited.
[0075] trunk_child: The fid of the new record generated after the current record is edited. If it is empty, it means that the current record has no child items and no modification or deletion operation has been performed; if it is not empty, the corresponding fid corresponds to the new record generated after the current record is modified.
[0076] Here is an example:
[0077] The current version maximum rev=2, the original branch extension table is shown in Table 1:
[0078] Table 1
[0079]
[0080] Edit the record with fid 3 and save it. The original record with fid 3 is changed to a record with fid 5. The association between the two can be viewed from trunk_parent and trunk_child. The data is shown in Table 2:
[0081] Table 2
[0082] fid Geom Attr trunk_rev_begin trunk_rev_end trunk_parent trunk_child 3 P3 Name3 1 2 5 4 P4U Name4U 2 5 P3U Name3U 2 3
[0083] The data after adding the record with fid 6 is shown in Table 3:
[0084] Table 3
[0085]
[0086] After deleting the record with fid 4, add the trunk_rev_end information corresponding to fid 4. The data is shown in Table 4:
[0087] Table 4
[0088]
[0089] In the above table, Geom represents spatial information and attr represents attribute information. If either of them is modified, it means that the record has been modified.
[0090] trunk_rev_begin becomes 2 because the current version maximum value rev = 2, so the corresponding version number for addition, modification or deletion is 2.
[0091] The change of trunk_rev_begin from 1 to 2 means that this record has been modified, the original record (fid=3) has been deleted, and a new record with fid=6 has been created, and its corresponding trunk_rev_begin value is the maximum value of the current version.
[0092] If trunk_rev_begin is equal to trunk_rev_end, it means that the record has been deleted.
[0093] S3, creates a new current user and creates a corresponding local architecture and local version management table. In response to determining to migrate the vector data of the spatial layer to the local architecture corresponding to the current user, the local version management table is updated, and a differential table, local version view and view trigger corresponding to the branch extension table are created. The differential table is used to record the editing content of the current user, and the view trigger is used to edit the vector data of the spatial layer corresponding to the server architecture.
[0094] In a specific embodiment, it also includes:
[0095] Create a data browsing architecture, and create a view corresponding to the branch extension table under the data browsing architecture. The view displays the latest version record information.
[0096] In a specific embodiment, the local version view displays a collection of information in the branch extension table and the difference table, and the condition for obtaining a record from the difference table is: the end version number in the difference table is empty or the end version number in the difference table is greater than or equal to Maxrev, and the start version number in the difference table is not empty;
[0097] The conditions for obtaining records from the branch extension table are: the start version number in the branch extension table is less than or equal to Maxrev, and the end version number in the branch extension table is empty, or the end version number in the branch extension table is greater than or equal to Maxrev, and the start version number in the branch extension table is not empty;
[0098] Among them, Maxrev is the maximum value of the version number in the extended version management table when migrating out of the local version management table or updating.
[0099] In a specific embodiment, the view trigger includes an insert trigger, an update trigger, and a delete trigger corresponding to the local version view.
[0100] Specifically, create a data browsing architecture (kingmap_trunk_rev_head), and create a view corresponding to the branch extension table under its architecture. The view displays the latest version of the data, that is, the records corresponding to (trunk_rev_begin is notnull and trunk_rev_end is null) in the branch extension table. The view does not need to display the version management field. Among them, trunk_rev_begin is not null means: the starting version number cannot be empty. If it is empty, it means that this record is illegally added or not versioned; trunk_rev_end is null: the ending version number is empty, which means that the record has not been modified or deleted since it was created, that is, it is the latest record.
[0101] The data in the data browsing architecture all correspond to the latest version record information. All geographic information system platforms can obtain the latest data of all layers through this architecture without publishing data separately.
[0102] Create a new user user1 and create the corresponding architecture (work1). Create a local version management table work1.initial_revision, which is used to record the name and version number of the migrated layer. The main fields of the local version management table work1.initial_revision are id (serial number), rev (the maximum rev in the extended version management table kingmap.revisions), table_name (table name), max_pk (the maximum value of the feature identifier fid in the branch extension table) and commit_date (migration time). Rev and max_pk correspond to the version number and feature identifier fid at the time of migration or update. Each layer data in the local version management table corresponds to a record, and each record has a corresponding version number. The same table name indicates the same layer data, and its version number is the local current version number, as shown in Table 5.
[0103] Table 5
[0104]
[0105] The creation process of other users is the same, but they correspond to different schemas. For example, user2 can correspond to schema work2, and its related tables are all saved in work2.
[0106] S4, in response to determining that the current user edits the vector data of the spatial layer in the local architecture, or determining that the data in the branch extension table is updated, conflict judgment and resolution are performed. In response to determining that there is no conflict or the conflict has been resolved, the version number of the corresponding layer in the local version management table is updated, and the version record information corresponding to the current user's editing content is submitted to the branch extension table.
[0107] In a specific embodiment, the conflict judgment and resolution process specifically includes:
[0108] Check whether the server version number is greater than the local current version number, where the server version number is the maximum value of the version numbers in the extended version management table, and the local current version number is the version number with the same table name in the local version management table. If so, perform a conflict judgment, otherwise determine that the current user's edited content does not conflict with the edited content of other users;
[0109] Get the data in the difference table and determine whether it is empty. If so, determine whether the edited content of the current user conflicts with the edited content of other users. Otherwise, perform conflict determination.
[0110] Check whether the update table "layer name_update_diff" between the local and server versions exists. If so, clear the update table. The structure of the update table is the same as that of the branch extension table. Otherwise, create the update table.
[0111] Obtain the information difference between the branch extension table and the version record information corresponding to the current user's edited content according to the version number, and save it in the update table;
[0112] Compare the update table with the difference table to determine conflicting information;
[0113] Create a conflict table, generate conflict records based on the conflict information and store them in the conflict table. The conflict table adds a source field and an operation type field based on the branch extension table. The value of the source field is a difference table or a branch extension table, and the value of the operation type field includes edit or delete.
[0114] In response to determining the conflicting record that the user needs to delete in the conflict table, and determining the value of the source field of the conflicting record that needs to be deleted based on the source field in the conflicting record that needs to be deleted, and deleting the record corresponding to the differential table or branch extension table in combination with the operation type field.
[0115] In a specific embodiment, it also includes:
[0116] In response to determining that the edited content of the current user does not conflict with the edited content of other users or the conflict has been resolved, adding version number information in the extended version management table according to the difference table, adding update record information in the branch extension table, modifying the original record information, and clearing the difference table;
[0117] Determine whether the data in the branch extension table is updated in the following way:
[0118] Check whether the server version number is greater than the local current version number, where the server version number is the maximum value of the version number in the extended version management table, and the local current version number is the version number with the same table name in the local version management table. If so, it is determined that the data in the branch extension table is updated, otherwise it is determined that the data in the branch extension table is not updated.
[0119] Specifically, the vector data of the selected spatial layer is migrated from the server architecture to the architecture work1 corresponding to the current user. Taking the layer kingmap.layer1 as an example, the data migration operation includes: updating the local version management table work1.initial_revision, creating the difference table work1.layer1_diff, and creating the local version view and view trigger. The specific process is as follows:
[0120] 1) Add or update the latest version number rev and the maximum sequence number max_pk of the corresponding record of the layer in the corresponding branch extension table in the local version management table work1.initial_revision;
[0121] 2) Create a difference table work1.layer1_diff corresponding to the branch extension table. The difference table is used to record the user's edited content. The fields of the difference table are the same as those of the corresponding branch extension table. If there is no edited content, the difference table is empty. In addition, after uploading to the server, the difference table will be cleared. Because the modified content has been uploaded to the server, there is no difference between the current and the server.
[0122] 3) Create a local version view corresponding to the branch extension table, whose fields are the same as the main fields of the branch extension table (that is, it does not contain the version management field). The view comes from the data set that meets the conditions in the differential table and the branch extension table corresponding to the layer. Maxrev is the value of the rev field in the local version management table work1.initial_revision. The content of the view is the collection of information in the branch extension table and the differential table.
[0123] The conditions for getting records from the difference table are:
[0124] (trunk_rev_end is null or trunk_rev_end>Maxrev)
[0125] and
[0126] trunk_rev_begin is not null;
[0127] Among them, trunk_rev_end is null or trunk_rev_end>Maxrev means: if the end version number in the differential table is null, it means that the record is newly added or modified; if the end version number in the differential table is greater than or equal to Maxrev, it means that the deleted records and the modified original records are filtered out;
[0128] trunk_rev_begin is not null: The starting version number cannot be empty. If it is empty, it means that this record is illegally added or not versioned.
[0129] The conditions for obtaining records from the branch expansion table are
[0130] (trunk_rev_begin<=Maxrev)
[0131] and
[0132] (trunk_rev_end is null or trunk_rev_end>=Maxrev)
[0133] and
[0134] (trunk_rev_begin is not null)
[0135] Among them, trunk_rev_begin<=Maxrev means: the version number of the created record is less than or equal to the version number of the migrated out record, which means that only the record information with the version number before Maxrev is obtained;
[0136] trunk_rev_end is null or trunk_rev_end>=Maxrev means: if the end version number is null, it means the record has not been modified or deleted since it was created; if the end version number is greater than or equal to Maxrev, it means that the data before the Maxrev version is obtained from the branch extension table, and the data uploaded after that is not included;
[0137] trunk_rev_begin is not null means: the starting version number cannot be empty. If it is empty, it means that this record is illegally added or not versioned.
[0138] 4) Create a local version view trigger to implement data editing. You need to create insert triggers, update triggers, and delete triggers for the local version view. Because the view itself cannot implement insert, update, and delete operations, the local version view trigger can save its operation content to the differential table.
[0139] The update trigger is used to save the update operation information of the view. The modification example of the record with fid 3 is shown in Table 6.
[0140] Table 6
[0141] fid Geom Attr trunk_rev_begin trunk_rev_end trunk_parent trunk_child 3 P Name 1 2 5 5 PU NameU 2 3
[0142] The insert trigger is used to save the new operation information of the view. An example of adding a record with fid 4 is shown in Table 7.
[0143] Table 7
[0144] fid Geom Attr trunk_rev_begin trunk_rev_end trunk_parent trunk_child 4 P Name 2
[0145] The delete trigger is used to save the delete operation information of the view. An example of deleting the record with fid 2 is shown in Table 8.
[0146] Table 8
[0147] fid Geom Attr trunk_rev_begin trunk_rev_end trunk_parent trunk_child 2 P2 Name2 1 2
[0148] Conflict judgment is an important operation performed before users update or submit, which is used to determine whether different users have performed different editing operations on the same or multiple feature objects. This process is explained through a conflict example:
[0149] Assume that there is a spatial layer vector data with version 2. User 1 and User 2 both migrate data from this version and obtain the same data copy.
[0150] After migration, user 1 modified the feature object with fid 6, while user 2 deleted the feature object with fid 6.
[0151] After the update is completed, user 1 first submits the data. At this time, the data submitted by user 1 does not conflict with the data in the branch extension table, so the submission is successful.
[0152] However, after user 1 submitted, user 2 submitted and found that there was a conflict with the object with fid 6. This is because the modification of user 1 conflicted with the deletion of user 2. Similarly, if user 2 submitted first, there would be the same conflict.
[0153] Therefore, it is necessary to confirm which record is saved in the branch extension table as the final record.
[0154] The conflict judgment and resolution process is as follows: Figure 4 As shown:
[0155] 1) First, you need to check whether the server version number (SeverRev) is greater than the local current version number (ClientRev).
[0156] If yes, it means there is updated information that needs to be judged for conflicts. If the two are equal, it means the versions are consistent, no data conflict judgment is needed, and the system exits;
[0157] 2) Get the information in the difference table work1.layer1_diff. If the data in the difference table is empty, there is no conflicting data;
[0158] If the difference table data is not empty, conflict judgment is required;
[0159] 3) Next, you need to check whether the update table "layer name_update_diff" between the local and server versions exists. If it does not exist, you need to create the update table; if it exists, you need to clear the update table. The structure of the update table is the same as the branch extension table;
[0160] 4) Obtain the information difference between the branch extension table and the current user version according to the version number, and save it in the update table;
[0161] 5) Conflict judgment is performed between the update table and the difference table. If there is no conflict information, the information can be updated. However, if there is a conflict, a conflict table work1.layer name_conflict needs to be generated. The fields of the conflict table are obtained from the difference table and the two fields origin and action are added. Origin indicates the source of the record, and its value is local (mine) and branch extension table (theirs); action is the operation type, and its values are edit (modified) and delete (deleted), respectively. There is no new addition, because the new record will not cause a conflict;
[0162] 6) Based on the contents of the conflict table, the current conflict information is displayed in each conflict record, and the user is allowed to delete the conflict record as needed.
[0163] The following is an explanation based on actual data. For the sake of convenience, take layer layer1 as an example, set its server version number SeverRev to 4, and the local current version number ClientRev to 3. Since ServerRev>ClientRev, it is necessary to obtain new information from the server. Its update table work1.layer1_update_diff obtains the information difference from kingmap.layer1, which is actually the record information of trunk_rev_end=3or trunk_rev_begin>3 in the branch extension table. The data of the update table work1.layer1_update_diff is shown in Table 9:
[0164] Table 9
[0165] fid Attr trunk_rev_begin trunk_rev_end trunk_parent trunk_child 1 Name1 3 3 7 4 Name4U 3 3 5 Name3U2 3 3 8 6 Name1-6 4 7 Name1 4 1 8 Name3U2 4 5
[0166] The data of the difference table work1.layer1_diff is shown in Table 10:
[0167] Table 10
[0168] fid Attr trunk_rev_begin trunk_rev_end trunk_parent trunk_child 1 Name1 3 4 4 Name4U 3 4 5 Name3U2 3 4 10 8 9 Name2-6 5 10 Name3U2 5 5
[0169] As shown in the above sample data, the difference table is not empty and conflict judgment is required.
[0170] Comparing the update table with the difference table gives the following results:
[0171] The edited content in the update table is fid(1) is modified to generate fid(7); fid(4) is deleted; fid(5) is modified to fid(8);
[0172] The edited contents in the difference table are: fid(1) is deleted; fid(4) is deleted; fid(5) is modified to generate fid(10).
[0173] From the above, we can determine that the conflicting information in the two tables is fid(1) and fid(5).
[0174] The conflict table work1.layer1_conflict is created to store conflict records. The generated conflict table is shown in Table 11:
[0175] Table 11
[0176]
[0177] Conflicts are resolved through the conflict table, that is, the corresponding conflicting records are deleted through the conflict table. According to the origin field in the conflict table, the source of the conflicting record is determined and the conflicting data is resolved in combination with the action field. The action field is used to identify how the current record was generated, which is convenient for judgment during conflict resolution. The origin field is used to locate the table corresponding to the conflicting record. For example, if the origin field is theirs, the corresponding record in the branch extension table is deleted. If the origin field is mine, the record in the local differential table is deleted. In this way, the conflicting records can be resolved through the conflict table, and the corresponding conflicting records can be deleted according to the value of the origin field, so that the conflict is resolved.
[0178] Since the conflict table contains both attribute information and spatial information, the layer browsing display and editing operations can be directly performed, and the conflict records in the branch extension table and the local difference table can be deleted in combination with the trigger associated with the conflict table.
[0179] Data update is to obtain the latest data from the branch extension table. The specific steps are as follows:
[0180] 1. Check whether the server version number (SeverRev, the server version number is the maximum value of rev in the extended version management table kingmap.revisions, and the kingmap architecture corresponds to the server architecture) is greater than the local current version number (ClientRev, the local current version number is the value of rev with the same table_name in the local version management table work1.initial_revision). If yes, it means there is new data to be updated; if the version numbers are equal, it means there is no update, that is, you can exit the data update process;
[0181] 2. Conflict judgment and resolution are required to prevent conflicts when updating data and ensure data consistency;
[0182] 3. You need to obtain the maximum version number (SeverRev) of rev in the extended version management table kingmap.revisions and update it to the version number corresponding to layer1 in the local version management table work1.initial_revision. This is to update the local version management table so that the correct version number is used when obtaining data.
[0183] After completing the above steps, the data update is complete. Because the view work1.layer1 obtains the record information from the branch extension table kingmap.layer1 according to the version number corresponding to layer1 in the local version management table work1.initial_revision, the data update can be achieved by simply updating the version number.
[0184] After editing the data, the user submits the data to the branch extension table. Before submitting the data, the data needs to be updated first. After the update is completed, the user submits the currently edited content to the branch extension table. The specific process is as follows: Figure 5 As shown:
[0185] 1. Increase the version number in the upgrade extension version management table by 1 to indicate that an update has been made.
[0186] 2. Insert newly added or updated records in the branch extension table: insert the newly added or modified records edited by the user into the branch extension table;
[0187] 3. Update the deleted or modified original records in the branch extension table: perform corresponding operations on the deleted or modified original records edited by the user in the branch extension table, that is, modify the corresponding version management related information;
[0188] 4. Clear the local difference table records to prepare for receiving the difference changes when the next data is submitted;
[0189] 5. Update the version number rev and the maximum sequence number max_pk of the local version management table to achieve synchronous update of local data.
[0190] Taking actual data as an example, suppose you want to submit layer layer1 data with version number 2. In this submission operation, there are editing operations such as adding new records, modifying records, and deleting records.
[0191] The local view work1.layer1 displays the content as shown in Table 12:
[0192] Table 12
[0193] fid Geom Attr 1 P1 Name1 5 P3U Name3U2 4 P4U Name4U
[0194] The corresponding records in the difference table work1.layer1_diff are shown in Table 12:
[0195] Table 13
[0196]
[0197] As shown in Table 13, the edited content implemented is to add a record with FID 4, modify the original FID 3 to generate a record with FID 5, and delete the record with FID 2.
[0198] The extended version management table kingmap.revisions adds new version number information, and the new revision number is rev = 2. As shown in Table 14.
[0199] Table 14
[0200]
[0201]
[0202] Add update record information in the branch extension table kingmap.layer1, insert two records of fid=4 (newly added) and fid=5 (modified based on fid=3) according to the sample data, and the result information is shown in Table 15:
[0203] Table 15
[0204]
[0205] Update the version management related information of the deleted or modified records in the branch extension table kingmap.layer1. Modify the end version number and sub-primary key number of the two records of fid=2 (deleted) and fid=3 (modified) according to the sample data. The result information is shown in Table 16:
[0206] Table 16
[0207]
[0208] Clear the difference table work1.layer1_diff.
[0209] Update the version number and maximum primary key number corresponding to layer1 in the local version management table work1.initial_revision. The results are shown in Table 17 based on the sample data:
[0210] Table 17
[0211] Id rev table_name max_pk commit_date 1 2 layer1 5 current_timestamp
[0212] At this point, data submission is complete.
[0213] Users can obtain the latest record information through data update; when users need to obtain information of a specified version, they can modify the version number corresponding to the layer in the local version management table work1.initial_revision to display the corresponding version information; after editing, users submit the edited data to the branch extension table through the data submission operation. In addition, different systems can obtain the latest record information by browsing the view in the architecture kingmap_trunk_rev_head. So far, the embodiment of the present application has realized the complete process from storage to version management of spatial data.
[0214] The above steps S1-S4 do not necessarily represent the order between the steps, but are represented by step symbols, and the order between the steps can be adjusted.
[0215] In order to verify the Postgres-based spatial data version processing method proposed in the embodiment of the present application, the following experiment was conducted. Import the polyGon layer into the architecture kingmap based on the Postgres database. Then, use the Postgres-based spatial data version processing method proposed in the embodiment of the present application to implement version management of the polyGon layer. In the experiment, the method of the present invention was called by the system in the form of a plug-in. The system created multiple users and allowed them to edit the polyGon layer separately. The system implemented migration, conflict judgment, update and upload processing through the plug-in interface, verifying the correctness of the method proposed in the embodiment of the present application. The results are as follows: Figure 6 and Figure 7 shown.
[0216] Further references Figure 8 As an implementation of the methods shown in the above figures, the present application provides an embodiment of a spatial data version processing device based on Postgres. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0217] The embodiment of the present application provides a spatial data version processing device based on Postgres, including:
[0218] The data import module 1 is configured to import the vector data of the spatial layer into a Postgres database corresponding to the server architecture, and generate a layer data table;
[0219] Table creation module 2 is configured to create an extended version management table, add version management related information to the layer data table according to the extended version management table, and obtain a corresponding branch extension table;
[0220] The local editing module 3 is configured to create a new current user and create a corresponding local architecture and a local version management table. In response to determining to migrate the vector data of the spatial layer to the local architecture corresponding to the current user, the local version management table is updated, and a difference table, a local version view and a view trigger corresponding to the branch extension table are created. The difference table is used to record the editing content of the current user, and the view trigger is used to edit the vector data of the spatial layer corresponding to the server architecture;
[0221] The update submission module 4 is configured to perform conflict judgment and resolution in response to determining that the current user edits the vector data of the spatial layer in the local architecture, or determines that the data in the branch extension table is updated. In response to determining that there is no conflict or the conflict has been resolved, the version number of the corresponding layer in the local version management table is updated, and the version record information corresponding to the current user's editing content is submitted to the branch extension table.
[0222] Reference below Fig. 9 , which shows an electronic device (eg Figure 1 A schematic diagram of the structure of a computer device 900 (a server or terminal device as shown). Fig. 9 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0223] like Fig. 9 As shown, the computer device 900 includes a central processing unit (CPU) 901 and a graphics processing unit (GPU) 902, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 903 or a program loaded from a storage part 909 to a random access memory (RAM) 904. In the RAM 904, various programs and data required for the operation of the computer device 900 are also stored. The CPU 901, GPU 902, ROM 903, and RAM 904 are connected to each other through a bus 905. An input / output (I / O) interface 906 is also connected to the bus 905.
[0224] The following components are connected to the I / O interface 906: an input section 907 including a keyboard, a mouse, etc.; an output section 908 including a display such as a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 909 including a hard disk, etc.; and a communication section 910 including a network interface card such as a LAN card, a modem, etc. The communication section 910 performs communication processing via a network such as the Internet. A drive 911 can also be connected to the I / O interface 906 as needed. A removable medium 912, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 911 as needed, so that a computer program read therefrom is installed into the storage section 909 as needed.
[0225] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 910, and / or installed from a removable medium 912. When the computer program is executed by a central processing unit (CPU) 901 and a graphics processing unit (GPU) 902, the above-mentioned functions defined in the method of the present application are executed.
[0226] It should be noted that the computer-readable medium described in the present application may be a computer-readable signal medium or a computer-readable medium or any combination of the above two. The computer-readable medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor device, device or component, or any combination of the above. More specific examples of computer-readable media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution device, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable medium that can send, propagate or transmit a program for use by or in conjunction with an instruction execution device, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0227] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0228] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the devices, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based device that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0229] The modules involved in the embodiments described in this application may be implemented by software or hardware, and the modules described may also be set in a processor.
[0230] As another aspect, the present application further provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: imports the vector data of the spatial layer into a Postgres database corresponding to the server architecture, generates a layer data table; creates an extended version management table, adds version management related information in the layer data table according to the extended version management table, and obtains a corresponding branch extension table; creates a new current user and creates a corresponding local architecture and a local version management table. In response to determining that the vector data of the spatial layer is migrated to the local architecture corresponding to the current user, the local version management table is updated, and a differential table, a local version view, and a view trigger corresponding to the branch extension table are created. The differential table is used to record the editing content of the current user, and the view trigger is used to edit the vector data of the spatial layer corresponding to the server architecture; in response to determining that the current user edits the vector data of the spatial layer in the local architecture, or determining that the data in the branch extension table is updated, conflict judgment and resolution are performed. In response to determining that there is no conflict or the conflict has been resolved, the version number of the corresponding layer in the local version management table is updated, and the version record information corresponding to the editing content of the current user is submitted to the branch extension table.
[0231] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.
Claims
1. A spatial data version processing method based on Postgres, characterized in that: The following steps are involved: Importing vector data of the spatial layer into a Postgres database corresponding to the server architecture, and generating a layer data table; Create an extended version management table, and add version management related information to the layer data table according to the extended version management table to obtain a corresponding branch extension table; A new current user is created and a corresponding local architecture and local version management table are created. In response to determining to migrate the vector data of the spatial layer to the local architecture corresponding to the current user, the local version management table is updated, and a differential table, a local version view and a view trigger corresponding to the branch extension table are created. The differential table is used to record the editing content of the current user, and the view trigger is used to edit the vector data of the spatial layer corresponding to the server architecture. In response to determining that the current user edits the vector data of the spatial layer in the local architecture, or determining that the data in the branch extension table is updated, conflict judgment and resolution are performed. In response to determining that there is no conflict or the conflict has been resolved, the version number of the corresponding layer in the local version management table is updated, and the version record information corresponding to the current user's editing content is submitted to the branch extension table.
2. The Postgres-based spatial data version processing method according to claim 1, characterized in that: The main fields of the layer data table include feature identifiers, spatial fields and attribute fields. The main fields of the extended version management table include version numbers, remarks, operation time and user ID. The version management related information includes the start version number of the current record, the end version number of the current record and the parent primary key number and child primary key number associated therewith. The start version number of the current record corresponds to the version number in the extended version management table. The end version number of the current record indicates the version number when the current record is edited and saved and uploaded to the server architecture. The parent primary key number corresponds to the feature identifier of the source of the current record, indicating that the current record is a new record generated after editing the record corresponding to the feature identifier of the source. The child primary key number indicates the feature identifier of the new record generated after editing the current record. When the start version number of the current record is equal to the end version number of the current record, it means that the corresponding record has been deleted. The main fields of the local version management table are the sequence ID, the maximum value of the version number in the extended version management table when migrating out or updating, the table name, the maximum value of the feature identifier in the branch extension table when migrating out or updating, and the migration time. The main fields of the difference table are the same as the main fields of the extended branch table.
3. The Postgres-based spatial data version processing method according to claim 1, characterized in that: Also includes: A data browsing architecture is created, and a view corresponding to the branch extension table is created under the data browsing architecture, wherein the view displays the latest version record information.
4. The Postgres-based spatial data version processing method according to claim 2, characterized in that: The local version view displays the set of information in the branch extension table and the difference table, and the condition for obtaining the record from the difference table is: the end version number in the difference table is empty or the end version number in the difference table is greater than or equal to Maxrev, and the start version number in the difference table is not empty; The conditions for obtaining records from the branch extension table are: the start version number in the branch extension table is less than or equal to Maxrev, and the end version number in the branch extension table is empty, or the end version number in the branch extension table is greater than or equal to Maxrev, and the start version number in the branch extension table is not empty; Among them, Maxrev is the maximum value of the version number in the extended version management table when migrating out of the local version management table or updating.
5. The Postgres-based spatial data version processing method according to claim 1, characterized in that: View triggers include insert triggers, update triggers, and delete triggers corresponding to the local version view.
6. The Postgres-based spatial data version processing method according to claim 2, characterized in that: The conflict judgment and resolution process specifically includes: Check whether the server version number is greater than the local current version number, wherein the server version number is the maximum value of the version numbers in the extended version management table, and the local current version number is the version number with the same table name in the local version management table. If so, perform a conflict judgment, otherwise determine that the edited content of the current user does not conflict with the edited content of other users; Obtain the data in the difference table and determine whether it is empty. If so, determine that the edited content of the current user does not conflict with the edited content of other users. Otherwise, perform conflict determination. Check whether the update table "layer name_update_diff" between the local and server versions exists. If so, clear the update table, the structure of which is the same as that of the branch extension table. Otherwise, create the update table. Obtaining information differences between the branch extension table and the version record information corresponding to the current user's edited content according to the version number, and saving the information differences in the update table; Comparing the update table with the difference table to determine conflict information; Creating a conflict table, generating a conflict record according to the conflict information and storing the conflict record in the conflict table, wherein the conflict table adds a source field and an operation type field based on the branch extension table, the value of the source field is a difference table or a branch extension table, and the value of the operation type field includes edit or delete; In response to determining that the user needs to delete the conflict record in the conflict table, and determining the value of the source field of the conflict record to be deleted based on the source field in the conflict record to be deleted, and deleting the record corresponding to the differential table or branch extension table in combination with the operation type field.
7. The Postgres-based spatial data version processing method according to claim 2, characterized in that: Also includes: In response to determining that there is no conflict or the conflict has been resolved, adding version number information to the extended version management table according to the difference table, adding update record information to the branch extension table, modifying the original record information, and clearing the difference table; The following method is used to determine whether the data in the branch extension table is updated: Check whether the server version number is larger than the local current version number, wherein the server version number is the maximum value of the version numbers in the extended version management table, and the local current version number is the version number with the same table name in the local version management table. If so, it is determined that the data in the branch extension table is updated; otherwise, it is determined that the data in the branch extension table is not updated.
8. A spatial data version processing device based on Postgres, characterized in that: include: A data import module is configured to import the vector data of the spatial layer into a Postgres database corresponding to the server architecture, and generate a layer data table; A table creation module is configured to create an extended version management table, add version management related information to the layer data table according to the extended version management table, and obtain a corresponding branch extension table; The local editing module is configured to create a new current user and a corresponding local architecture and a local version management table. In response to determining to migrate the vector data of the spatial layer to the local architecture corresponding to the current user, the local version management table is updated, and a difference table, a local version view and a view trigger corresponding to the branch extension table are created. The difference table is used to record the editing content of the current user, and the view trigger is used to edit the vector data of the spatial layer corresponding to the server architecture. The update submission module is configured to perform conflict judgment and resolution in response to determining that the current user edits the vector data of the spatial layer in the local architecture, or determines that the data in the branch extension table is updated. In response to determining that there is no conflict or the conflict has been resolved, the version number of the corresponding layer in the local version management table is updated, and the version record information corresponding to the current user's editing content is submitted to the branch extension table.
9. An electronic device, comprising: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Database branch management method and device based on geometric perception and medium
CN121117123A
A database branch management method and device based on geometric perception and a medium
CN121117123B