A method and tool for batch generation of COS-2 metadata of high-resolution satellite images

By automating the processing of high-resolution satellite image data to generate COS-2 metadata, the problem of low efficiency and error-proneness in manual operations is solved, achieving efficient and accurate metadata generation, which is suitable for large data volumes and high timeliness requirements.

CN117349241BActive Publication Date: 2026-08-25CHINA CENT FOR RESOURCES SATELLITE DATA & APPL
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311257341.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-26
Publication Date
2026-08-25
Estimated Expiration
2043-09-26

AI Technical Summary

Technical Problem

The current process of generating COS-2 metadata for Gaofen series satellite images relies on manual operation, which results in a large workload, low efficiency, and a high risk of errors, and cannot meet the requirements of large data volume and high timeliness.

Method used

An automated approach is adopted, using multiple logic processors to decompress satellite image packages in parallel, generating COS-2 metadata, including data preparation, decompression, reading auxiliary XML files, constructing target XML files, generating thumbnail files, and providing automated tools for batch processing.

Benefits of technology

It streamlines and automates the metadata generation process, significantly improving work efficiency, reducing manual intervention, ensuring accuracy, and processing speed is 4.6 times faster than manual operation, avoiding human error.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117349241B_ABST
    Figure CN117349241B_ABST
Patent Text Reader

Abstract

The application relates to a kind of high-resolution satellite image COS-2 metadata batch automatic generation method and tool, comprising: satellite image data preparation;Specify the file name to be decompressed, the decompression of image compression package specified file is carried out simultaneously by multiple logic processors, satellite image auxiliary xml file, satellite image browsing chart are obtained;Read the content of decompressed satellite image auxiliary xml file, build the value corresponding relationship between target xml key node and satellite image auxiliary xml file node, carry out character processing and numerical calculation, determine the value of target xml key node, create and generate target xml file;Satellite image browsing chart resampling, generate COS-2 thumbnail file;Delete auxiliary xml file and browsing chart file, only keep target xml file and COS-2 thumbnail file.The application solves the problem that all high-resolution satellite image COS-2 metadata generation is completed by manual processing at present, reduces artificial repetitive labor, improves the efficiency and accuracy of processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of remote sensing image processing and computer technology, and relates to a method and tool for batch automatic generation of COS-2 metadata for high-resolution satellite images. Background Technology

[0002] The International Charter for Space and Major Disasters (Charter) is one of the most successful international disaster reduction organizations in the world. Officially launched on November 1, 2000, the Charter has provided remote sensing satellite emergency monitoring and satellite data international humanitarian assistance for more than 830 major natural disasters worldwide.

[0003] COS-2 is the operational system platform for Charter organizations. All remote sensing satellite data provided for Charter's international disaster reduction activities must be uploaded to the COS-2 platform for users to download and use. Before each satellite image is uploaded to the COS-2 platform, it must undergo special processing to meet the platform's requirements and specifications: that is, it must have a metadata XML (eXtensible Markup Language) file that strictly corresponds to the data, as well as two compliant image thumbnail files.

[0004] Currently, my country provides Charter with high-resolution satellite image data, and the generation of metadata XML files and thumbnail files for each satellite image is all done entirely manually according to the following steps:

[0005] (1) Use a professional decompression tool (such as WinRAR) to decompress all files contained in the entire satellite standard product compressed package, including image TIFF files, auxiliary files, etc.

[0006] (2) Open the auxiliary files of satellite data in the decompressed folder, read the relevant content of the auxiliary XML file (hereinafter referred to as "source XML file"), organize and perform certain calculations, manually edit the COS-2 metadata XML file (hereinafter referred to as "target XML file"), fill in the values ​​of the corresponding text nodes and save;

[0007] (3) Generate two image thumbnail files, PREVIEW.jpg and ICON.jpg. This involves using professional image processing software to open the image viewer file within the compressed package, resampling the image to generate an image of the specified pixel size, and naming the file according to the specified format.

[0008] The generation process of the aforementioned target XML file and two thumbnail files has significant problems: 1. The entire process is done manually, resulting in a large workload, long processing time, low efficiency, and a high risk of errors due to manual operation; 2. As the spatial resolution of satellite images increases, the compressed files of standard remote sensing satellite data products are becoming increasingly large, requiring more and more time to decompress all the data; 3. As the amount of remote sensing data provided increases, such as when dozens or even hundreds of scenes are provided at once, the traditional manual method of generating metadata cannot meet the timeliness requirements due to its low efficiency. Summary of the Invention

[0009] The technical problem solved by this invention is to address the various issues existing in the current method of generating COS-2 metadata for high-resolution satellite images entirely by manual processing. This invention proposes a method and tool for batch automatic generation of COS-2 metadata for high-resolution satellite images, which reduces repetitive manual labor, saves time and manpower, and significantly improves work efficiency and accuracy.

