Improved polygon rasterization method and device based on boundary algebraic method and computer readable storage medium

Through the improved polygon rasterization method, only the edges of the polygon are rasterized and the attribute table and GeoSOT earth segmentation mesh encoding process are used, which solves the problem of space waste and redundant calculation in boundary algebra method and improves the efficiency of polygon rasterization.

CN120336438APending Publication Date: 2025-07-18BEI DOU FU XI XIN XI JI SHU YOU XIAN GONG SI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510213585.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-25
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

The existing boundary algebraic method has problems of space waste and redundant calculations in the process of rasterizing polygons, especially when the polygon outsourcing rectangles are rasterized as a whole and the right mesh on all sides are added and subtracted.

Method used

The improved polygon rasterization method only rasterizes the edges of the polygon, uses the attribute table to store attribute values, and processes the raster through GeoSOT Earth Split Mesh encoding, avoiding the rasterization and redundant calculation of pre-packing polygon rectangles.

Benefits of technology

It effectively avoids space waste, reduces redundant calculations, improves computing efficiency, and realizes efficient polygon rasterization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120336438A_ABST
    Figure CN120336438A_ABST
Patent Text Reader

Abstract

The invention provides an improved polygon rasterization method, device and equipment based on a boundary algebraic method and a computer readable storage medium. The method comprises the steps that all edges of a vector polygon boundary are traversed from any point of the vector polygon boundary; generating an attribute table taking the row and column coordinates of the edge as key values; and circularly traversing attribute values corresponding to all row coordinates of the attribute table, and rasterizing grids of which the coordinates are positioned in the attribute table by using GeoSOT earth subdivision grid codes. According to the scheme provided by the embodiment of the invention, the boundary algebraic method is utilized and improved, and rasterization on a polygon bounding rectangle in advance and multiple times of addition and subtraction calculation on the right grids of all the edges of the polygon bounding rectangle are not needed. Only the edges of the polygon are rasterized, a table is used for storing attribute values, and finally, the attribute values of each row in the attribute table are traversed to judge whether the grid is in the polygon or not, so that polygon rasterizing can be completed. Space waste is avoided, only one-time additive operation needs to be carried out on the boundary grids when the edges are traversed, and redundant calculation is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technologies, and in particular, to an improved polygon rasterization method, device, equipment, and computer-readable storage medium based on the boundary algebra method. Background Art

[0002] Polygon intersection calculation is an important type of calculation in a Geographical Information System (GIS), and is widely applied to GIS spatial analysis types such as polygon topology check, buffer generation, overlay analysis, etc., and has typical algorithm characteristics of complex and intensive calculations.

[0003] The raster data model is an important method for representing spatial objects, and the raster data is regularly distributed and has high independence. Therefore, adopting a raster-based calculation method can greatly improve the spatial calculation efficiency. The main application scenarios of polygon rasterization are as follows: First, filling a polygon into a rasterized picture for storage, printing, or display; that is, generating a file that an image device can read and express polygon shape data or GIS tile data. Second, generating a grid index of the polygon; it can be used for spatial queries and topological operations.

[0004] The boundary algebra method is a polygon rasterization method based on the integral idea. By performing simple addition and subtraction algebraic operations, the attribute values of the vector polygon are assigned to the raster cells inside and on the boundary of the vector polygon, thereby realizing polygon rasterization. A vector polygon usually consists of an outer ring and several inner rings. Compared with other polygon rasterization algorithms, the advantage of the boundary algebra method lies in its higher calculation efficiency, and it can quickly identify the raster cells located in the intersection part of the polygons. However, it needs to perform overall rasterization on the region first, wasting space and also wasting a large amount of time for repeated addition and subtraction operations on the grids on the left side of all the edges of the vector polygon. Although there is an improved boundary algebra rasterization algorithm that optimizes the addition and subtraction algorithm through bitwise negation operations, the problem of space waste and redundant operations in overall rasterization has not been solved. Summary of the Invention

[0005] Multiple aspects of the present application provide an improved polygon rasterization method, device, equipment, and computer-readable storage medium based on the boundary algebra method, which only rasterize the edges of the polygon and use a table to store the attribute values, avoiding waste of space.

