A dynamic and efficient remote sensing image metadata storage and retrieval method

By parsing remote sensing image XML files and constructing a spatiotemporal hybrid index, the problem of laborious field naming and low indexing efficiency in remote sensing image metadata warehousing procedures is solved, and efficient metadata retrieval is achieved.

CN113590894BActive Publication Date: 2024-09-20ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110784795.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-12
Publication Date
2024-09-20
Estimated Expiration
2041-07-12

AI Technical Summary

Technical Problem

The existing remote sensing image metadata warehousing program requires manual naming of fields, which is time-consuming and labor-intensive. It is difficult to dynamically support new types of metadata, and the database indexing efficiency is low, which affects retrieval efficiency.

Method used

By parsing remote sensing image XML files, extracting XML tree node information, realizing batch naming of metadata table fields, and building persistence layer objects based on configuration files and reflection technology, dynamically supporting new types of metadata storage, and building a universal search tree-based Spatiotemporal hybrid index.

Benefits of technology

It implements table field names that are non-repetitive, semantically clear, and short, dynamically supports new types of metadata, and improves retrieval efficiency, which is 4 times higher than a simple spatial index.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113590894B
    Figure CN113590894B
Patent Text Reader

Abstract

The present invention discloses a dynamic and efficient remote sensing image metadata warehousing and retrieval method. The steps are as follows: 1) parse the remote sensing image metadata XML file, obtain XML tree node information, and realize batch naming of metadata table fields; 2) define the persistent layer object as the parsing result based on the one-to-one correspondence between the metadata table and the persistent layer object; 3) write a configuration file, parse and extract the remote sensing image XML file based on the predefined rules in the configuration file, and organize the results in the form of objects; 4) construct a spatiotemporal hybrid index based on a general search tree. This method realizes batch naming of remote sensing image metadata table fields, and uses a configuration file to define parsing rules. It can dynamically support new types of remote sensing image metadata without modifying the warehousing program, and the constructed spatiotemporal hybrid index can improve the metadata retrieval efficiency. The present invention has very important practical application value for the warehousing and retrieval of remote sensing image metadata.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of remote sensing data management, and in particular relates to a dynamic and efficient remote sensing image metadata storage and retrieval method. Background Art

[0002] Remote sensing image metadata includes information about the remote sensing image’s satellite, sensor, cloud cover, imaging time, geographic range, etc.

[0003] In terms of remote sensing image metadata storage and warehousing, we first need to establish a metadata table, then the warehousing program parses the metadata XML file, extracts metadata information and encapsulates it into objects, and finally writes the persistence layer objects into the database. The names of the metadata table fields come from the metadata XML file, and manual naming is time-consuming and laborious. Different metadata files have structural heterogeneity and semantic heterogeneity. In order to support new types of remote sensing image metadata, if the warehousing program is modified, there will be a lot of duplication of work, and the code is not elegant and concise.

[0004] A database index is a data structure used to speed up data retrieval efficiency. Common database indexes include B-tree indexes for fields of comparable types (numeric type, string type, time type, etc.) and spatial indexes for spatial fields. Summary of the invention

[0005] The purpose of the present invention is to overcome the existing deficiencies and provide an efficient remote sensing image metadata storage and retrieval method.

[0006] To achieve the purpose of the present invention, the technical solution provided is as follows:

[0007] An efficient remote sensing image metadata storage and retrieval method, its steps are as follows:

[0008] S1: Parse the remote sensing image metadata XML file, obtain XML tree node information, and implement batch naming of metadata table fields;

[0009] S2: Based on the one-to-one correspondence between the metadata table and the persistence layer object, define the persistence layer object as the parsing result;

[0010] S3: Write a configuration file, parse and extract the remote sensing image XML file based on the predefined rules in the configuration file, organize the results in the form of objects, and complete the storage of remote sensing image metadata;

[0011] S4: Based on the general search tree, a spatiotemporal hybrid index is constructed for the metadata table after storage for remote sensing image metadata retrieval.

[0012] Preferably, the specific method of step S1 is as follows:

[0013] S11: recursively extract the XPaths of all leaf nodes in the XML tree corresponding to the metadata file. During the recursive process, if the current node is a leaf node, the XPath is added to the result list. Otherwise, recursively access each child node of the current node until the XPaths of all leaf nodes are added to the result list.

[0014] S12: traverse all XPaths in the result list to find whether there is an XPath with a duplicate name. If there is, rename the XPath with the duplicate name while keeping the total number and order of the XPaths in the result list unchanged. The renaming method is: for all XPaths corresponding to each duplicate name, rename them by appending an underscore and a number that increases from 0 to the end of the XPath;

[0015] S13: On the premise that the total number and order of XPaths in the result list remain unchanged, each XPath is truncated, and it is ensured that the truncated string does not conflict with other strings; the truncation method is: the leaf node tag name at the end of the current XPath is reserved as the truncated name, if the reserved name does not conflict with the reserved name of other XPaths, the reserved name is used as the reserved name after the current XPath is truncated, if there is a conflict, the tag name of the previous level in the current XPath is added in front of the current reserved name as a prefix content;

[0016] S14: For all names after XPath truncation, remove the leading forward slash, convert the internal forward slashes to underscores, convert all letters to lowercase, and finally obtain the database field name that meets the underscore naming method.

[0017] Preferably, the specific method of step S2 is as follows:

[0018] S21: Use the MyBatis-Plus code generator for each metadata table to automatically generate the corresponding persistence layer object as the parsing result through the preset global configuration, data source configuration, package configuration and strategy configuration.

[0019] Preferably, the specific method of step S3 is as follows:

[0020] S31: Write a configuration file for each type of remote sensing image metadata file, and organize the configuration information in the form of key-value pairs, where the key is the attribute name of the persistence layer object and the value is the XPath of the corresponding metadata information in the XML document tree after being processed by S1;

[0021] S32: Based on the Class information, a persistence layer object is constructed using reflection technology;

[0022] S33: Traverse each entry of the configuration file, obtain the key-value pair information, locate the metadata content information in the metadata XML file according to XPath, locate the corresponding field in the persistence layer object according to the object attribute name, then obtain the field type and perform type conversion on the metadata content information, use reflection technology to assign values ​​to the attributes of the persistence layer object, and complete the storage of remote sensing image metadata.

[0023] Preferably, the specific method of step S4 is as follows:

[0024] S41: according to the retrieval requirements, determine the time field and space field in the metadata table after storage that need to be indexed;

[0025] S42: Based on the general search tree GiST, a spatiotemporal mixed index is constructed, in which the spatial field determined in S41 is used as the first field of the composite index, and the remote sensing image metadata time field is used as the second field of the composite index.

[0026] Compared with the prior art, the present invention has the following beneficial effects:

[0027] The present invention proposes a field batch naming algorithm, which can extract node information from remote sensing image XML files, and after a series of conversions, obtain table field names with non-repetitive, semantically clear, brief, and underline naming characteristics. The present invention uses a configuration file to guide the metadata parsing process, and realizes dynamic support for new types of remote sensing image metadata without modifying the storage program. The present invention proposes a spatiotemporal hybrid index based on a universal search tree, which improves the retrieval efficiency by 4 times compared to a simple spatial index. The present invention provides a demonstration and reference for remote sensing image metadata storage retrieval. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a flow chart of a dynamic and efficient remote sensing image metadata storage method;

[0029] Figure 2 Write an example for the configuration file applicable to GF1 remote sensing image metadata;

[0030] Figure 3 Comparison of metadata comprehensive retrieval time under different index combinations (the horizontal axis in the figure is a logarithmic scale). DETAILED DESCRIPTION

[0031] The present invention will be further described and illustrated below in conjunction with the accompanying drawings and specific implementation methods.

[0032] like Figure 1 As shown in FIG. 1 , a flowchart of an efficient remote sensing image metadata storage and retrieval method provided in a preferred embodiment of the present invention is shown, and its main steps include 4 steps, namely S1 to S4:

[0033] S1: Parse the remote sensing image metadata XML file, obtain XML tree node information, and implement batch naming of metadata table fields;

[0034] S2: Based on the one-to-one correspondence between the metadata table and the persistence layer object, define the persistence layer object as the parsing result;

[0035] S3: Write a configuration file, parse and extract the remote sensing image XML file based on the predefined rules in the configuration file, organize the results in the form of objects, and complete the storage of remote sensing image metadata;

[0036] S4: Based on the general search tree, a spatiotemporal hybrid index is constructed for the metadata table after storage for remote sensing image metadata retrieval.

[0037] The specific implementation of S1 to S4 in this embodiment and their effects are described in detail below.

[0038] First, the remote sensing image file is organized in the form of a compressed package, which contains a remote sensing image metadata file in XML format. The metadata information is stored in the leaf nodes of the XML document tree.

[0039] In step S1 of this embodiment, field information is extracted from the metadata XML file according to S11 to S14:

[0040] S11: recursively extracting XPaths of all leaf nodes in the XML tree corresponding to the metadata file. Specifically, during the recursive process, if the current node is a leaf node, the XPath is added to the result list; otherwise, each child node of the current node is recursively accessed until the XPaths of all leaf nodes are added to the result list;

[0041] S12: Traverse all XPaths in the result list to find out whether there are XPaths with duplicate names. If there are, rename the XPaths with duplicate names while keeping the total number and order of XPaths in the result list unchanged. The renaming method is: for all XPaths corresponding to each duplicate name, rename them by appending an underscore and a number that increases from 0 to the end of the XPath. For example, if there are three duplicate field names "field" in the result list obtained by path name extraction, they are named "field_0", "field_1", and "field_2" in sequence.

[0042] In the specific implementation of S12, the renaming process can be implemented through LinkedHashSet (hereinafter referred to as Set) and HashMap (hereinafter referred to as Map):

[0043] LinkedHashSet implements the collection interface. The underlying data structure is a hash table and a doubly linked list. The doubly linked list saves the order in which elements are inserted into the collection. Therefore, LinkedHashSet can be used to save the calculation results. In addition, HashMap can be used to save conflict information, where the key is a string type to record the conflict field name, and the value is an integer type to record the number of conflicts. The specific renaming process is as follows:

[0044] 1) First, perform a round of traversal on the input field name list. For each field name, if the name is already in the Set, it means that a name conflict has occurred. The number of conflicts that have occurred is obtained from the Map, and the renamed field name is added to the Set. After the number of conflicts is increased by one, the information is recorded in the Map; if the name is not in the Set, the field name is directly added to the Set. After this round of traversal, all conflicting field names are recorded in the Map key, and the field names in the Set have been deduplicated.

[0045] 2) Create another dynamic list to store the output results, and perform a round of traversal on the Set. For each field name in the Set, if the key in the Map contains the name, it means that the field name is the first of the repeated field names. Rename it (add _0 to the end) and add it to the result list; otherwise, just add the field name to the result list. Assuming there are three repeated field names "field", if there is no last step (referring to the step of adding _0 at the end), the output results are "field", "field_1", "field_2". After adding this step, the output results are the expected "field_0", "field_1", "field_2".

[0046] S13: Under the premise that the total number and order of XPaths in the result list remain unchanged, each XPath is truncated, and it is ensured that the truncated string does not conflict with other strings; the truncation method is: the leaf node tag name at the end of the current XPath is reserved as the truncated name, if the reserved name does not conflict with the reserved name of other XPaths, then the reserved name is used as the reserved name after the current XPath is truncated, as long as there is a conflict, the tag name of the previous level in the current XPath is added in front of the current reserved name as the prefix content. It should be noted that the prefix content added when there is a conflict is carried out step by step. If it is judged that there is a conflict, a prefix content is added, and it is continuously progressed until there is no conflict. The granularity of the prefix content added in each step is a word separated by two adjacent forward slashes in XPath, corresponding to a level in the XML document.

[0047] Similarly, in the specific implementation process of S13 above, the truncation process can be implemented through LinkedHashMap and HashMap:

[0048] LinkedHashMap implements the mapping interface. The underlying data structure is a hash table and a doubly linked list. The doubly linked list saves the order in which elements are inserted into the collection. Therefore, LinkedHashMap can be used to save the calculation results. The key is the string before truncation, and the value is the string after truncation. In addition, a HashMap can be used to save string grouping information. The key is the string suffix representing the grouping standard, and the value is a list of input strings under the current group. The specific truncation process is as follows:

[0049] If the size of the string list of the current group is 1, it means that the current grouping standard meets the requirement of non-conflict of names. The only string in the list is used as the key and the grouping standard string is used as the value to update the LinkedHashMap. If the size of the string list of the current group is greater than 1, the grouping standard string is extended to the left to calculate the string list under the current grouping standard. Repeat the above logic until all strings are truncated.

[0050] S14: For all names after XPath truncation, remove the leading forward slash, convert the internal forward slashes to underscores, convert all letters to lowercase, and finally obtain the database field name that meets the underscore naming method.

[0051] The specific implementation of S14 above can use StringBuilder to save the calculation results. The specific steps are as follows:

[0052] Iterate over each character in the name string, ignoring the leading forward slash. If the character is a lowercase letter, number, or underscore, append it directly to the StringBuilder; if the character is an uppercase letter, convert it to lowercase and append it to the StringBuilder. In particular, if the previous character is a lowercase letter, append an underscore before appending the current lowercase character; if the current character is a forward slash, append an underscore to the StringBuilder.

[0053] In this embodiment, the specific method of defining the persistence layer object in step S2 is as follows:

[0054] S21: Use the MyBatis-Plus code generator for each metadata table to automatically generate the corresponding persistence layer object as the parsing result through the preset global configuration, data source configuration, package configuration and strategy configuration.

[0055] MyBatis is a mainstream persistence layer framework. MyBatis-Plus only enhances MyBatis without making any changes. The present invention uses the code generator function of MyBatis-Plus, and the specific usage of the code generator is as follows:

[0056] S211: Construct a code generator object.

[0057] S212: Set global configuration, including the output directory of generated files, whether to overwrite existing files, whether to open the output directory, whether to add secondary cache configuration in XML, author information, whether to enable Kotlin mode, whether to enable swagger2 mode, whether to enable ActiveRecord mode, whether to enable BaseResultMap, time type corresponding strategy, enable baseColumnList, file name method for each layer, and specify the ID type of the generated primary key.

[0058] S213: Data source configuration, including driver name, driver connection URL, database connection user name, database connection password, mode name, etc.

[0059] S214: Package configuration, including parent package name, module name, Entity package name, Service package name, Service Impl package name, Mapper package name, Mapper XML package name, Controller package name, etc.

[0060] S215: Strategy configuration, including whether to capitalize the name, whether to skip the view, whether it is a chain model, the naming strategy of mapping the database table to the entity, the naming strategy of mapping the database table field to the entity, whether it is a lombok model, whether to generate a Rest-style controller, the table name that needs to be included, the table prefix, the optimistic lock attribute name, the full name of the custom inherited Entity class, the full name of the custom inherited Controller class, etc.

[0061] S216: Execute the code generator.

[0062] In this embodiment, the specific method of step S3 is as follows:

[0063] S31: Write a configuration file for each type of remote sensing image metadata file, and organize the configuration information in the form of key-value pairs, where the key is the attribute name of the persistent layer object, and the value is the XPath obtained after the corresponding metadata information is processed by S1 in the XML document tree (i.e., renaming and truncation, etc.). Figure 2 The following is an example of a configuration file written for the core retrieval object of high-score data GF1.

[0064] Reflection provides a program with the ability to access, detect, and modify its own behavior during operation. The java.lang.reflect class package organizes interfaces and classes related to reflection. The present invention subsequently uses reflection technology to dynamically create objects when the program is running, as well as dynamically assign values ​​to object attributes. The classes involved are Class and Field.