[0010] The solution of this invention is as follows: Firstly, a method for batch automatic generation of COS-2 metadata for high-resolution satellite imagery is proposed, comprising the following steps:

[0011] Step 1: Prepare satellite image data. Save the compressed image packages that meet the quality requirements to the same folder.

[0012] Step 2: Specify the file name to be decompressed, and use multiple logic processors to simultaneously decompress the specified file of the image compression package to obtain satellite image auxiliary XML file and satellite image browsing map;

[0013] Step 3: Read the contents of the decompressed satellite image auxiliary XML file, construct the value correspondence between the target XML key nodes and the nodes of the satellite image auxiliary XML file, perform character processing and numerical calculations, determine the values ​​of the target XML key nodes, create the target XML file and assign values ​​to the key nodes, and complete the target XML file generation; the target XML file is a COS-2 metadata XML file.

[0014] Step 4: Resample the satellite image browsing map to generate COS-2 thumbnail files;

[0015] Step 5: Delete the satellite image auxiliary XML file and the satellite image browsing map file, keeping only the generated target XML file and the COS-2 thumbnail file.

[0016] Furthermore, step 2 includes:

[0017] S201. Obtain the save path of the image compressed package;

[0018] S202. Traverse all image compressed file files under the path and determine whether the compressed file is in tar.gz format;

[0019] S203. If the compressed file is not in tar.gz format, no processing is performed, and the process returns to S202. If the compressed file is in tar.gz format, a separate folder is created for each compressed file, the filename and extension of the specified decompressed file are constructed, all logical processors on the local machine are called, and the decompression function is used to decompress the specified file.

[0020] Furthermore, in step 2, the selection of satellite image auxiliary XML files in the files to be decompressed is as follows: for XML files in the compressed package that contain both panchromatic and multispectral sensors, only the XML file corresponding to the multispectral sensor is selected.

[0021] The satellite image browsing image is selected as follows: a JPG file of the browsing image from the multispectral sensor.

[0022] Furthermore, the process of constructing the specified decompressed file name and extension includes:

[0023] For a certain satellite PMS sensor, the auxiliary XML file name and extension are: compressed file name + "MSS*.xml", and the view image file name and extension are: compressed file name + "MSS*.jpg"; where the * value is the same as the first character after PMS in the compressed file name;

[0024] For a certain satellite WFV sensor, the auxiliary XML file name and extension are: compressed file name + ".xml", and the view image file name and extension are: compressed file name + ".jpg";

[0025] For a certain satellite's UFS and SL sensors, the auxiliary XML file name and extension are: compressed file name + "meta.xml", and the view image file name and extension are: compressed file name + ".jpg";

[0026] For a certain satellite's FSI and SS sensors, the auxiliary XML file name and extension are: compressed file name + "meta.xml", and the view image file name and extension are: from the beginning of the compressed file name to the first "L2" character followed by 3 characters + from the 6th character after "L2" to the end of the file name + ".jpg".

[0027] Furthermore, step 3, which involves constructing the value correspondence between the target XML key nodes and the satellite image auxiliary XML file nodes, and performing character processing and numerical calculations, includes:

[0028] Select the nodes in the target XML file that need to be assigned values ​​as key nodes. Based on the physical meaning of the key nodes, find the nodes with the corresponding physical meaning in the satellite image auxiliary XML file, obtain the specific information contained in the found nodes, and assign the values ​​to the corresponding key nodes.

[0029] The process of obtaining the specific information contained in the found nodes includes the following cases:

[0030] The value of the node is directly taken and assigned to the corresponding key node;

[0031] The satellite name and sensor type are determined, and values ​​are assigned to key nodes based on the determination results;

[0032] According to the data requirements of COS-2, perform character processing and / or numerical calculations on the node values, and assign the processing results to the corresponding key nodes.

[0033] Furthermore, the character processing includes: obtaining the latitude and longitude coordinates of the four corner points of the image, processing the data bit depth according to the COS-2 format requirements, arranging the data according to the COS-2 order requirements, and obtaining a list of coordinates of the four corner points of the image that meets the requirements.

[0034] Furthermore, the numerical calculation includes calculating the coordinates of the image center point:

[0035] For satellites whose image center latitude and longitude can be directly obtained, read the data directly. <center>under the node <latitude>and <longitude>The value;

[0036] Otherwise, calculate according to the following method:

[0037] Lat center =((Lat) TL +Lat TR ) / 2+(Lat BR +Lat BL ) / 2) / 2

[0038] Among them, Lat center Lat represents the latitude of the image center point. TL Lat represents the latitude of the top left corner of the image. TR Lat represents the latitude of the top right corner of the image. BR Lat represents the latitude of the bottom right corner of the image. BL The latitude of the bottom left corner of the image;