[0006] To achieve the above technical effects, one aspect of the present application provides an improved polygon rasterization method based on the boundary algebra method, including:

[0007] Traverse all the edges of a vector polygon starting from any point on the vector polygon boundary;

[0008] Generate an attribute table with the row and column coordinates of the edge as the key values;

[0009] Traverse the attribute values corresponding to all row coordinates of the attribute table, and rasterize the raster whose coordinates are within the attribute table using the GeoSOT earth dissection grid encoding.

[0010] According to a preferred embodiment of the present invention, the further traversing all sides starting from any point on the boundary of the vector polygon includes:

[0011] Traverse all sides of the outer ring of the vector polygon in a clockwise direction, and traverse all sides of the inner ring of the vector polygon in a counterclockwise direction.

[0012] According to a preferred embodiment of the present invention, the further generating an attribute table with the row and column coordinates of the sides as key values includes:

[0013] Define an attribute table, its row coordinates, column coordinates, and the attribute values corresponding to the grids where the row and column coordinates are located, and define the grid traversing and value adding functions;

[0014] Compare the size of the starting row coordinate and the ending row coordinate of the side during traversal, and use the traversing and value adding functions to add corresponding attribute values to the grids;

[0015] Traverse all sides of the vector polygon and fill the attribute values into the attribute table.

[0016] According to a preferred embodiment of the present invention, the further comparing the size of the starting row coordinate and the ending row coordinate of the side during traversal, and using the traversing and value adding functions to add corresponding attribute values to the grids includes:

[0017] When the starting row coordinate of the side is less than the ending row coordinate, use the traversing and value adding functions to add the attribute value 1 to the first grid on the left of each row passed by this side;

[0018] When the starting row coordinate of the side is greater than the ending row coordinate, use the traversing and value adding functions to add the attribute value 1 to the first grid on the right of each row passed by this side;

[0019] When the starting row coordinate of the side is equal to the ending row coordinate, do nothing.

[0020] According to a preferred embodiment of the present invention, the further traversing the attribute values corresponding to all row coordinates of the attribute table, and rasterizing the raster whose coordinates are within the attribute table using the GeoSOT earth dissection grid encoding includes:

[0021] Set a set of raster intervals that can be rasterized;

[0022] Judge whether the grid coordinates are within the polygon according to the attribute values corresponding to the previously traversed raster in this loop. If so, obtain the grid coordinates within the interval of the historical column coordinate and the current column coordinate of the previous loop;

[0023] Use the GeoSOT global subdivision grid encoding technology to convert the raster coordinates into grid codes and put them into the raster interval set, use the current column coordinate as the historical column coordinate in the next loop to traverse all rows of the attribute table, and rasterize the rasters in the raster interval set.

[0024] According to a preferred embodiment of the present invention, the step of determining whether the raster coordinate is inside the polygon according to the attribute value corresponding to the previously traversed raster in this loop further includes:

[0025] Obtain the parity of the attribute value of the currently traversed row. If it is even, it is determined that the previous raster coordinate is inside the polygon; if it is odd, it is determined that the previous raster coordinate is not inside the polygon.

[0026] On the other hand, the present application provides an improved polygon rasterization device based on the boundary algebra method, including:

[0027] A data traversal module, configured to traverse all sides starting from any point on the vector polygon boundary;

[0028] An attribute table generation module, configured to generate an attribute table with the row and column coordinates of the side as the key values;

[0029] A rasterization processing module, configured to cyclically traverse the attribute values corresponding to all row coordinates of the attribute table, and use GeoSOT global subdivision grid encoding to rasterize the rasters whose coordinates are within the attribute table.

[0030] On the other hand, the present application provides an improved polygon rasterization electronic device based on the boundary algebra method, where the device includes:

[0031] At least one processor; and

[0032] A memory communicatively connected to the at least one processor; wherein,

[0033] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.

[0034] On the other hand, the present application provides a computer-readable storage medium, on which computer program instructions are stored, and the computer program instructions can be executed by a processor to implement the above method.

[0035] On the other hand, the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, the above method is implemented.