[0065] S32: Based on the Class information, use reflection technology and the newInstance method to construct a persistence layer object;

[0066] S33: Traverse each entry of the configuration file, obtain the key-value pair information, locate the metadata content information in the metadata XML file according to XPath, locate the corresponding field in the persistence layer object according to the object attribute name, then obtain the field type and perform type conversion on the metadata content information, use reflection technology to assign values ​​to the attributes of the persistence layer object, and complete the storage of remote sensing image metadata.

[0067] In this embodiment, the specific method of step S4 is as follows:

[0068] S41: According to the retrieval requirements, determine the time field and space field in the metadata table after storage that need to be indexed.

[0069] S42: Based on the general search tree GiST, a spatiotemporal mixed index is constructed, in which the spatial field determined in S41 is used as the first field of the composite index, and the remote sensing image metadata time field is used as the second field of the composite index.

[0070] When establishing a composite index, in order to ensure the efficiency of the index, a field with high discrimination needs to be used as the first index field. From left to right, the discrimination of the index field gradually decreases. The spatiotemporal mixed index includes both the time field and the space field, and is a composite index. In the present invention, after optimization, it is determined that the composite index uses the space field as the first field and the time field as the second field, which can achieve the highest retrieval efficiency.

[0071] In this spatiotemporal hybrid index mode, the SQL search statement example is as follows: CREATE INDEX index_name ONtable_name USING GIST(column1,column2), where the index name is index_name, the table name is table_name, the spatial field is column1, and the time field is column2.

[0072] Based on the above embodiment method, the method is applied to a specific example to demonstrate its effect.

[0073] The experimental data comes from the prod_gf1 table in the high-resolution remote sensing image data, which contains the remote sensing image metadata of three types of satellites: GF1, GF2, and GF4. The comprehensive retrieval experiment aims to build a suitable index for metadata comprehensive query. The comprehensive query contains both non-spatial conditions and spatial conditions. The query statement refers to the retrieval of GF1 metadata in the architecture experiment, and the corresponding table name can be modified. The experiment is carried out on the prod_gf1_core table. The comprehensive retrieval experiment compares and analyzes the following four types of index construction schemes: 1. Only one attribute index is built; 2. Only one spatial index is built; 3. Build attribute index and spatial index separately, and combine the two indexes based on bitmap when searching; 4. Build a spatiotemporal hybrid index.

[0074] In this embodiment, for 1.65 million GF1 remote sensing image metadata, the retrieval conditions include satellite, sensor, cloud cover, time, target area, and retrieval time under various indexing situations. Among them, receivetime is the time field, geom is the spatial field, GiST is a general search tree, SP-GiST is a spatially partitioned general search tree, B-tree is a classic B-tree index, and "+" indicates that the database index engine uses a bitmap to combine two independent indexes. GiST (geom, reveivetime) is a spatiotemporal hybrid index proposed by the present invention, that is, the spatial field is in front of the composite index and the time field is in the back. GiST (geom, reveivetime) is also another spatiotemporal hybrid index, that is, the time field is in front of the composite index and the spatial field is in the back. The SQL statement for retrieval is as follows:

[0075] SELECT name,satelliteid,sensorid,cloudpercent,receivetime

[0076] FROM prod_gf124_undivided--Modify the table name here

[0077] WHERE satelliteid = 'GF1'

[0078] AND sensorid = 'WFV1'

[0079] AND(cloudpercent BETWEEN 0AND 20)

[0080] AND(receivetime BETWEEN'2013-01-01'AND'2013-12-31')

[0081] AND ST_INTERSECTS(geom,

[0082] 'SRID=4326;POLYGON((119.92924907554418 30.38541942714027,

[0083] 120.3645823274973 30.38541942714027,

[0084] 120.3645823274973 30.128010821917673,

[0085] 119.92924907554418 30.128010821917673,

[0086] 119.92924907554418 30.38541942714027))')