[0039] Lon center =((Lon TL +Lon TR ) / 2+(Lon BR +Lon BL ) / 2) / 2

[0040] Among them, Lon center Longitude of the image center point, Lon TL The longitude of the top left corner of the image, Lon TR The longitude of the top right corner of the image, Lon BR The longitude of the bottom right corner of the image, Lon BL The longitude is the bottom left corner of the image.

[0041] Furthermore, the generation of the target XML file includes:

[0042] Create a root element node with a namespace;

[0043] Set the namespace of the root element node;

[0044] Create each child node of the root element node as a second-level node;

[0045] Create the third-level nodes to the deepest level nodes of each child node, and assign values ​​to the key nodes covered in the third-level nodes to the deepest level nodes;

[0046] All node content is written to the target XML file and used directly for COS-2 input.

[0047] Furthermore, the resampling of the satellite image browsing map includes:

[0048] The `resize` function from the `image` module of the Python PIL library is used to perform a resampling conversion from a satellite image view to a COS-2 thumbnail.

[0049] Secondly, a tool for batch automatic generation of COS-2 metadata for high-resolution satellite imagery is provided, including: an automatic data decompression module, a metadata XML reading and writing module, a thumbnail generation module, and a post-processing module;

[0050] Automatic data decompression module: Used to specify the file name to be decompressed, and use multiple logic processors to simultaneously decompress the specified file of the image compression package to obtain satellite image auxiliary XML file and satellite image browsing map;

[0051] The metadata XML read / write module is used to read the contents of the satellite image auxiliary XML file decompressed by the data automatic decompression module, construct the value correspondence between the target XML key nodes and the nodes of the satellite image auxiliary XML file, perform character processing and numerical calculations, determine the values ​​of the target XML key nodes, and create and generate the target XML file; the target XML file is a COS-2 metadata XML file.

[0052] The thumbnail generation module is used to resample the satellite image browsing map and generate remote sensing image data thumbnail files that meet the COS-2 requirements;

[0053] The post-processing module is used to delete satellite image auxiliary XML files and satellite image browsing map files, retaining only the final target XML file and COS-2 thumbnail files.

[0054] The advantages of this invention compared to the prior art are:

[0055] (1) The present invention realizes the process of generating remote sensing data metadata in a streamlined and automated manner. Users only need to click a button once to specify the storage location of the data, and the metadata can be generated quickly without any subsequent manual intervention, which greatly improves work efficiency.

[0056] (2) In the decompression stage, the present invention calls all the logic processors supported by the machine to participate in the calculation, and multi-threaded parallel processing is used. The higher the computer CPU configuration and the more logic processors it supports, the faster the processing speed.

[0057] (3) The present invention selectively processes only specific files in the remote sensing image data compressed package, such as only decompressing image auxiliary xml files and image jpg files, and does not decompress large TIFF image files, which greatly saves data processing time.

[0058] (4) The metadata generated by this invention has high accuracy, and the metadata information can be 100% accurate. It can effectively avoid the problem of errors that are easy to occur in the manual processing process and does not require any manual review.

[0059] (5) Use Figure 1 The 14 test scenes shown were processed in actual tests, covering all sensors of GF1, GF2, GF3, and GF4 satellites. The test machine used 8 logic processors and 8GB of memory. The total processing time was 0:03:53.541047 seconds. Based on a manual operation of 6 minutes per scene, the manual operation would take 84 minutes, while the time using this invention is only 4.6% of the manual operation time. The results show that the method of this invention can significantly improve processing efficiency. Attached Figure Description

[0060] Figure 1 List of data used for testing the treatment effect of this invention;

[0061] Figure 2 This invention provides a workflow for the rapid generation of metadata for high-resolution satellite images.

[0062] Figure 3 The COS-2 metadata XML (target XML) file must contain the following content;

[0063] Figure 4 Examples of key node names, formats, and values ​​for COS-2 metadata XML (target XML);

[0064] Figure 5 This is an example of the decompression result of a specified file implemented in this invention;

[0065] Figure 6 This is the target XML generation workflow implemented in this invention;

[0066] Figure 7 This is the COS-2 metadata output file automatically generated by this invention;

[0067] Figure 8 This is the COS-2 metadata XML file implemented in this invention;

[0068] Figure 9a The image shown is a thumbnail of the COS-2 metadata implemented in this invention.

[0069] Figure 9b The image shown is a thumbnail of the COS-2 metadata implemented in this invention. Detailed Implementation

[0070] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0071] First, let's define the concepts involved in this invention:

[0072] Satellite imagery archives: High-resolution satellite imagery products are stored and provided in compressed archives with the extension .tar.gz. These archives typically contain image data files (*.tiff), satellite imagery auxiliary files (xml format), view images (*.jpg), thumbnail images (*_thumb.jpg), and RPC parameter files (*.rpb).