[0036] In the solution provided by the embodiments of the present application, the boundary algebra method is utilized and improved. It is not necessary to pre-rasterize the circumscribed rectangle of the polygon and perform multiple addition and subtraction calculations on the grids on the right side of all its sides. Only the sides of the polygon are rasterized, and a table is used to store the attribute values. Finally, by traversing the attribute values of each row in the attribute table to determine whether the grid is inside the polygon, the polygon rasterization can be completed. This avoids waste of space, and only one addition operation on the boundary grid is required when traversing the sides, avoiding redundant calculations. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0038] By reading the detailed description of the non-limiting embodiments with reference to the following drawings, other features, objectives, and advantages of the present application will become more apparent:

[0039] Figure 1 It is a flowchart of an improved polygon rasterization method based on the boundary algebra method provided by an embodiment of the present application;

[0040] Figure 2 It is a schematic diagram of the boundary algebra method in the prior art;

[0041] Figure 3 It is a schematic diagram of the principle of an improved polygon rasterization method based on the boundary algebra method provided by an embodiment of the present application;

[0042] Figure 4 It is a schematic diagram of an improved polygon rasterization device based on the boundary algebra method provided by an embodiment of the present application;

[0043] Figure 5 It is a schematic diagram of the structure of a device suitable for implementing the solution in the embodiments of the present application.

[0044] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.

[0046] In a typical configuration of the present application, both the terminal and the device of the service network include one or more processors (CPUs), an input / output interface, a network interface, and a memory.

[0047] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash RAM. The memory is an example of computer-readable media.

[0048] Computer-readable media includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer program instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information accessible by a computing device.

[0049] In an actual scenario, the execution subject of the method can be a user device, or a device formed by integrating the user device and the network device through a network, or it can also be an application program running on the above devices. The user device includes, but is not limited to, various terminal devices such as computers, mobile phones, tablet computers, smart watches, and bracelets. The network device includes, but is not limited to, network hosts, single network servers, multiple network server sets, or computer collections based on cloud computing, etc., which can be used to implement some processing functions when setting an alarm. Here, the cloud consists of a large number of hosts or network servers based on cloud computing. Among them, cloud computing is a type of distributed computing, consisting of a virtual computer formed by a group of loosely coupled computers.

[0050] Figure 1 It is a flowchart of an improved polygon rasterization method based on the boundary algebra method provided in an embodiment of the present application. Figure 2 It is a schematic diagram of the boundary algebra method in the prior art, such as Figure 2As shown in the figure, the processing process of the boundary algebra method for any polygon includes the following steps: (1) Overall rasterize the region covering the polygon, and initialize the raster cell values of the raster array to zero; (2) Starting from any point on its boundary, traverse the boundary of the polygon's outer ring in the clockwise direction and the boundary of the inner ring in the counterclockwise direction; (3) When the boundary line segment direction is upward, subtract the attribute value a from all the rasters with the same row coordinate on the left side of this line segment; when the boundary line segment direction is downward, add the attribute value a to all the rasters with the same row coordinate on the left side of this line segment; when the boundary line segment is parallel to the raster row, no operation is performed; (4) Repeat step (3) until all the boundaries of the polygon are processed. After completing the above calculations, the raster cells with the attribute value a are the calculation results of this polygon rasterization.

[0051] Figure 3 It is a schematic diagram of the principle of an improved polygon rasterization method based on the boundary algebra method provided by an embodiment of this application. As Figure 1 and 3 shown, compared with the boundary algebra method in the prior art, the improved polygon rasterization method based on the boundary algebra method at least includes the following steps:

[0052] S101. Traverse all the sides starting from any point on the vector polygon boundary.

[0053] Specifically, starting from any point on the vector polygon boundary, traverse all the sides of the outer ring in the clockwise direction and all the sides of the inner ring in the counterclockwise direction. It is also possible to traverse all the sides of the outer ring in the counterclockwise direction and all the sides of the inner ring in the clockwise direction.

[0054] S102. Generate an attribute table with the row and column coordinates of the sides as key values.

