Dynamic optimization method, device, equipment, medium and product of grid structure
By adding flag bits to the raster structure and dynamically adjusting the memory space, the problem of ineffective memory space utilization caused by fixed-length metadata is solved, realizing dynamic optimization of memory space and meeting the needs of data computation and storage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUHAN DAMENG DATABASE
- Filing Date
- 2025-09-26
- Publication Date
- 2026-08-04
AI Technical Summary
The fixed length of metadata in existing raster data types leads to inefficient use of memory space, making it impossible to record data exceeding a given memory limit, and the memory space cannot be dynamically adjusted according to data calculation and storage needs.
By adding flags to the grid structure, the memory space can be dynamically adjusted to expand or shrink the memory space of the target attribute to meet computing and storage needs. The flags are used to indicate the dynamic optimization of the memory space.
It enables dynamic adjustment of memory space based on data computation and storage needs, ensuring both data computation and storage while effectively utilizing memory space.
Smart Images

Figure CN121233595B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, device, medium, and product for dynamic optimization of grid structures. Background Technology
[0002] Currently, commonly used raster data types consist of fixed-length metadata plus bands. The metadata includes information such as georegistration, acquisition date, sensor type, and band wavelength, while a band is composed of a series of pixel arrays, with each pixel having a value. Fixed-length metadata has the following limitations: it cannot record data exceeding the original given memory limit; and the memory space allocated to the metadata is not effectively utilized. Summary of the Invention
[0003] This invention provides a method, apparatus, device, medium, and product for dynamic optimization of grid structures, which enables dynamic adjustment of memory space according to data calculation and storage needs, ensuring both data calculation and storage and effective utilization of memory space.
[0004] Firstly, this embodiment provides a dynamic optimization method for a grid structure, the method comprising:
[0005] Obtain raster data, which is stored in an original raster structure. A flag bit is added to the initial position of the original raster structure, and the flag bit is used to indicate that the original memory space of the original raster structure is dynamically optimized.
[0006] During the calculation of the raster data, if the original memory space of the target attribute in the original raster structure meets the first memory update condition, then the original memory space of the target attribute is expanded and the flag bit is modified.
[0007] After the calculation of the raster data is completed, if the original memory space of the target attribute in the original raster structure meets the second memory update condition, then the original memory space of the target attribute is reduced and the flag bit is modified.
[0008] Secondly, this embodiment provides a dynamic optimization device for a grid structure, the device comprising:
[0009] The data acquisition module is used to acquire raster data, which is stored in an original raster structure. A flag bit is added to the initial position of the original raster structure, and the flag bit is used to indicate that the original memory space of the original raster structure is dynamically optimized.
[0010] The memory expansion module is used to expand the original memory space of the target attribute and modify the flag bit if the original memory space of the target attribute in the original raster structure meets the first memory update condition during the calculation of the raster data.
[0011] The memory shrinking module is used to shrink the original memory space of the target attribute and modify the flag bit after the calculation of the raster data is completed, if the original memory space of the target attribute in the original raster structure meets the second memory update condition.
[0012] Thirdly, this embodiment provides an electronic device, including:
[0013] At least one processor; and
[0014] A memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the dynamic optimization method for the grid structure according to any embodiment of the present invention.
[0016] Fourthly, this embodiment provides a computer-readable storage medium storing computer instructions that cause a processor to execute a dynamic optimization method for a grid structure as described in any embodiment of the present invention.
[0017] Fifthly, embodiments of the present invention also provide a computer program product, the computer program product including a computer program, which, when executed by a processor, implements the dynamic optimization method for grid structures as described in any embodiment of the present invention.
[0018] This invention provides a method, apparatus, device, medium, and product for dynamic optimization of a raster structure. The method includes: acquiring raster data, storing the raster data using an original raster structure, adding a flag bit to the initial position of the original raster structure, the flag bit indicating dynamic optimization of the original memory space of the original raster structure; during the calculation of the raster data, if the original memory space of the target attribute in the original raster structure meets a first memory update condition, then the original memory space of the target attribute is expanded and the flag bit is modified; after the calculation of the raster data is completed, if the original memory space of the target attribute in the original raster structure meets a second memory update condition, then the original memory space of the target attribute is reduced and the flag bit is modified. This technical solution employs a new dynamic raster structure. When the data to be recorded exceeds the original given memory limit, the memory for storing this data can be expanded. After the calculation is completed, the memory can also be appropriately reduced according to the used memory space, realizing dynamic adjustment of the raster structure's memory space according to data calculation and storage needs, ensuring both data calculation and storage and effective utilization of memory space.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is an example diagram of a traditional PostGIS grid structure;
[0022] Figure 2 This is an example diagram showing the specific construction content of the serialization and deserialization structures in traditional PostGIS;
[0023] Figure 3 This is a flowchart illustrating a dynamic optimization method for a grid structure provided in Embodiment 1 of the present invention;
[0024] Figure 4 This is an example diagram of the original grid structure during the execution of a grid structure optimization method according to Embodiment 1 of the present invention;
[0025] Figure 5This is an example diagram illustrating the specific construction content of the original serialized structure and the original deserialized structure during the execution of an optimization method for a grid structure, as provided in Embodiment 1 of the present invention.
[0026] Figure 6 This is another example diagram of the original grid structure in the execution of a grid structure optimization method provided in Embodiment 1 of the present invention;
[0027] Figure 7 This is another example diagram illustrating the specific construction content of the original deserialized structure during the execution of an optimization method for a grid structure, as provided in Embodiment 1 of the present invention.
[0028] Figure 8 This is an example diagram of an expanded grid structure provided in Embodiment 1 of the present invention during the execution of a grid structure optimization method;
[0029] Figure 9 This is an example diagram illustrating the specific construction content of the expanded serialized structure and the expanded deserialized structure in the execution of an optimization method for a grid structure according to Embodiment 1 of the present invention.
[0030] Figure 10 This is a flowchart illustrating another dynamic optimization method for a grid structure provided in Embodiment 2 of the present invention;
[0031] Figure 11 This is a flowchart illustrating another dynamic optimization method for a grid structure provided in Embodiment 3 of the present invention;
[0032] Figure 12 This is a schematic diagram of a dynamic optimization device for a grid structure provided in Embodiment 4 of the present invention;
[0033] Figure 13 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. Detailed Implementation
[0034] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0035] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0036] To more clearly illustrate the dynamic optimization method for raster structures provided in this embodiment of the invention, the more common and general PostGIS raster structure is used as an example. The PostGIS raster structure is centered on the raster data type, abstracting raster data into a storable, analyzable, and queried database object through database tables, metadata, bands, and georeferenced information. A PostGIS raster consists of two key structures: a serialization structure (rt_raster_serialized_t) and a deserialization structure (rt_raster_t).
[0037] In this embodiment, the serialization and deserialization structures of PostGIS are used as examples for description. Figure 1 An example diagram of a traditional PostGIS grid structure, such as... Figure 1 As shown, the attributes of the PostGIS serialization and deserialization structures include: size (total size in bytes of the entire raster data, 4 bytes), version (version number of the structure, 2 bytes), numBands (number of bands contained in the raster, 2 bytes), scaleX (width of the pixel in geospatial space, 8 bytes), scaleY (height of the pixel in geospatial space, 8 bytes), ipX (geographic X coordinate of the top-left corner pixel of the raster, 8 bytes), ipY (geographic Y coordinate of the top-left corner pixel of the raster, 8 bytes), skewX (skew of the raster in the X-axis direction, 8 bytes), skewY (skew of the raster in the Y-axis direction, 8 bytes), srid (spatial reference system identifier, 4 bytes), width (width of the raster, 2 bytes), and height (height of the raster, 2 bytes).
[0038] Figure 2This is an example diagram illustrating the specific construction content of traditional PostGIS serialization and deserialization structures. `struct rt_raster_serialized_t` represents the serialization structure, and `struct rt_raster_t` represents the deserialization structure. Figure 2 The meaning of each field can be found in the above description, and will not be repeated here.
[0039] Example 1
[0040] Figure 3 This is a flowchart illustrating a dynamic optimization method for a grid structure according to Embodiment 1 of the present invention. This method is applicable to the dynamic optimization of grid structures. The method can be executed by a dynamic optimization device for the grid structure. This dynamic optimization device for the grid structure can be implemented in hardware and / or software and is generally integrated into an electronic device.
[0041] like Figure 3 As shown, the dynamic optimization method for a grid structure provided in this embodiment may specifically include the following steps:
[0042] S101, Obtain raster data.
[0043] In this embodiment, the raster data is stored using the original raster structure. A flag bit is added to the initial position of the original raster structure. The flag bit is used to indicate that the original memory space of the original raster structure is dynamically optimized.
[0044] In this embodiment, raster data is a data form that divides space into a regular grid, with each grid called a cell, and assigns corresponding attribute values to each cell to represent an entity. Specifically, a raster structure can be understood as a data structure used to efficiently represent raster data in memory. Considering that existing raster data types consist of fixed-length metadata plus bands, the following limitations exist: data exceeding the original given memory limit cannot be recorded, and the memory space specified by the metadata is not effectively utilized. In this embodiment, a dynamic raster structure is used to eliminate these limitations. The modification logic of the dynamic raster structure can be described as adding a one-byte flag bit data at the initial position of the serialized or deserialized structure (i.e., before the size attribute) to dynamically optimize the raster structure.
[0045] In this embodiment, the length of the flag bit is one byte; if the flag bit represents the memory space size of each target attribute, the first bit and the second bit of the flag bit represent the memory space size of the target attribute of the total size of the raster data, the third bit and the fourth bit represent the memory space size of the target attribute of the number of bands contained in the raster, the fifth bit and the sixth bit represent the memory space size of the target attribute of the width of the raster, and the seventh bit and the eighth bit represent the memory space size of the target attribute of the height of the raster.
[0046] For example, the flag is represented as 00000000, where the first and second bits represent the size attribute flag, the third and fourth bits represent the numBands attribute flag, the fifth and sixth bits represent the width attribute flag, and the seventh and eighth bits represent the height attribute flag.
[0047] In this embodiment, if the flag bit represents the memory space size of each target attribute, for any target attribute among the width of the raster, the height of the raster, and the number of bands contained in the raster, a flag bit of 00 indicates that the original memory space of the target attribute is divided by 2, a flag bit of 01 indicates that the original memory space of the target attribute is multiplied by 1, a flag bit of 10 indicates that the original memory space of the target attribute is multiplied by 2, and a flag bit of 11 indicates that the original memory space of the target attribute is multiplied by 4; for the target attribute of the total size of the raster data, a flag bit of 00 indicates that the original memory space of the target attribute is divided by 4, a flag bit of 01 indicates that the original memory space of the target attribute is divided by 2, a flag bit of 10 indicates that the original memory space of the target attribute is multiplied by 1, and a flag bit of 11 indicates that the original memory space of the target attribute is multiplied by 2.
[0048] The meanings of the flags are described below for the numBands, width, and height attributes:
[0049] 00: The original length is divided by 2 (i.e., multiplied by 2 to the power of 0-1). For example, if the width flag is 00, it means that the length of width is uint8_t.
[0050] 01: Multiply the original length by 1 (i.e., multiply by 2 to the power of 1-1). For example, if the width flag is 01, it means that the length of width is uint16_t.
[0051] 10: The original length is multiplied by 2 (i.e., multiplied by 2 to the power of 2-1). For example, if the width flag is 10, it means that the length of width is uint32_t.
[0052] 11: Multiply the original length by 4 (i.e., multiply by 2 to the power of 3-1). For example, if the width flag is 11, it means that the length of width is uint64_t.
[0053] For the size attribute:
[0054] 00: The original length is divided by 4 (i.e., multiplied by 2 to the power of 0-2). For example, if the size flag is 00, it means that the width length is uint8_t.
[0055] 01: Divide the original length by 2 (i.e., multiply by 2 to the power of 1-2). For example, if the size flag is 01, it means that the width length is uint16_t.
[0056] 10: The original length is multiplied by 1 (i.e., multiplied by 2 to the power of 2-2). For example, if the size flag is 10, it means that the width length is uint32_t.
[0057] 11: The original length is multiplied by 2 (i.e., multiplied by 2 to the power of 3-2). For example, if the size flag is 11, it means that the width length is uint64_t.
[0058] It should be noted that a 1-byte type data is added to the initial position of the deserialization structure (before the size attribute) to record the structure type of the new raster deserialization structure. Each time it is used, the data can be forcibly rasterized based on the type data. The content of the type data is consistent with the flag bits of the serialization structure.
[0059] In this embodiment, when creating a structure, the original structure memory allocation method is used by default. Based on existing raster data, it is converted to the default dynamic raster type, denoted as the original raster structure. The flag of the original raster structure can be represented as 10010101. For example, Figure 4 This is an example diagram of the original grid structure during the execution of a grid structure optimization method according to Embodiment 1 of the present invention, as shown below. Figure 4 As shown, in addition to the attributes contained in the traditional grid structure, the original grid structure has a flag bit added before the size attribute, which is represented as flag in the figure. The memory space of the flag attribute is 1 byte. The default value of the flag bit in the serialized and deserialized structures is represented as 10010101. The first and second bits indicate that the default value of the size attribute flag bit is 10, the third and fourth bits indicate that the default value of the numBands attribute flag bit is 01, the fifth and sixth bits indicate that the default value of the width attribute flag bit is 01, and the seventh and eighth bits indicate that the default value of the height attribute flag bit is 01.
[0060] Figure 5 This is an example diagram illustrating the specific construction content of the original serialized structure and the original deserialized structure in the execution of a grid structure optimization method according to Embodiment 1 of the present invention. `struct rt_raster_serialized_10010101_t` represents the original serialized structure, and `struct rt_raster_10010101_t` represents the original deserialized structure. Figure 5 The meaning of each field can be found in the above description, and will not be repeated here.
[0061] In this embodiment, the flag bits can also be optimized to represent another meaning. If the flag bits represent memory space allocation pointers for each of the target attributes, the first and second bits of the flag bits represent memory space allocation pointers for the target attribute of the total size of the raster data, the third and fourth bits represent memory space allocation pointers for the target attribute of the number of bands contained in the raster, the fifth and sixth bits represent memory space allocation pointers for the target attribute of the width of the raster, and the seventh and eighth bits represent memory space allocation pointers for the target attribute of the height of the raster.
[0062] Specifically, the target attributes such as size, numBands, width, and height are all represented by pointers, and then memory is allocated for these target attributes according to the parsed flag types. For example, Figure 6 This is another example diagram of the original grid structure in the execution of a grid structure optimization method provided in Embodiment 1 of the present invention, as shown below. Figure 6 As shown, in addition to the attributes contained in the traditional grid structure, the original grid structure has a flag bit added before the size attribute, which is represented as flag in the figure. The memory space of the flag attribute is 1 byte, which represents the memory space allocation pointer of each target attribute. Specifically, the memory space allocation address of the size attribute is represented as size(byte*), the memory space allocation address of the numBands attribute is represented as numBands(byte*), the memory space allocation address of the width attribute is represented as width(byte*), and the memory space allocation address of the height attribute is represented as height(byte*).
[0063] Figure 7 This is another example diagram illustrating the specific construction content of the original deserialization structure during the execution of an optimization method for a raster structure provided in Embodiment 1 of the present invention. `struct rt_raster_new_t` represents the original deserialization structure. Figure 7 The meaning of each field can be found in the above description, and will not be repeated here.
[0064] S102. During the calculation of raster data, if the original memory space of the target attribute in the original raster structure meets the first memory update condition, then the original memory space of the target attribute is expanded and the flag bit is modified.
[0065] In this context, the memory space of the target attribute within the original raster structure is denoted as the original memory space of the target attribute. The target attribute includes at least one of the following: the total size of the raster data (size), the width of the raster (width), the height of the raster (height), and the number of bands contained in the raster (numBands). It is understood that the target attribute includes, but is not limited to, the above attributes. Depending on actual needs, if the memory space of any attribute within the raster structure requires expansion or reduction, that attribute can be used as the target attribute.
[0066] In this embodiment, the first memory update condition is that the original memory space of the target attribute in the original raster structure does not meet the computation requirements of the raster data. If the current length does not meet the requirements during raster data computation, the length is increased and the flag bit is modified. Specifically, during raster data computation, if the original memory space of a certain target attribute in the original raster structure does not meet the computation requirements of the raster data, the memory size corresponding to that target attribute is increased, and the subsequent data is shifted forward by the corresponding length. Simultaneously, the flag bit corresponding to that target attribute is modified based on the memory size modification.
[0067] This can be understood as follows: During raster data calculation, if the memory space for the `size` attribute is insufficient for the calculation, the memory space for the `size` attribute is increased, the corresponding flag is modified, and the data following the `size` attribute is shifted to the right by the corresponding length. Similarly, if the memory space for the `numBands` attribute is insufficient, the memory space for the `numBands` attribute is increased, the corresponding flag is modified, and the data following the `numBands` attribute is shifted to the right by the corresponding length. Likewise, if the memory space for the `width` attribute is insufficient, the memory space for the `width` attribute is increased, the corresponding flag is modified, and the data following the `width` attribute is shifted to the right by the corresponding length. If the memory space for the `height` attribute is insufficient, the memory space for the `height` attribute is increased, and the corresponding flag is modified. For example, if the memory space for a certain target attribute is insufficient during the calculation, the corresponding memory size is multiplied by 2, and the subsequent data is shifted to the right by the length of the original memory space.
[0068] It should be noted that if the input raster data is too large, the raster data can be stored directly based on the optimized raster structure before input.
[0069] For example, assuming the height attribute does not meet the computational requirements during raster data calculation, and its memory space needs to be expanded by 2 times, then the flag bits of the serialized and deserialized structures are corrected to 10010110. Figure 8 This is an example diagram of the expanded grid structure provided in Embodiment 1 of the present invention during the execution of a grid structure optimization method, as shown below. Figure 8 As shown, the expanded grid structure contains the attributes of the traditional grid structure, and a flag bit is added before the size attribute, represented as flag in the figure. The length of the flag attribute is 1 byte. The default value of the flag bit in the serialized and deserialized structures is represented as 10010110. The first and second bits indicate that the default value of the size attribute flag bit is 10, the third and fourth bits indicate that the default value of the numBands attribute flag bit is 01, the fifth and sixth bits indicate that the default value of the width attribute flag bit is 01, and the seventh and eighth bits indicate that the default value of the height attribute flag bit is 10.
[0070] Figure 9 This is an example diagram illustrating the specific construction content of the expanded serialized structure and the expanded deserialized structure in the execution of a grid structure optimization method according to Embodiment 1 of the present invention. `struct rt_raster_serialized_10010110_t` represents the original serialized structure, and `struct rt_raster_10010110_t` represents the original deserialized structure. Figure 9 The meaning of each field can be found in the above description, and will not be repeated here.
[0071] S103. After the raster data calculation is completed, if the original memory space of the target attribute in the original raster structure meets the second memory update condition, then the original memory space of the target attribute is reduced and the flag bit is modified.
[0072] In this embodiment, the second memory update condition is that the storage requirement of the calculated raster data is less than the original memory space of the target attribute in the original raster structure multiplied by a set percentage. The set percentage can be set according to the actual situation; for example, the set percentage can be 50% or 25%, and there is no specific limitation here. After the raster data calculation is completed, if the final calculation result is checked, it is checked whether the used length has reached the set percentage of the current length. If it has not reached the set percentage, the original memory space of the target attribute is reduced and the flag bit is corrected. Specifically, after the raster data calculation is completed, if the memory used by a certain target attribute is less than the set percentage of the original memory space of that target attribute in the original raster structure, the memory size corresponding to that target attribute is reduced, and the subsequent data is shifted forward by the corresponding length. At the same time, the flag bit corresponding to that target attribute is modified based on the change in memory space size.
[0073] This can be understood as follows: After the raster data calculation is completed, if the storage requirement of the calculated raster data is less than the set percentage of memory space for the `size` attribute, then the memory space for the `size` attribute is reduced, the corresponding flag bit for the `size` attribute is modified, and the data following the `size` attribute is shifted forward by the corresponding length. Similarly, if the storage requirement of the calculated raster data is less than the set percentage of memory space for the `numBands` attribute, then the memory space for the `numBands` attribute is reduced, the corresponding flag bit for the `numBands` attribute is modified, and the data following the `numBands` attribute is shifted forward by the corresponding length. Likewise, if the storage requirement of the calculated raster data is less than the set percentage of memory space for the `width` attribute, then the memory space for the `width` attribute is reduced, the corresponding flag bit for the `width` attribute is modified, and the data following the `width` attribute is shifted forward by the corresponding length. Finally, if the storage requirement of the calculated raster data is less than the set percentage of memory space for the `height` attribute, then the memory space for the `height` attribute is reduced, the corresponding flag bit for the `height` attribute is modified, and the data following the `height` attribute is shifted forward by the corresponding length. For example, if the memory used by a target attribute is less than half of the original, the memory allocation size of the corresponding attribute is halved, the subsequent data is shifted forward by half the original memory size, and the corresponding flag is modified.
[0074] The above technical solution adopts a new dynamic grid structure. When the data to be recorded exceeds the original given memory limit, the memory for storing this data can be expanded. After the calculation is completed, the memory can also be appropriately reduced according to the memory space used. This realizes that the memory space of the grid structure can be dynamically adjusted according to the data calculation and storage needs, which not only ensures the calculation and storage of data, but also ensures the effective use of memory space.
[0075] Example 2
[0076] Figure 10 This is a flowchart illustrating another dynamic optimization method for a grid structure provided in Embodiment 2 of the present invention. This embodiment is a further optimization of the above embodiment. In this embodiment, the optimization of "expanding the original memory space of the target attribute and modifying the flag bit" and the optimization of "shrinking the original memory space of the target attribute and modifying the flag bit" are further defined.
[0077] like Figure 10 As shown in the figure, this embodiment 2 provides a dynamic optimization method for a grid structure, which specifically includes the following steps:
[0078] S201. Obtain raster data.
[0079] The raster data is stored using the original raster structure. A flag is added to the initial position of the original raster structure to indicate that the original memory space of the original raster structure will be dynamically optimized. The flag indicates the memory space size of each target attribute.
[0080] S202. During the calculation of raster data, if the original memory space of the target attribute in the original raster structure meets the first memory update condition, then the memory expansion factor that the original memory space of the target attribute needs to be expanded is determined according to the calculation requirements of the raster data.
[0081] In this embodiment, during the calculation of raster data, if the original memory space of the target attribute in the original raster structure does not meet the calculation requirements of the raster data, it indicates that the original memory space of the target attribute meets the first memory update condition, and the memory space of the target attribute needs to be expanded. Specifically, the amount by which the memory space of the target attribute needs to be expanded can be determined by the memory expansion factor based on the calculation requirements of the raster data.
[0082] For example, the original memory space length of the `numBands`, `width`, and `height` attributes is 2 bytes, and their memory expansion factor can be 2 times or 4 times. Based on the calculation requirements of the raster data, it can be determined whether the memory expansion factor for these target attributes is 2 times or 4 times. The original memory space length of the `size` attribute is 4 bytes, and its memory expansion factor can be 2 times or remain unchanged. Based on the calculation requirements of the raster data, it can be determined whether the memory expansion factor for this target attribute is 2 times or remains unchanged.
[0083] S203. Multiply the original memory space of the target attribute by the memory expansion factor to obtain the target memory space of the target attribute and modify the flag bit of the target attribute.
[0084] In this embodiment, after determining the required expansion factor for the target attribute, the original memory space of the target attribute is multiplied by the memory expansion factor to obtain the new memory space for the target attribute, denoted as the target memory space. Simultaneously, the flag bit of the target attribute needs to be modified based on the expanded target memory space. For example, during raster data calculation, if the calculation requirement exceeds the original memory space occupied by the size attribute (4 bytes), and its memory expansion factor is determined to be 2 times, then the expanded target memory space for the size attribute is 8 bytes. If 8 bytes of space still cannot meet the calculation requirement, an error is reported. Correspondingly, the flag bit of the size attribute in the original raster structure is 10; after the memory space of the size attribute is expanded by 2 times, the corresponding flag bit is modified to 11.
[0085] S204. Move the memory space of the target attribute's subsequent attribute backward by the first deviation memory space.
[0086] In this embodiment, the "following attribute" can be specifically understood as the attribute located after the target attribute. The first deviation memory space is equal to the target memory space minus the original memory space. The first deviation memory space represents how much memory space the target attribute has expanded to the right. Specifically, after determining the target memory space of the target attribute, the memory space of the following attributes of the target attribute needs to be shifted backward by the corresponding memory space, that is, shifted backward by the first deviation memory space.
[0087] S205. After the raster data calculation is completed, if the original memory space of the target attribute in the original raster structure meets the second memory update condition, then determine the memory reduction factor that the original memory space of the target attribute needs to be reduced according to the storage requirements of the raster data.
[0088] In this embodiment, after the raster data calculation is completed, if the storage requirement of the calculated raster data is less than the original memory space of the target attribute in the original raster structure multiplied by a set percentage, it indicates that the original memory space of the target attribute meets the second memory update condition, and the memory space of the target attribute needs to be reduced. Specifically, the amount by which the memory space of the target attribute needs to be reduced can be determined by the memory reduction factor based on the storage requirement of the calculated raster data.
[0089] For example, the original memory space length of the `numBands`, `width`, and `height` attributes is 2 bytes. Their memory scaling factor can be 2 times or remain unchanged. Based on the calculation requirements of the raster data, it can be determined that the memory scaling factor for these target attributes is 2 times or remains unchanged. The original memory space length of the `size` attribute is 4 bytes. Its memory scaling factor can be 2 times or 4 times. Based on the storage requirements of the raster data, it can be determined that the memory scaling factor for this target attribute is 2 times or 4 times.
[0090] S206. Divide the original memory space of the target attribute by the memory shrinkage factor to obtain the target memory space of the target attribute and modify the flag bit of the target attribute.
[0091] In this embodiment, after determining the required scaling factor for the target attribute, the original memory space of the target attribute is divided by the scaling factor to obtain the new memory space for the target attribute, denoted as the target memory space. Simultaneously, the flag bit of the target attribute needs to be modified based on the scaled-down target memory space. For example, when the space occupied by the final calculation result is less than half of the allocated space, the memory space is divided by 2. When storing the raster data after calculation, if the storage requirement is less than half of the original 4-byte memory space occupied by the size attribute, its scaling factor is determined to be 2 times, and the scaled-down target memory space for the size attribute is 2 bytes. Correspondingly, the flag bit of the size attribute in the original raster structure is 10; after the memory space of the size attribute is scaled down by 2 times, the corresponding flag bit is modified to 01.
[0092] S207. Move the memory space of the target attribute's later attribute forward by the second offset memory space.
[0093] In this embodiment, the second deviation memory space is equal to the original memory space minus the target memory space. The second deviation memory space represents how much memory space the target attribute has shrunk to the left. Specifically, after determining the target memory space of the target attribute, it is necessary to shift the memory space of subsequent attributes of the target attribute forward by the corresponding memory space, that is, shift the second deviation memory space forward.
[0094] The above technical solution specifies how to expand the corresponding memory space when the original memory space of a target attribute is insufficient for computation, and how to shrink the corresponding memory space when the original memory space of a target attribute far exceeds the storage requirements of the raster data, given that the flag bits indicate the memory space size of each target attribute. In the new dynamic raster structure, the memory for storing this data can be expanded when the data to be recorded exceeds the original given memory limit. After the calculation is completed, the memory can also be appropriately reduced according to the memory space used. This ensures both data calculation and storage, as well as the effective utilization of memory space.
[0095] Example 3
[0096] Figure 11 This is a flowchart illustrating another dynamic optimization method for a grid structure provided in Embodiment 3 of the present invention. This embodiment is a further optimization of the above embodiment. In this embodiment, the optimization of "expanding the original memory space of the target attribute and modifying the flag bit" and the optimization of "shrinking the original memory space of the target attribute and modifying the flag bit" are further defined.
[0097] like Figure 11 As shown, this embodiment three provides a dynamic optimization method for a grid structure, which specifically includes the following steps:
[0098] S301, Obtain raster data.
[0099] The raster data is stored using the original raster structure. A flag is added to the initial position of the original raster structure to indicate that the original memory space of the original raster structure will be dynamically optimized. The flag represents the memory space allocation pointer for each target attribute.
[0100] S302. During the calculation of raster data, if the original memory space of the target attribute in the original raster structure meets the first memory update condition, then the memory expansion factor that the original memory space of the target attribute needs to be expanded is determined according to the calculation requirements of the raster data.
[0101] In this embodiment, during the calculation of raster data, if the original memory space of the target attribute in the original raster structure does not meet the calculation requirements of the raster data, it indicates that the original memory space of the target attribute meets the first memory update condition, and the memory space of the target attribute needs to be expanded. Specifically, the amount by which the memory space of the target attribute needs to be expanded can be determined by the memory expansion factor based on the calculation requirements of the raster data.
[0102] S303. Based on the memory expansion factor, allocate pointers to the memory space of the target attribute, add memory corresponding to the memory expansion factor, and modify the flag bits of the target attribute.
[0103] In this embodiment, additional memory space needs to be allocated for these target attributes during initialization. When the memory space needs to be expanded, only the memory space needs to be reallocated. Specifically, based on the memory expansion factor, the amount of memory space for the target attributes that needs to be expanded can be determined. Since the memory space is allocated by pointers, the memory space for the target attributes can be allocated by adding memory corresponding to the memory expansion factor and modifying the flag bit of the target attributes. For example, if the height attribute value needs to exceed 65535 during the calculation process, but the default raw deserialization structure is currently being used, firstly, 2 bytes of memory are added to the address pointed to by the height pointer of the structure, and then the flag bit is set to 10010110.
[0104] S304. After the raster data calculation is completed, if the original memory space of the target attribute in the original raster structure meets the second memory update condition, then determine the memory reduction factor that the original memory space of the target attribute needs to be reduced according to the storage requirements of the raster data.
[0105] In this embodiment, after the raster data calculation is completed, if the storage requirement of the calculated raster data is less than the original memory space of the target attribute in the original raster structure multiplied by a set percentage, it indicates that the original memory space of the target attribute meets the second memory update condition, and the memory space of the target attribute needs to be reduced. Specifically, the amount by which the memory space of the target attribute needs to be reduced can be determined by the memory reduction factor based on the storage requirement of the calculated raster data.
[0106] S305. Based on the memory shrinkage factor, allocate pointers to the memory space of the target attribute, reduce the memory corresponding to the memory shrinkage factor, and modify the flag bit of the target attribute.
[0107] In this embodiment, additional memory needs to be allocated for these target attributes during initialization. When memory needs to be reduced, only memory reallocation is required. Specifically, based on the memory reduction factor, it can be determined how much the memory space of the target attribute needs to be reduced. Since its memory space is allocated by pointers, the memory space of the target attribute can be allocated by reducing the memory space by the memory reduction factor and the flag bit of the target attribute can be modified.
[0108] The above technical solution specifies how to expand the corresponding memory space when the original memory space of the target attribute does not meet the computational requirements, and how to shrink the corresponding memory space when the original memory space of the target attribute far exceeds the storage requirements of the raster data, given that the flag bit represents the memory space allocation pointer for each target attribute. Compared to the technical solution provided in Embodiment 2 above, it only requires reallocating memory for the pointed-to memory, without needing to offset other data, resulting in better performance when memory space changes are frequent.
[0109] As an optional embodiment of the present invention, the method can be optimized based on the above embodiment by further comprising: if the original memory space of the target attribute in the original grid structure does not meet the first memory update condition and the second memory update condition, then the original memory space of the target attribute is not changed.
[0110] In this embodiment, during the calculation of raster data, for each target attribute, if the original memory space of the target attribute in the original raster structure can meet the calculation requirements of the raster data, then it is determined that the original memory space of the target attribute in the original raster structure does not meet the first memory update condition, and the original memory space of the target attribute is not changed. After the calculation of the raster data is completed, if the storage requirements of the calculated raster data exceed the original memory space of the target attribute in the original raster structure multiplied by a set percentage, then it is determined that the original memory space of the target attribute in the original raster structure does not meet the second memory update condition, and the original memory space of the target attribute is not changed.
[0111] In this embodiment, there can be one or more target attributes. Accordingly, when calculating raster data or storing it after calculation, it is necessary to determine whether the memory space of each target attribute needs to be adjusted.
[0112] The above technical solution specifies the case where the memory space of the target attribute does not need to be adjusted.
[0113] Example 4
[0114] Figure 12 This is a schematic diagram of a dynamic optimization device for a grid structure provided in Embodiment 4 of the present invention. This device is applicable to situations involving dynamic optimization of grid structures. The dynamic optimization device for the grid structure can be implemented in hardware and / or software, and is generally integrated into electronic devices. Figure 12 As shown, the device includes: a data acquisition module 41, a memory expansion module 42, and a memory reduction module 43, wherein,
[0115] Data acquisition module 41 is used to acquire raster data, which is stored in an original raster structure. A flag bit is added to the initial position of the original raster structure, and the flag bit is used to indicate that the original memory space of the original raster structure is dynamically optimized.
[0116] The memory expansion module 42 is used to expand the original memory space of the target attribute and modify the flag bit if the original memory space of the target attribute in the original raster structure meets the first memory update condition during the calculation of the raster data.
[0117] The memory shrinking module 43 is used to shrink the original memory space of the target attribute and modify the flag bit after the calculation of the raster data is completed, if the original memory space of the target attribute in the original raster structure meets the second memory update condition.
[0118] The above technical solution adopts a new dynamic grid structure. When the data to be recorded exceeds the original given memory limit, the memory for storing this data can be expanded. After the calculation is completed, the memory can also be appropriately reduced according to the memory space used. This realizes that the memory space of the grid structure can be dynamically adjusted according to the data calculation and storage needs, which not only ensures the calculation and storage of data, but also ensures the effective use of memory space.
[0119] Optionally, the target attribute includes at least one of the following: the total size of the raster data, the width of the raster, the height of the raster, and the number of bands contained in the raster.
[0120] Optionally, the first memory update condition is that the original memory space of the target attribute in the original raster structure does not meet the calculation requirements of the raster data, and the second memory update condition is that the storage requirements of the calculated raster data are less than the original memory space of the target attribute in the original raster structure multiplied by a set percentage.
[0121] Optionally, the length of the flag bit is one byte;
[0122] The flag bits represent the memory space size of each target attribute. The first and second bits of the flag bits represent the memory space size of the target attribute of the total size of the raster data. The third and fourth bits represent the memory space size of the target attribute of the number of bands contained in the raster. The fifth and sixth bits represent the memory space size of the target attribute of the width of the raster. The seventh and eighth bits represent the memory space size of the target attribute of the height of the raster.
[0123] Optionally, if the flag bit represents the memory space size of each target attribute,
[0124] For any target attribute among the width, height, and number of bands contained in the grid, a flag of 00 indicates that the original memory space of the target attribute is divided by 2, a flag of 01 indicates that the original memory space of the target attribute is multiplied by 1, a flag of 10 indicates that the original memory space of the target attribute is multiplied by 2, and a flag of 11 indicates that the original memory space of the target attribute is multiplied by 4.
[0125] For the target attribute of the total size of the raster data, a flag of 00 indicates that the original memory space of the target attribute is divided by 4, a flag of 01 indicates that the original memory space of the target attribute is divided by 2, a flag of 10 indicates that the original memory space of the target attribute is multiplied by 1, and a flag of 11 indicates that the original memory space of the target attribute is multiplied by 2.
[0126] Optionally, if the flag bit represents the memory space size of each target attribute;
[0127] Memory expansion module 42 is specifically used for:
[0128] Based on the computational requirements of the raster data, determine the memory expansion factor required to increase the original memory space of the target attribute;
[0129] Multiply the original memory space of the target attribute by the memory expansion factor to obtain the target memory space of the target attribute and modify the flag bit of the target attribute;
[0130] The memory space of the subsequent attribute of the target attribute is shifted backward by a first deviation memory space, which is equal to the target memory space minus the original memory space.
[0131] Optionally, if the flag bit represents the memory space size of each target attribute;
[0132] Memory reduction module 43 is specifically used for:
[0133] Based on the storage requirements of the raster data, determine the memory reduction factor by which the original memory space of the target attribute needs to be reduced;
[0134] Divide the original memory space of the target attribute by the memory reduction factor to obtain the target memory space of the target attribute and modify the flag bit of the target attribute;
[0135] The memory space of the subsequent attribute of the target attribute is shifted forward by a second offset memory space, which is equal to the original memory space minus the target memory space.
[0136] Optionally, the length of the flag bit is one byte;
[0137] If the flag bits represent memory space allocation pointers for each of the target attributes, the first and second bits of the flag bits represent memory space allocation pointers for the target attribute of the total size of the raster data, the third and fourth bits represent memory space allocation pointers for the target attribute of the number of bands contained in the raster, the fifth and sixth bits represent memory space allocation pointers for the target attribute of the width of the raster, and the seventh and eighth bits represent memory space allocation pointers for the target attribute of the height of the raster.
[0138] Optionally, if the flag bit represents a memory space allocation pointer for each of the target attributes;
[0139] Memory expansion module 42 is specifically used for:
[0140] Based on the computational requirements of the raster data, determine the memory expansion factor required to increase the original memory space of the target attribute;
[0141] Based on the memory expansion factor, add the memory corresponding to the memory expansion factor to the memory space allocation pointer of the target attribute and modify the flag bit of the target attribute.
[0142] Optionally, if the flag bit represents a memory space allocation pointer for each of the target attributes;
[0143] Memory reduction module 43 is specifically used for:
[0144] Based on the storage requirements of the raster data, determine the memory reduction factor by which the original memory space of the target attribute needs to be reduced;
[0145] Based on the memory reduction factor, the memory space allocation pointer for the target attribute is reduced by the memory reduction factor, and the flag bit of the target attribute is modified.
[0146] Optionally, the device further includes a memory-invariant module for:
[0147] If the original memory space of the target attribute in the original raster structure does not meet the first memory update condition and the second memory update condition, then the original memory space of the target attribute will not be changed.
[0148] The dynamic optimization device for grid structures provided in this embodiment of the invention can execute the dynamic optimization method for grid structures provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.
[0149] Example 5
[0150] Figure 13 This is a schematic diagram of an electronic device provided in Embodiment 5 of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0151] like Figure 13 As shown, the electronic device 50 includes at least one processor 51 and a memory, such as a read-only memory (ROM) 52 and a random access memory (RAM) 53, communicatively connected to the at least one processor 51. The memory stores computer programs executable by the at least one processor. The processor 51 can perform various appropriate actions and processes based on the computer program stored in the ROM 52 or loaded into the RAM 53 from storage unit 58. The RAM 53 can also store various programs and data required for the operation of the electronic device 50. The processor 51, ROM 52, and RAM 53 are interconnected via a bus 54. An input / output (I / O) interface 55 is also connected to the bus 54.
[0152] Multiple components in electronic device 50 are connected to I / O interface 55, including: input unit 56, such as keyboard, mouse, etc.; output unit 57, such as various types of monitors, speakers, etc.; storage unit 58, such as disk, optical disk, etc.; and communication unit 59, such as network card, modem, wireless transceiver, etc. Communication unit 59 allows electronic device 50 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0153] Processor 51 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 51 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 51 performs the various methods and processes described above, such as the dynamic optimization method for grid structures.
[0154] In some embodiments, the dynamic optimization method for the grid structure can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 58. In some embodiments, part or all of the computer program can be loaded and / or mounted on electronic device 50 via ROM 52 and / or communication unit 59. When the computer program is loaded into RAM 53 and executed by processor 51, one or more steps of the dynamic optimization method for the grid structure described above can be performed. Alternatively, in other embodiments, processor 51 can be configured to perform the dynamic optimization method for the grid structure by any other suitable means (e.g., by means of firmware).
[0155] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0156] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0157] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0158] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0159] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0160] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0161] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements a dynamic optimization method for a grid structure as provided in any embodiment of this invention.
[0162] In implementing a computer program product, computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof. These programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can 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 can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0163] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0164] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A dynamic optimization method for a grid structure, characterized in that, include: Obtain raster data, which is stored in an original raster structure. A flag bit is added to the initial position of the original raster structure, and the flag bit is used to indicate that the original memory space of the original raster structure is dynamically optimized. During the calculation of the raster data, if the original memory space of the target attribute in the original raster structure meets the first memory update condition, then the original memory space of the target attribute is expanded and the flag bit is modified. After the calculation of the raster data is completed, if the original memory space of the target attribute in the original raster structure meets the second memory update condition, then the original memory space of the target attribute is reduced and the flag bit is modified. The first memory update condition is that the original memory space of the target attribute in the original raster structure does not meet the calculation requirements of the raster data; the second memory update condition is that the storage requirements of the calculated raster data are less than the original memory space of the target attribute in the original raster structure multiplied by a set percentage. The flag bit represents the memory space size of each target attribute or the memory space allocation pointer of each target attribute.
2. The method according to claim 1, characterized in that, The target attributes include at least one of the following: the total size of the raster data, the width of the raster, the height of the raster, and the number of bands contained in the raster.
3. The method according to claim 1, characterized in that, The length of the flag bit is one byte; If the flag bits represent the memory space size of each target attribute, the first and second bits of the flag bits represent the memory space size of the target attribute of the total size of the raster data, the third and fourth bits represent the memory space size of the target attribute of the number of bands contained in the raster, the fifth and sixth bits represent the memory space size of the target attribute of the width of the raster, and the seventh and eighth bits represent the memory space size of the target attribute of the height of the raster.
4. The method according to claim 3, characterized in that, If the flag bit represents the memory space size of each target attribute, For any target attribute among the width, height, and number of bands contained in the grid, a flag of 00 indicates that the original memory space of the target attribute is divided by 2, a flag of 01 indicates that the original memory space of the target attribute is multiplied by 1, a flag of 10 indicates that the original memory space of the target attribute is multiplied by 2, and a flag of 11 indicates that the original memory space of the target attribute is multiplied by 4. For the target attribute of the total size of the raster data, a flag of 00 indicates that the original memory space of the target attribute is divided by 4, a flag of 01 indicates that the original memory space of the target attribute is divided by 2, a flag of 10 indicates that the original memory space of the target attribute is multiplied by 1, and a flag of 11 indicates that the original memory space of the target attribute is multiplied by 2.
5. The method according to claim 3, characterized in that, If the flag bit represents the memory space size of each target attribute; Expanding the memory space of the original grid structure includes: Based on the computational requirements of the raster data, determine the memory expansion factor required to increase the original memory space of the target attribute; Multiply the original memory space of the target attribute by the memory expansion factor to obtain the target memory space of the target attribute and modify the flag bit of the target attribute; The memory space of the subsequent attribute of the target attribute is shifted backward by a first deviation memory space, which is equal to the target memory space minus the original memory space.
6. The method according to claim 3, characterized in that, If the flag bit represents the memory space size of each target attribute; The reduction of the memory space of the original grid structure includes: Based on the storage requirements of the raster data, determine the memory reduction factor by which the original memory space of the target attribute needs to be reduced; Divide the original memory space of the target attribute by the memory reduction factor to obtain the target memory space of the target attribute and modify the flag bit of the target attribute; The memory space of the subsequent attribute of the target attribute is shifted forward by a second offset memory space, which is equal to the original memory space minus the target memory space.
7. The method according to claim 1, characterized in that, The length of the flag bit is one byte; If the flag bits represent memory space allocation pointers for each of the target attributes, the first and second bits of the flag bits represent memory space allocation pointers for the target attribute of the total size of the raster data, the third and fourth bits represent memory space allocation pointers for the target attribute of the number of bands contained in the raster, the fifth and sixth bits represent memory space allocation pointers for the target attribute of the width of the raster, and the seventh and eighth bits represent memory space allocation pointers for the target attribute of the height of the raster.
8. The method according to claim 7, characterized in that, If the flag bit represents a memory space allocation pointer for each of the target attributes; Expanding the memory space of the original grid structure includes: Based on the computational requirements of the raster data, determine the memory expansion factor required to increase the original memory space of the target attribute; Based on the memory expansion factor, add the memory corresponding to the memory expansion factor to the memory space allocation pointer of the target attribute and modify the flag bit of the target attribute.
9. The method according to claim 7, characterized in that, If the flag bit represents a memory space allocation pointer for each of the target attributes; The reduction of the memory space of the original grid structure includes: Based on the storage requirements of the raster data, determine the memory reduction factor by which the original memory space of the target attribute needs to be reduced; Based on the memory reduction factor, the memory space allocation pointer for the target attribute is reduced by the memory reduction factor, and the flag bit of the target attribute is modified.
10. The method according to claim 1, characterized in that, Also includes: If the original memory space of the target attribute in the original raster structure does not meet the first memory update condition and the second memory update condition, then the original memory space of the target attribute will not be changed.
11. A dynamic optimization device for a grid structure, characterized in that, include: The data acquisition module is used to acquire raster data, which is stored in an original raster structure. A flag bit is added to the initial position of the original raster structure, and the flag bit is used to indicate that the original memory space of the original raster structure is dynamically optimized. The memory expansion module is used to expand the original memory space of the target attribute and modify the flag bit if the original memory space of the target attribute in the original raster structure meets the first memory update condition during the calculation of the raster data. The memory shrinking module is used to shrink the original memory space of the target attribute and modify the flag bit after the calculation of the raster data is completed, if the original memory space of the target attribute in the original raster structure meets the second memory update condition. The first memory update condition is that the original memory space of the target attribute in the original raster structure does not meet the calculation requirements of the raster data; the second memory update condition is that the storage requirements of the calculated raster data are less than the original memory space of the target attribute in the original raster structure multiplied by a set percentage. The flag bit represents the memory space size of each target attribute or the memory space allocation pointer of each target attribute.
12. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform a dynamic optimization method for a grid structure as described in any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute a dynamic optimization method for a grid structure as described in any one of claims 1-10.
14. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the dynamic optimization method for a grid structure as described in any one of claims 1-10.