[0073] Satellite image auxiliary XML files are data describing satellite image data, presented as an XML file. Generally, each high-resolution satellite image corresponds to at least one XML file, stored within a satellite image compressed package. The file content mainly includes information such as satellite name, imaging time, reception time, orbit, scene serial number, product serial number, processing level, space reference frame, and image latitude and longitude range.

[0074] Target XML file: This refers to the final COS-2 metadata XML file implemented in this invention, specifically containing the following content: Figure 3 As shown.

[0075] Furthermore, the working process of the present invention will be described in detail.

[0076] This invention proposes a method for batch automatic generation of COS-2 metadata for high-resolution satellite imagery. The workflow is as follows: Figure 2 As shown, it includes the following 5 steps:

[0077] Step 1: Prepare satellite image data. Save the compressed image packages that meet the quality requirements to the same folder.

[0078] Step 2: Specify the file name to be decompressed, and use multiple logic processors to simultaneously decompress the specified file of the image compression package to obtain satellite image auxiliary XML file and satellite image browsing map;

[0079] Step 3: Read the contents of the decompressed satellite image auxiliary XML file, construct the value correspondence between the target XML key nodes and the nodes of the satellite image auxiliary XML file, perform character processing and numerical calculations, determine the values ​​of the target XML key nodes, create the target XML file and assign values ​​to the key nodes, and complete the target XML file generation; the target XML file is a COS-2 metadata XML file.

[0080] Step 4: Resample the satellite image browsing map to generate COS-2 thumbnail files;

[0081] Step 5: Delete the satellite image auxiliary XML file and the satellite image browsing map file, keeping only the generated target XML file and the COS-2 thumbnail file.

[0082] Example 1

[0083] Step 1: Satellite image data preparation

[0084] This includes querying and downloading satellite images, saving image packages that meet quality requirements to the same folder, and storing all images in the form of compressed packages (tar.gz compressed files).

[0085] Step 2: Quickly extract the specified files from the satellite image compressed package.

[0086] In this embodiment, step 2 is implemented using a software tool developed in Python. To quickly decompress the image archive, the software tool's specific functions include: obtaining the save path of the image product archive, traversing all image archive files under that path, determining if the archive file is in tar.gz format, creating a separate folder for each archive if so, constructing the filename and extension of the specified decompressed file, and finally decompressing the specified file by calling all logical processors on the local machine; otherwise, the archive file is not processed. Among these, constructing the filename and extension of the specified decompressed file and calling all logical processors to execute the decompression of the specified file are the key aspects of this invention.

[0087] 1) Create a filename for the specified decompressed file:

[0088] Traditionally, manually decompressing image files typically involves using specialized decompression software (such as WinRAR) to manually extract all files from the compressed archive at once. This method is time-consuming and inefficient.

[0089] This invention completely overhauls the traditional manual method, decompressing only a small number of specified files. It pre-builds the filenames (including file extensions) for the decompressed files, then directly calls the decompression function within the program to perform the decompression, automating the entire process. Because it only decompresses a small number of files, execution efficiency is significantly improved, offering a clear advantage.

[0090] This invention requires the decompression of two files: one is a satellite image auxiliary XML file; for compressed packages containing XML files from both panchromatic and multispectral sensors, only the multispectral XML file is extracted; the other is a satellite image browsing image, specifically a JPG file representing the multispectral sensor image. The file names (including file extensions) are constructed as follows:

[0091] ①GF1 satellite PMS sensor

[0092] View image file name Compressed file name + "MSS*.jpg"

[0093] The value of * is 1 or 2, determined by the 8th character of the compressed file (i.e., the first character after PMS in the compressed file name). If the 8th character is 1, then the value of * is 1; if the 8th character is 2, then the value of * is 2.

[0094] like Figure 1 The compressed file in the file:

[0095] GF1_PMS2_E119.0_N34.6_20210620_L1A0005710451.tar.gz

[0096] Auxiliary XML file:

[0097] GF1_PMS2_E119.0_N34.6_20210620_L1A0005710451-MSS2.xml,

[0098] View image file name:

[0099] GF1_PMS2_E119.0_N34.6_20210620_L1A0005710451-MSS2.jpg.

[0100] ②GF1 satellite WFV sensor

[0101] View image file name Compressed file name + ".jpg"

[0102] ③GF2 satellite PMS sensor

[0103] View image file name Compressed file name + "MSS*.jpg"

[0104] The value of * is 1 or 2, determined by the 8th character of the compressed file (i.e., the first character after PMS in the compressed file name). If the 8th character is 1, then the value of * is 1; if the 8th character is 2, then the value of * is 2.

[0105] ④ GF3 satellite UFS and SL sensors

[0106] View image file name Compressed file name + ".jpg"

[0107] ⑤GF3 satellite FSI and SS sensors

[0108]

[0109] ⑥ GF4 satellite