[0055] Specifically, define the attribute table Map: {(row, col) → value}, where row is the row coordinate, col is the column coordinate, and value is the attribute value corresponding to the raster at this row and column coordinate, and the default value is 0. Define the set E of polygon sides, where each side is e i =(x1, y1), (x2, y2), define the function col = f c (x) that maps the x coordinate to the column coordinate in the raster grid, and define the function row = f r (y) that maps the y coordinate to the row coordinate in the raster grid. Define the maximum and minimum x coordinates of the sides intercepted by each row as x min (row) and x max (row), then the minimum column coordinate where each row intersects with the side is col min (row) = f c (x nin(row)), the maximum column coordinate is col max (row) = f c (x max (row)), and define the traversal and value-adding function T of the grid e (x1, y1, x2, y2).

[0056] Compare the starting row coordinate and the ending row coordinate of the edge during traversal. When traversing all the edges of the outer ring in the clockwise direction and all the edges of the inner ring in the counterclockwise direction, use the traversal and value-adding operation function T e (x1, y1, x2, y2) to add the corresponding attribute value to the grid:

[0057]

[0058] 1) When the starting row coordinate of the edge is less than the ending row coordinate, the increment_left function means adding the attribute value 1 to the first grid on the left of each row passed by this edge:

[0059]

[0060] 2) When the starting row coordinate of the edge is greater than the ending row coordinate, the increment_right function means adding the attribute value 1 to the first grid on the right of each row passed by this edge:

[0061]

[0062] 3) When the starting row coordinate of the edge is equal to the ending row coordinate, no processing is done.

[0063] When traversing all the edges of the outer ring in the counterclockwise direction and all the edges of the inner ring in the clockwise direction, at this time, when the starting row coordinate of the edge is less than the ending row coordinate, add the attribute value 1 to all the rightmost grids with the same row coordinate passed by this edge; when the starting row coordinate of the edge is greater than the ending row coordinate, add the attribute value 1 to all the leftmost grids with the same row coordinate passed by this line segment.

[0064] Traverse all the edges of the vector polygon in this way and fill the attribute values into the attribute table:

[0065]

[0066] S103. Traverse the attribute values corresponding to all the row coordinates of the attribute table in a loop, and perform rasterization processing on the grids whose coordinates are within the attribute table using the GeoSOT earth subdivision grid coding.

[0067] Specifically, loop through all rows of the attribute table Map, and define a function rowInfo(row) for extracting the attributes of a certain row in the attribute table Map as rowInfo(row) = {(col1, value1), (col2, value2), …, (col n , value n ).}, where col1 < col2 < … < col n . In one loop, currRow represents the current row coordinate being traversed, and Result represents the polygon rasterization result.

[0068] First, set the raster interval set intervals for the current row, with the default value being

[0069] Then, use rowInfo(currRow) to loop through the attribute values of the current row coordinate currRow. In one loop, the boolean value inside indicates whether the previously traversed raster segment is inside the polygon, with its initial value being false, currCol represents the current column coordinate, and prevCol represents the previous column coordinate, with the default value being 0.

[0070] Define the function Δ intervals to represent the interval added in the current step. For each pair of the current column coordinate and the corresponding attribute value (currCol, value), update the interval set using the following method:

[0071] 1) Determine whether the attribute value corresponding to the previously traversed raster segment in this loop determines whether the raster coordinate is inside the polygon. Define the function inside(prevCol, currCol, value) to represent whether it is inside the polygon. When inside is true, obtain the raster coordinates within the interval of the previous loop's historical column coordinate and the current column coordinate. Update the interval set intervals:

[0072]

[0073] This function means that when inside is true, if this Δ intervals interval does not intersect with the raster interval set intervals, add the interval [prevCol, currCol] to the raster interval set intervals; if this Δ intervals interval intersects with the raster interval set intervals, add the interval [prevCol, max(prevCol, currCol)] to the raster interval set intervals.

[0074] 2) Update the inside status and switch inside according to the attribute value (parity) of the current row:

[0075]

[0076] Obtain the parity of the attribute value of the current row being traversed. If it is even, determine that the previous raster coordinates are inside the polygon; if it is odd, determine that the previous raster coordinates are not inside the polygon.

[0077] 3) Update prevCol:

[0078] prevCol′ = currCol

[0079] After converting the raster coordinates into grid codes and putting them into the raster interval set Result, use the current column coordinate as the historical column coordinate in the next loop to complete traversing all rows of the attribute table, that is, assign currCol to prevCol, and put the currently traversed raster into the raster interval set intervals.