[0087] Figure 3 The metadata comprehensive retrieval time under the above various index combinations is shown. By comparing and observing the data in the figure, it can be concluded that: in terms of retrieval efficiency, the solution of constructing a spatiotemporal hybrid index (the spatial field is the first index field) in the present invention is the best, followed by constructing only one spatial index (GiST or SP-GiST), and then combining the B-tree index and the spatial index. The performance of constructing only the B-tree index is poor, and no index is the worst choice.

[0088] The above-described embodiment is only a preferred solution of the present invention, but it is not intended to limit the present invention. A person skilled in the relevant technical field may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, any technical solution obtained by equivalent replacement or equivalent transformation falls within the protection scope of the present invention.

Claims

1. A dynamic and efficient remote sensing image metadata retrieval method, characterized in that: Its steps are as follows: S1: Parse the remote sensing image metadata XML file, obtain XML tree node information, and implement batch naming of metadata table fields; S2: Based on the one-to-one correspondence between the metadata table and the persistence layer object, define the persistence layer object as the parsing result; S3: Write a configuration file, parse and extract the remote sensing image XML file based on the predefined rules in the configuration file, organize the results in the form of objects, and complete the storage of remote sensing image metadata; S4: Based on the general search tree, a spatiotemporal hybrid index is constructed for the metadata table after storage, which is used for remote sensing image metadata retrieval; The specific method of step S1 is as follows: S11: recursively extract the XPaths of all leaf nodes in the XML tree corresponding to the metadata file. During the recursive process, if the current node is a leaf node, the XPath is added to the result list. Otherwise, recursively access each child node of the current node until the XPaths of all leaf nodes are added to the result list. S12: traverse all XPaths in the result list to find whether there is an XPath with a duplicate name. If there is, rename the XPath with the duplicate name while keeping the total number and order of the XPaths in the result list unchanged. The renaming method is: for all XPaths corresponding to each duplicate name, rename them by appending an underscore and a number that increases from 0 to the end of the XPath; S13: On the premise that the total number and order of XPaths in the result list remain unchanged, a truncation operation is performed on each XPath, and it is ensured that the truncated string does not conflict with other strings; the specific method of the truncation operation is: the leaf node tag name at the end of the current XPath is reserved as the truncated name, and if the reserved name does not conflict with the reserved names of other XPaths, the reserved name is used as the reserved name after the current XPath is truncated, and if there is a conflict, the tag name of the previous level in the current XPath is added in front of the current reserved name as a prefix content; S14: For all names after XPath truncation, remove the leading forward slash, convert the internal forward slashes to underscores, convert all letters to lowercase, and finally obtain the database field name that meets the underscore naming method; The specific method of step S2 is as follows: S21: Use the MyBatis-Plus code generator for each metadata table to automatically generate the corresponding persistence layer object as the parsing result through the preset global configuration, data source configuration, package configuration and strategy configuration; The specific method of step S3 is as follows: S31: Write a configuration file for each type of remote sensing image metadata file, and organize the configuration information in the form of key-value pairs, where the key is the attribute name of the persistence layer object and the value is the XPath of the corresponding metadata information in the XML document tree after being processed by S1; S32: Based on the Class information, a persistence layer object is constructed using reflection technology. Reflection provides a program with the ability to access, detect and modify its own behavior state during operation. The reflection technology enables dynamic creation of objects and dynamic assignment of object attributes during program operation. The classes involved are Class class and Field class. S33: Traverse each entry of the configuration file, obtain the key-value pair information, locate the metadata content information in the metadata XML file according to XPath, locate the corresponding field in the persistence layer object according to the object attribute name, then obtain the field type and perform type conversion on the metadata content information, use reflection technology to assign values ​​to the attributes of the persistence layer object, and complete the storage of remote sensing image metadata.

2. The remote sensing image metadata storage and retrieval method according to claim 1, characterized in that: The specific method of step S4 is as follows: S41: according to the retrieval requirements, determine the time field and space field in the metadata table after storage that need to be indexed; S42: Based on the general search tree GiST, a spatiotemporal mixed index is constructed, in which the spatial field determined in S41 is used as the first field of the composite index, and the remote sensing image metadata time field is used as the second field of the composite index.