[0110] View image file name: "GF4_PMS_"+*+".jpg"

[0111] * is taken from the 9th character of the compressed file name to the end of the file name. For example... Figure 1 The compressed file in the file:

[0112] GF4_PMI_E123.9_N10.9_20220416_L1A0000489772.tar.gz,

[0113] The compressed file is named GF4_PMI_E123.9_N10.9_20220416_L1A0000489772;

[0114] *The value is: E123.9_N10.9_20220416_L1A0000489772;

[0115] The auxiliary XML file name is:

[0116] GF4_PMS_E123.9_N10.9_20220416_L1A0000489772.xml;

[0117] The file name of the image file is:

[0118] GF4_PMS_E123.9_N10.9_20220416_L1A0000489772.jpg.

[0119] 2) The logic processor performs decompression of the specified file.

[0120] This invention has been tested in practice. In the data decompression stage, the decompression process is fastest when the number of processes in the thread pool is set to the number of logical processors, as shown in the following code snippet.

[0121] from multiprocessing.dummy import Pool

[0122] import psutil

[0123] nm_logcpu = psutil.cpu_count() # nm_logcpu: Number of local logical processors

[0124] print(str(nm_logcpu)+" CPU logical processors participated in the calculation!)

[0125] pool=Pool(processes=nm_logcpu)

[0126] pool.map(decompress,files_list)

[0127] Here, `decompress` is the function that is called to automatically perform decompression; `files_list` contains the paths and filenames of all image archives with the extension `.tar.gz` in the directory.

[0128] An example of the decompression result of the specified file implemented by this invention is attached. Figure 5 As shown.

[0129] Step 3: Generate COS-2 metadata XML file

[0130] The COS-2 metadata XML (target XML) file must contain the following content: (see attached) Figure 3 As shown. The process of generating the target XML is as follows.

[0131] (1) Determine the key node values ​​of the COS-2 metadata XML file

[0132] Examples of key node names, formats, and assignments for COS-2 metadata XML files (i.e., target XML files) are attached. Figure 4 As shown, the values ​​of these nodes need to be referenced from the satellite image auxiliary XML file, which is read from the satellite image auxiliary XML file decompressed in step 2.

[0133] This invention establishes the value correspondence between the COS-2 metadata XML file and the satellite image auxiliary XML file (i.e., the data source of these node values) and implements a feasible processing procedure, including:

[0134] Select the nodes in the target XML file that need to be assigned values ​​as key nodes. Based on the physical meaning of the key nodes, find the nodes with the corresponding physical meaning in the satellite image auxiliary XML file, obtain the specific information contained in the found nodes, and assign the values ​​to the corresponding key nodes.

[0135] The process of obtaining the specific information contained in the found nodes includes the following cases:

[0136] A. Directly take the value of the node and assign it to the corresponding key node;

[0137] B. Determine the satellite name and sensor type, and assign values ​​to key nodes based on the determination results;

[0138] C. Perform character processing and / or numerical calculations on the node values ​​according to the COS-2 data requirements, and assign the processing results to the corresponding key nodes. Specifically, as shown in the table below.

[0139]

[0140]

[0141] Among them, number 8 retrieves the coordinate list. <gml:poslist>The values ​​need to be processed, including: obtaining the latitude and longitude coordinates of the four corner points of the image, processing them according to the COS-2 format requirements, arranging them according to the COS-2 order requirements, and obtaining a list of coordinates of the four corner points of the image that meets the requirements.

[0142] Among them, the coordinate nodes of the image center point of sequence number 12 <gml:pos>Approximate values ​​need to be calculated.

[0143] For GF1, GF2, and GF4 satellites, the calculation is performed according to the following formula:

[0144] Lat center =((Lat) TL +Lat TR ) / 2+(Lat BR +Lat BL ) / 2) / 2

[0145] Among them, Lat center Lat represents the latitude of the image center point. TL The latitude of the top left corner of the image, the value is taken from... <topleftlatitude>Node; Lat TR The latitude of the top right corner of the image, the value is taken from... <toprightlatitude>Node; Lat BR The latitude of the bottom right corner of the image, the value is taken from... <bottomrightlatitude>Node; Lat BL The latitude of the bottom left corner of the image, the value is taken from... <bottomleftlatitude>node.

[0146] Lon center =((Lon TL +Lon TR ) / 2+(Lon BR +Lon BL ) / 2) / 2

[0147] Among them, Lon center Longitude of the image center point, Lon TL The longitude of the top left corner of the image, the value is taken from... <topleftlongitude>Node; Lon TR The longitude of the top right corner of the image, the value is taken from... <toprightlongitude>Node; Lon BR The longitude of the bottom right corner of the image is taken from... <bottomrightlongitude>Node; Lon BL The longitude of the bottom left corner of the image is taken from... <bottomleftlongitude>node.