[0080] Define the function Iterate(rowInfo,intervals) to represent this process. The function of Iterate is to gradually update the raster interval set intervals by iterating over each pair of column coordinates and their attribute values in rowInfo:

[0081]

[0082] Iterate is a recursive function. Each recursive call processes a col and a value, and at the same time updates intervals. When the recursion is completed, the function rowInfo is empty.

[0083] After all iterations, the final raster interval set lIntervals is expressed as:

[0084] intervals = {[start1,end1],[start2,end2],…,[start m ,end m}

[0085] Finally, use the GeoSOT global earth subdivision grid coding technology to convert the raster coordinates into grid codes and put them into the raster interval set Result, and perform rasterization processing on the rasters in the raster interval set Result.

[0086] GeoSOT global earth subdivision grid coding is based on 2 n and the one-dimensional integer array global longitude and latitude subdivision grid. It strictly recursively quadtrees the spatial range of the earth's surface longitude and latitude after 3 times of expansion, thereby dividing the entire earth into a hierarchical grid system from the global scale to the centimeter scale, including whole degrees, whole minutes, whole seconds, and sub - seconds.

[0087] Repeat the above steps until all rows in the attribute table Map are traversed. Result is the polygon rasterization result.

[0088]

[0089] Preferably, if it is necessary to process all the grids covered by the polygon, the continuous edges of the polygon intercepted on each row can be considered as a whole. Specifically, the intersections between the continuous edges and the upper and lower boundaries of the current row are divided into two cases:

[0090] 1) Both the first point and the last point of the continuous edge are located on the upper or lower boundary of the row. At this time, the attribute values of the leftmost and rightmost grids of the continuous edge are incremented by 1 simultaneously. Assume that the starting point of the continuous edge is (x1, y1) and the ending point is (x2, y2), and both of these points are located on the upper or lower boundary of the current row, that is, y1 = y2 = y row . It can be expressed as: T e (x1, y1, x2, y2) = increment(x1, y1, x2, y2). Here, increment represents the operation of adding values to the left and right grids in the current row.

[0091] 2) The first point and the last point of the continuous edge are respectively located on the upper and lower boundaries of the current row (that is: the starting point is on the upper boundary and the ending point is on the lower boundary, or the starting point is on the lower boundary and the ending point is on the upper boundary). In this case, different processing methods are adopted according to the different positions of the intersections: going in from the upper side and out from the lower side (that is, y1 = y upper , y2 = y lower ), at this time, the attribute value of the first grid on the right side of the continuous edge is incremented by 1: T e (x1, y1, x2, y2) = increment_right(x1, y1, x2, y2). Going in from the lower side and out from the upper side (that is, y1 = y lower , y2 = y upper ), at this time, the attribute value of the first grid on the left side of the continuous edge is incremented by 1: T e (x1, y1, x2, y2) = increment_left(x1, y1, x2, y2).

[0092] In the solution provided by the embodiment of this method, the boundary algebra method is utilized and improved. It is not necessary to rasterize the circumscribed rectangle of the polygon in advance and perform multiple addition and subtraction calculations on the right grids of all its edges. Only rasterize the edges of the polygon, use a table to store the attribute values, and finally traverse the attribute values of each row in the attribute table to determine whether the grid is inside the polygon to complete the polygon rasterization. It avoids the waste of space, and only needs to perform an addition operation on the boundary grids once when traversing the edges, avoiding redundant calculations.

[0093] Figure 4 Schematic diagram of an improved polygon rasterization device provided by an embodiment of the present application, as Figure 4 shown, the device includes:

[0094] A data traversal module 11, configured to traverse all sides of a vector polygon boundary starting from any point on the boundary;

[0095] An attribute table generation module 22, configured to generate an attribute table with the row and column coordinates of the sides as key values;

[0096] A rasterization processing module 33, configured to cyclically traverse the attribute values corresponding to all row coordinates of the attribute table, and perform rasterization processing on the rasters whose coordinates are within the attribute table by using the GeoSOT earth dissection grid encoding.

[0097] The above device can execute the improved polygon rasterization method based on the boundary algebra method in the foregoing embodiment. Among them, the data traversal module 11 executes step S101 to traverse all sides of the outer ring of the vector polygon in the clockwise direction and traverse all sides of the inner ring of the vector polygon in the counterclockwise direction.