[0148] GF3 satellite Lat center and Lon center No calculation required, just read directly. <center>under the node <latitude>and <longitude>The value is sufficient.

[0149] (2) Create and generate the target XML file

[0150] Appendix Figure 6 This invention describes the target XML generation workflow, including:

[0151] Step 1: Create a root element node with a namespace;

[0152] Step 2: Set the namespace for the root element node;

[0153] Step 3: Create each child node of the root element node as a second-level node;

[0154] Step 4: Create the third-level nodes to the deepest level nodes of each child node, and assign values ​​to the key nodes covered in the third-level nodes to the deepest level nodes;

[0155] Step 5: Write all node content into the target XML file for direct use in COS-2 input.

[0156] Steps 1 and 2 create the root element node, as follows: Figure 8 As shown in line 2 of the code.

[0157] Subsequent steps implemented child nodes from the second level to the deepest level, with examples of key child nodes of the root element node as follows:

[0158] 1) Create the root element node, its child node gml:metaDataProperty, and its child nodes at all levels.

[0159] This section implements the addition of child nodes at all levels of gml:metaDataProperty, as well as the creation and assignment of text.

[0160]

[0161] Wherein, the xxx part corresponds to <eop:identifier> 、 <eop:parentidentifier> 、 <eop:processinglevel> 、 <eop:nativeproductformat> 、 <eop:projection>For text type nodes, nodes are created using the key node values ​​determined in step 3 (program number 1, sequence number 10, sequence number 9, and sequence number 11). This completes the creation and assignment of values ​​for all key nodes in this section. <eop:parentidentifier>The value is a fixed value: urn:ogc:def:EOP:CNSA.

[0162] 2) Create the root element node, its child node gml:validTime, and its child nodes.

[0163] This section implements the addition of child nodes at all levels of gml:validTime, as well as the creation and assignment of text nodes.

[0164]

[0165] Among them, the two xxx parts correspond to <gml:beginposition> 、 <gml:endposition>For text-type element nodes, create nodes using the key node values ​​determined by process number 2 and sequence number 3 in step 3.

[0166] 3) Create the root element node, child nodes of gml:using, and their child nodes at all levels.

[0167] This section implements the addition of child nodes at all levels of gml:using, as well as the creation and assignment of text nodes.

[0168]

[0169] in, <eop:platform>Below <eop:shortname> 、 <eop:instrument>Below <eop:shortname> 、 <eop:operationalmode>For text-type element nodes, create nodes using the key node values ​​determined by process number 5, sequence number 6, and sequence number 7 in step 3.

[0170] 4) Create the root element node, its child node gml:target, and its child nodes at all levels.

[0171] This section implements the addition of child nodes at all levels of gml:target, as well as the creation and assignment of text nodes.

[0172]

[0173]

[0174] in, <gml:poslist>and <gml:pos>For text-type element nodes, create nodes using the key node values ​​determined by process number 8 and sequence number 12 in step 3.

[0175] After creating all the nodes, the final step was to generate the target XML file and write the content of all nodes in the file, forming a target XML file that can be directly used for input to COS-2.

[0176] The COS-2 metadata XML file implemented in this invention is attached. Figure 8 As shown.

[0177] Step 4: Generate COS-2 thumbnail files

[0178] Using the `resize` function from the `image` module of the Python PIL library, we perform a resampling conversion from an image viewer to a COS-2 thumbnail. The code is as follows:

[0179] import Image from PIL

[0180] img = Image.open(picturefile)

[0181] img_size=img.resize((500,500),Image.NEAREST)

[0182] img_size.save(path+" / "+"PREVIEW.jpg","JPEG")

[0183] print("PREVIEW.jpg"+"Generated")

[0184] img2=Image.open(picturefile)

[0185] img_size=img2.resize((100,100),Image.NEAREST)

[0186] img_size.save(path+" / "+"ICON.jpg","JPEG")

[0187] print("ICON.jpg"+"Generated")

[0188] An example of the COS-2 metadata thumbnail implemented by this invention is shown in Figure 9.

[0189] Step 5: Delete the satellite image auxiliary XML file and the satellite image browsing map file.

[0190] Steps 1 through 4 complete the creation of the target XML file and image thumbnails. At this point, the auxiliary XML file and image file extracted in step 2 have completed their tasks. This step involves deleting these two files. Ultimately, each extracted folder will contain only one COS metadata XML file and two thumbnail files, as shown in the attached file. Figure 7 As shown.

[0191] Example 2

[0192] This embodiment provides a tool for batch automatic generation of COS-2 metadata for high-resolution satellite images, including: an automatic data decompression module, a metadata XML reading and writing module, a thumbnail generation module, and a post-processing module.