[0098] The attribute table generation module 22 executes step S102 to define the attribute table, its row coordinates, column coordinates, and the attribute values corresponding to the rasters where the row and column coordinates are located, and define the raster traversal and value addition functions; compare the starting row coordinate and the ending row coordinate of the side during traversal, and use the traversal and value addition functions to add corresponding attribute values to the rasters; traverse all sides of the vector polygon and fill the attribute values into the attribute table.

[0099] The rasterization processing module 33 executes step S103 to set a set of raster intervals that can be rasterized; determine whether the raster coordinates are within the polygon according to the attribute values corresponding to the previously traversed previous segment of rasters in this loop. If so, obtain the column coordinates corresponding to the currently traversed row coordinates, and filter the raster coordinates whose column coordinates are within the interval between the historical column coordinates and the current column coordinates of the previous loop; use the GeoSOT earth dissection grid encoding technology to convert the raster coordinates into grid encodings and put them into the set of raster intervals, and perform rasterization processing on the rasters in the set of raster intervals.

[0100] Based on the same inventive concept, an electronic device is further provided in an embodiment of the present application. The method corresponding to the electronic device may be the improved polygon rasterization method based on the boundary algebra method in the foregoing embodiment, and the principle of solving problems is similar to that of this method. The electronic device provided in the embodiment of the present application includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the methods and / or technical solutions of multiple foregoing embodiments of the present application.

[0101] The electronic device may be a user device, or a device formed by integrating the user device and a network device through a network, or may also be an application program running on the above device. The user device includes, but is not limited to, various terminal devices such as a computer, a mobile phone, a tablet computer, a smart watch, and a bracelet. The network device includes, but is not limited to, a network host, a single network server, a set of multiple network servers, or a computer set based on cloud computing, etc., and can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing. Among them, cloud computing is a type of distributed computing, which consists of a virtual computer formed by a group of loosely coupled computer sets.

[0102] Figure 5 The structure of a device suitable for implementing the methods and / or technical solutions in the embodiments of the present application is shown. The device 1200 includes a central processing unit (CPU, Central Processing Unit) 1201, which can execute various appropriate actions and processes according to the program stored in the read-only memory (ROM, Read Only Memory) 1202 or the program loaded from the storage part 1208 into the random access memory (RAM, Random Access Memory) 1203. In the RAM 1203, various programs and data required for system operation are also stored. The CPU 1201, the ROM 1202, and the RAM 1203 are connected to each other through a bus 1204. The input / output (I / O, Input / Output) interface 1205 is also connected to the bus 1204.

[0103] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, etc., and a speaker; a storage section 1208 including one or more computer-readable media such as a hard disk, an optical disk, a magnetic disk, a semiconductor memory, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet.

[0104] Specifically, the method and / or embodiments in the embodiments of the present application can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for executing the method shown in the flowchart. When the computer program is executed by a central processing unit (CPU) 1201, the above functions defined in the method of the present application are executed.

[0105] Another embodiment of the present application further provides a computer-readable storage medium, on which computer program instructions are stored, and the computer program instructions can be executed by a processor to implement the method and / or technical solution of any one or more of the foregoing embodiments of the present application.

[0106] Another embodiment of the present application further provides a computer program product, on which computer program instructions are stored, and the computer program instructions can be executed by a processor to implement the method and / or technical solution of any one or more of the foregoing embodiments of the present application.

[0107] Specifically, this embodiment may employ any combination of one or more computer-readable media and one or more computer program products. The computer-readable media can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (a non-exhaustive list) of the computer-readable storage medium include: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0108] The computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0109] The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to wireless, wire, optical fiber cable, RF, etc., or any suitable combination of the above.

[0110] The computer program code for performing the operations of this application can be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).

[0111] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of devices, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as combinations of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system that performs the specified functions or operations, or by a combination of dedicated hardware and computer instructions.

[0112] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0113] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or page components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the couplings, direct couplings, or communication connections shown or discussed among each other can be through some interfaces, and the indirect couplings or communication connections of devices or units can be in electrical, mechanical, or other forms.

[0114] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0115] In addition, the functional units in various embodiments of the present application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of a combination of hardware and software functional units.

[0116] The integrated unit implemented in the form of software functional units can be stored in a computer-readable storage medium. The above software functional units are stored in a storage medium and include several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute some steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs.

[0117] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of various embodiments of the present application.

[0118] In addition, obviously the word "including" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices stated in the apparatus claims can also be implemented by one unit or device through software or hardware. The terms first, second, etc. are used to denote names and do not denote any particular order.

Claims

1. An improved polygon rasterization method based on the boundary algebra method, characterized in that Comprising: Traverse all sides starting from any point on the vector polygon boundary; Generate an attribute table with the row and column coordinates of the sides as key values; Loop through the attribute values corresponding to all row coordinates in the attribute table, and rasterize the rasters whose coordinates are within the attribute table using the GeoSOT earth subdivision grid encoding.

2. The improved polygon rasterization method based on the boundary algebra method according to claim 1, wherein The traversing all sides starting from any point on the vector polygon boundary further includes: Traverse all sides of the outer ring of the vector polygon in a clockwise direction, and traverse all sides of the inner ring of the vector polygon in a counterclockwise direction.

3. The improved polygon rasterization method based on the boundary algebra method according to claim 2, wherein The generating an attribute table with the row and column coordinates of the sides as key values further includes: Define the attribute table, its row coordinates, column coordinates, attribute values corresponding to the rasters where the row and column coordinates are located, and define the raster traversing and value adding functions; Compare the starting row coordinate and the ending row coordinate of the side during traversal, and use the traversing and value adding function to add the corresponding attribute value to the raster; Traverse all sides of the vector polygon and fill the attribute values into the attribute table.

4. The improved polygon rasterization method based on the boundary algebra method according to claim 3, wherein The comparing the starting row coordinate and the ending row coordinate of the side during traversal, and using the traversing and value adding function to add the corresponding attribute value to the raster further includes: When the starting row coordinate of the side is less than the ending row coordinate, use the traversing and value adding function to add the attribute value 1 to the first raster on the left of each row passed through by the side; When the starting row coordinate of the side is greater than the ending row coordinate, use the traversing and value adding function to add the attribute value 1 to the first raster on the right of each row passed through by the side; When the starting row coordinate of the side is equal to the ending row coordinate, do nothing.

5. The improved polygon rasterization method based on the boundary algebra method according to claim 1, characterized in that, The looping through the attribute values corresponding to all row coordinates in the attribute table, and rasterizing the rasters whose coordinates are within the attribute table using the GeoSOT earth subdivision grid encoding further includes: Set a set of rasterizable raster intervals; Judge whether the raster coordinate is within the polygon according to the attribute value of the previous raster traversed in this loop. If so, obtain the raster coordinates within the interval of the historical column coordinate and the current column coordinate of the previous loop; Use the GeoSOT earth subdivision grid encoding technology to convert the raster coordinates into grid encodings and put them into the set of raster intervals, use the current column coordinate as the historical column coordinate in the next loop to complete traversing all rows of the attribute table, and rasterize the rasters in the set of raster intervals.

6. The improved polygon rasterization method based on the boundary algebra method according to claim 5, wherein The judging whether the raster coordinate is within the polygon according to the attribute value of the previous raster traversed in this loop further includes: Obtain the parity of the attribute value of the current row traversed. If it is even, judge that the previous raster coordinate is within the polygon. If it is odd, judge that the previous raster coordinate is not within the polygon.

7. An improved polygon rasterization device based on the boundary algebra method, characterized in that, Comprising: A data traversal module for traversing all sides starting from any point on the vector polygon boundary; An attribute table generation module for generating an attribute table with the row and column coordinates of the sides as key values; A rasterization processing module for looping through the attribute values corresponding to all row coordinates in the attribute table, and rasterizing the rasters whose coordinates are within the attribute table using the GeoSOT earth subdivision grid encoding.

8. An electronic device for improved polygon rasterization based on the boundary algebra method, characterized in that The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method according to any one of claims 1-6.

9. A computer-readable medium having computer program instructions stored thereon, characterized in that, The computer program instructions are executable by a processor to implement the method according to any one of claims 1-6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, the method according to any one of claims 1-6 is implemented.