[0193] Automatic data decompression module: Used to specify the file name to be decompressed, and use multiple logic processors to simultaneously decompress the specified file of the image compression package to obtain satellite image auxiliary XML file and satellite image browsing map;

[0194] The metadata XML read / write module is used to read the contents of the satellite image auxiliary XML file decompressed by the data automatic decompression module, construct the value correspondence between the target XML key nodes and the nodes of the satellite image auxiliary XML file, perform character processing and numerical calculations, determine the values ​​of the target XML key nodes, and create and generate the target XML file; the target XML file is a COS-2 metadata XML file.

[0195] The thumbnail generation module is used to resample the satellite image browsing map and generate remote sensing image data thumbnail files that meet the COS-2 requirements;

[0196] The post-processing module is used to delete satellite image auxiliary XML files and satellite image browsing map files, retaining only the final target XML file and COS-2 thumbnail files.

[0197] In summary, this invention employs an automated, one-click, and rapid processing method to process high-resolution satellite image data and generate metadata in batches and automatically. Automation here refers to the near-complete automation of the metadata generation process, requiring no manual intervention in intermediate processing and supporting batch automated processing, significantly shortening metadata processing time and greatly improving work efficiency. Most importantly, the final output of this processing method is the direct input to the COS-2 platform, requiring no intermediate modifications or final local corrections, truly achieving automated and rapid processing. Another advantage of this method is that the processing results are entirely completed by the computer according to a pre-defined algorithm, ensuring 100% accuracy and effectively avoiding errors caused by manual operation.

[0198] This invention can automatically process and generate COS-2 metadata and thumbnail files for Gaofen series satellites, such as Gaofen-1 (GF1), Gaofen-2 (GF2), Gaofen-3 (GF3), and Gaofen-4 (GF4) satellite data. The more remote sensing satellite data scenes there are, the more obvious the advantages become.

[0199] Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make possible changes and modifications to the technical solutions of the present invention by utilizing the methods and techniques disclosed above without departing from the spirit and scope of the present invention. Therefore, any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solutions of the present invention shall fall within the protection scope of the technical solutions of the present invention.< / gml:pos> < / gml:poslist> < / eop:operationalmode> < / eop:shortname> < / eop:instrument> < / eop:shortname> < / eop:platform> < / gml:endposition> < / gml:beginposition> < / eop:parentidentifier> < / eop:projection> < / eop:nativeproductformat> < / eop:processinglevel> < / eop:parentidentifier> < / eop:identifier> < / longitude> < / latitude> < / center> < / bottomleftlongitude> < / bottomrightlongitude> < / toprightlongitude> < / topleftlongitude> < / bottomleftlatitude> < / bottomrightlatitude> < / toprightlatitude> < / topleftlatitude> < / gml:pos> < / gml:poslist> < / longitude> < / latitude> < / center>

Claims

1. A method for batch automatic generation of COS-2 metadata for high-resolution satellite imagery, characterized in that, Includes the following steps: Step 1: Prepare satellite image data. Save the compressed image packages that meet the quality requirements to the same folder. Step 2: Specify the file name to be decompressed, and use multiple logic processors to simultaneously decompress the specified file of the image compression package to obtain satellite image auxiliary XML file and satellite image browsing map; Step 3: Read the contents of the decompressed satellite image auxiliary XML file, construct the value correspondence between the target XML key nodes and the nodes of the satellite image auxiliary XML file, perform character processing and numerical calculations, determine the values ​​of the target XML key nodes, create the target XML file and assign values ​​to the key nodes, and complete the target XML file generation; the target XML file is a COS-2 metadata XML file. Step 4: Resample the satellite image browsing map to generate COS-2 thumbnail files; Step 5: Delete the satellite image auxiliary XML file and the satellite image browsing map file, keeping only the generated target XML file and the COS-2 thumbnail file; Step 2 specifically includes: S201. Obtain the save path of the image compressed package; S202. Traverse all image compressed file files under the path and determine whether the compressed file is in tar.gz format; S203. If the compressed file is not in tar.gz format, no processing is performed, and the process returns to S202. If the compressed file is in tar.gz format, a separate folder is created for each compressed file, the file name and extension of the specified decompressed file are constructed, all logical processors on the local machine are called, and the decompression function is used to decompress the specified file. The filename and extension of the specified decompressed file to be constructed include: For a certain satellite PMS sensor, the auxiliary XML file name and extension are: compressed file name + "MSS*.xml", and the view image file name and extension are: compressed file name + "MSS*.jpg"; where * is the same as the first character after PMS in the compressed file name; For a certain satellite WFV sensor, the auxiliary XML file name and extension are: compressed file name + ".xml", and the view image file name and extension are: compressed file name + ".jpg"; For a certain satellite's UFS and SL sensors, the auxiliary XML file name and extension are: compressed file name + "meta.xml", and the view image file name and extension are: compressed file name + ".jpg"; For a certain satellite's FSI and SS sensors, the auxiliary XML file name and extension are: compressed file name + "meta.xml", and the view image file name and extension are: from the beginning of the compressed file name to the first "L2" character followed by 3 characters + from the 6th character after "L2" to the end of the file name + ".jpg"; Step 3 involves constructing the value correspondence between the target XML key nodes and the satellite image auxiliary XML file nodes, and performing character processing and numerical calculations, including: Select the nodes in the target XML file that need to be assigned values ​​as key nodes. Based on the physical meaning of the key nodes, find the nodes with the corresponding physical meaning in the satellite image auxiliary XML file, obtain the specific information contained in the found nodes, and assign the values ​​to the corresponding key nodes. The process of obtaining the specific information contained in the found nodes includes the following cases: The value of the node is directly taken and assigned to the corresponding key node; The satellite name and sensor type are determined, and values ​​are assigned to key nodes based on the determination results; According to the data requirements of COS-2, the values ​​of the nodes are processed by characters and numerical calculations, and the processing results are assigned to the corresponding key nodes; The target XML file generation process includes: Create a root element node with a namespace; Set the namespace of the root element node; Create each child node of the root element node as a second-level node; Create the third-level nodes to the deepest level nodes of each child node, and assign values ​​to the key nodes covered in the third-level nodes to the deepest level nodes; All node content is written to the target XML file and used directly for COS-2 input.

2. The method for batch automatic generation of COS-2 metadata for high-resolution satellite imagery according to claim 1, characterized in that, In step 2, the selection of satellite image auxiliary XML files in the files to be decompressed is as follows: for XML files in the compressed package that contain both panchromatic and multispectral sensors, only the XML file corresponding to the multispectral sensor is selected. The satellite image browsing image is selected as follows: a JPG file of the browsing image from the multispectral sensor.

3. The method for batch automatic generation of COS-2 metadata for high-resolution satellite imagery according to claim 1, characterized in that, The character processing includes: obtaining the latitude and longitude coordinates of the four corner points of the image, processing the data bit depth according to the COS-2 format requirements, arranging the data according to the COS-2 order requirements, and obtaining a list of coordinates of the four corner points of the image that meets the requirements.

4. The method for batch automatic generation of COS-2 metadata for high-resolution satellite imagery according to claim 1, characterized in that, The numerical calculation includes calculating the coordinates of the image center point: For satellites whose image center latitude and longitude can be directly obtained, read the data directly. <center>under the node <latitude>and <longitude> The value;< / longitude> < / latitude> < / center> Otherwise, calculate according to the following method: Lat center =(( Lat TL + Lat TR ) / 2+( Lat BR + Lat BL ) / 2) / 2 in, Lat center The latitude of the image center point. Lat TL The latitude of the top left corner of the image. Lat TR The latitude of the top right corner of the image. Lat BR The latitude of the bottom right corner of the image. Lat BL The latitude of the bottom left corner of the image; Lon center =(( Lon TL + Lon TR ) / 2+( Lon BR + Lon BL ) / 2) / 2 in, Lon center The longitude of the image center point. Lon TL The longitude is the top left corner of the image. Lon TR The longitude is the top right corner of the image. Lon BR The longitude is the bottom right corner of the image. Lon BL The longitude is the bottom left corner of the image.

5. The method for batch automatic generation of COS-2 metadata for high-resolution satellite imagery according to claim 1, characterized in that, The resampling of the satellite image browsing map includes: The `resize` function from the `image` module of the Python PIL library is used to perform a resampling conversion from a satellite image view to a COS-2 thumbnail.

6. A tool for batch automatic generation of COS-2 metadata for high-resolution satellite imagery based on the method described in any one of claims 1 to 5, characterized in that, include: Automatic data decompression module, metadata XML read / write module, thumbnail generation module, post-processing module; The automatic data decompression module is used to specify the file name to be decompressed. It uses multiple logic processors to simultaneously decompress the specified file of the image compression package to obtain satellite image auxiliary XML file and satellite image browsing map. The metadata XML read / write module is used to read the content of the satellite image auxiliary XML file decompressed by the automatic data decompression module, construct the value correspondence between the target XML key nodes and the nodes of the satellite image auxiliary XML file, perform character processing and numerical calculations, determine the values ​​of the target XML key nodes, and create and generate the target XML file; the target XML file is a COS-2 metadata XML file; The thumbnail generation module is used to resample the satellite image browsing map and generate remote sensing image data thumbnail files that meet the COS-2 requirements; The post-processing module is used to delete satellite image auxiliary XML files and satellite image browsing map files, retaining only the final target XML file and COS-2 thumbnail files.

Citation Information

Patent Citations

  • Gaofen-3 satellite data conversion method and device based on SNAP architecture

    CN112988934A

  • User-defined remote sensing image metadata storage method

    CN115033569A