A fast method for computing line-of-sight based on rasterization
By converting line and surface features into a grid set using a rasterization method, the problems of low computational efficiency and omissions in existing technologies are solved, enabling fast and efficient judgment of line and surface geometric relationships and improving inspection accuracy and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2026-03-17
AI Technical Summary
Existing technologies are computationally inefficient and prone to overlooking special cases when determining the geometric relationship between line features and polygon features. They are especially time-consuming when processing large-scale data and cannot identify situations where line features pass through polygon features.
By employing a rasterization method, line and surface features are transformed into a rasterized grid set. By determining the intersections and containment relationships of the grids, the geometric relationships between lines and surfaces can be quickly calculated, improving computational efficiency and accuracy.
It significantly improves computational efficiency in large-scale data processing, reducing the time to one-tenth of traditional algorithms, and can accurately identify cases where line features pass through surface features, thus improving the accuracy and efficiency of inspection.
Smart Images

Figure CN119884098B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of surveying and mapping geographic information, and is used for quality inspection and acceptance of digital map vector data, to quickly check the geometric relationship between line features and polygon features in geographic information elements. Background Technology
[0002] In the process of quality inspection of digital map vector data, the line-to-polygon algorithm still used is the traditional line-to-polygon algorithm: that is, simplifying the geometric relationship between lines and polygons into a point-to-polygon algorithm, calculating whether each point on the line element falls within the polygon, thereby determining whether the line falls within the polygon. The specific algorithm is as follows:
[0003] (1) Poll each face feature, the number of polling times is i, obtain the coordinate data of the face and calculate the bounding rectangle rect1 of the face, and at the same time obtain the face feature attributes and other information;
[0004] (2) Poll each line feature, the number of polling times is the number of line features j, obtain the coordinate data of the line and calculate the line's bounding rectangle rect2, and at the same time obtain the line feature attributes and other information;
[0005] (3) Determine whether the surface bounding rectangle rect1 and the line bounding rectangle rect2 intersect. If they do not intersect, iterate through the next element. If they intersect, proceed to the next step.
[0006] (4) Based on the m coordinates of the line element, perform m judgments using the traditional point-to-polygon algorithm. The number of coordinates of the traditional point-to-polygon algorithm is n. If a point falls within the polygon, the line element is determined to fall within the polygon's range; otherwise, the line element does not fall within the polygon's range.
[0007] According to existing technical algorithms, when encountering a large number of vector data line-plane feature coordinates during inspection, the time consumption is generally quite long, with a time complexity of T = O(i×j×m×n). When the number of line or plane coordinates among the four variables is particularly large, the required time increases exponentially, and the calculation time required is also particularly long, often taking several hours or even more than ten hours to complete the inspection of the line-plane geometric relationship results.
[0008] In addition, in special cases, where the point coordinates of two adjacent line features fall outside the area of a surface feature, but the line connecting the two points passes through the surface feature, the existing algorithm cannot identify them, resulting in omissions in the inspection results. Summary of the Invention
[0009] To overcome the shortcomings of existing technologies, this invention provides a fast calculation method for line-to-surface mapping based on rasterization.
[0010] In view of the problem of the long time required by traditional algorithms in the prior art, the present invention proposes a calculation method based on rasterized line-on-surface technology. By rasterizing vector map data, the grids occupied after rasterizing line-surface are recorded in a grid set, and the grid size is (x, y). Then, geometric relationships of the grids simultaneously occupied by line and surface elements are judged. In this way, the time consumed by the calculation can be calculated in segments. The time complexity of surface element rasterization is T = Ο(x + y)(i × n), the time complexity of line element rasterization is T = Ο(x + y)(j × m), and finally the intersection calculation in the grids simultaneously occupied by line and surface elements is T = Ο(k × 2). Generally, 2 < k < 6, and there are generally 2 points of a line element in a grid after rasterization. The overall time complexity is T = Ο(x + y)(i × n) + Ο(x + y)(j × m) + Ο(k × 2), which is much less than the time complexity of traditional algorithms, thus solving the problem of slow calculation efficiency in the prior art.
[0011] In view of the problem that the nodes of line elements do not fall into surface elements, but the connecting lines of line elements pass through surface elements, a rasterization method is proposed to increase the points included in the surface by taking the intersection points of the raster horizontal and vertical grids, which can expand the expression accuracy of surface elements. At the same time, when line and surface elements occupy the same grid after rasterization, directly judge whether there is an intersection in their geometric relationship within the grid range, so as to accurately calculate the geometric relationship of line-on-surface elements and achieve a geometric judgment of the relationship of line piercing surface elements without omission.
[0012] The technical solution adopted by the present invention to solve its technical problems includes the following steps:
[0013] Step 1: Prepare for rasterizing digital map vector data, obtain metadata to calculate the raster range, that is, the Gaussian coordinate range between the four corner points of the map outline. The number of horizontal and vertical grids is the Gaussian coordinate divided by the contour interval in the metadata to obtain the number of horizontal and vertical grids of the raster size. Read the coordinate data in the digital map vector data into the memory and store it as surface data and line data in a unified format;
[0014] Step 2: Rasterize surface elements. Divide surface elements into convex polygons or concave polygons. When rasterizing, find the intersection points of convex polygons or concave polygons and grid lines, and generate the points included after rasterizing surface elements. The specific steps are as follows:
[0015] Step 3: Perform rasterization of line elements. According to the nodes of line elements and the intersection points of line elements and grid lines, perform line rasterization and assign the grid set occupied after line rasterization L and the set of points P included in the line L ,
[0016] Step 4: After the rasterization of line elements and surface elements is completed, obtain the grid set occupied after surface rasterization A and the set of points P included in the surface AThe set of grid cells occupied after line rasterization L The set of points P contained in the line L Calculate the set A and L Same value, such as a set A and L At the same time, it occupies one grid g i Then calculate the grid g. i The set of points P contained in the face A set P in a Calculate the grid g i The set of points P contained online L set P in l .
[0017] Step 5: Based on the set P obtained in Step 4 a With set P l Make a judgment:
[0018] In step one, the grid size is set to 600×400, and the number of horizontal and vertical grids is a positive integer. To improve accuracy, the number of horizontal and vertical grids is multiplied by a constant, starting from 2, to obtain a new number of horizontal and vertical grids of (600×2)×(400×2)=1200×800. The background grid is then drawn based on the new number of horizontal and vertical grids.
[0019] The specific steps of step two are as follows:
[0020] 2.1) Surface feature coordinate endpoint p i During the rasterization of polygon features, the coordinate endpoints of the polygon features are inserted into the set of points P contained in the polygon. A ={p i …} is saved in the point set P contained in the polygon; the line segment formed by two adjacent endpoints of the polygon feature is the polygon edge line; when the polygon feature is rasterized, the coordinates of the intersection points formed by all horizontal grid lines and polygon edge lines are saved to the point set P contained in the polygon. A In the diagram, the grid cells above and below the intersection of the face edge and the horizontal grid line are the grid cells occupied by the face element after rasterization. The grid cell value g occupied by the face is then set. i Saved to the grid set A = {g} occupied by the rasterized surface i …}; calculate the intersection points formed by the vertical grid lines and the surface edges, and save them to the point set P contained in the surface. A In the middle, the grids on the left and right sides of the intersection of the vertical grid lines are the grids occupied by the rasterized surface features, and are also saved to the set of occupied grids A;
[0021] 2.2) After finding the intersection points of the convex polygon and the horizontal and vertical grids in step 2.1), assign the set P of all grid points between the two intersection points of each horizontal grid line and the face edge line to the points contained in the face. AIn this context, assign the set P of all grid points between the two intersections of each vertical grid line and the surface edge to the points contained within the surface. A middle;
[0022] In step 2.1), after finding the intersection points between the concave polygon face edge and the horizontal and vertical grid lines, each horizontal grid line has an even number of intersection points with the face edge. Following the order from left to right, the grid points contained between every two intersection points are assigned to the point set P contained in the face. A In the case where the endpoint of a polygon feature intersects the same grid line, i.e., the point is both the endpoint of the polygon feature and the intersection with the grid line, the intersection point is not recorded repeatedly; only the point where the endpoint of the polygon feature is contained within the polygon is recorded.
[0023] 2.3) The grid points obtained in step 2.2) are all points contained in the face features. If all four grid points in a certain grid are points contained in the face, then this grid is assigned to the grid set A occupied by the face.
[0024] The specific details of step three are as follows:
[0025] 3.1) Rasterize line feature nodes;
[0026] The coordinates p of each node on the line feature j Divide each by the horizontal and vertical grid spacing to obtain the grid size g occupied by the line feature node. j Each node on a line feature is a point contained within the line, and these nodes are stored in the set P containing the points of the line. L =(p j …).
[0027] 3.2) Calculate the intersection points of the horizontal grid lines and line features, and save the intersection points to the set of points P contained in the line. L In the diagram, the grids above and below this intersection point are marked as the grids occupied after line rasterization, and the occupied grid g is marked as... j Save it to the set of grids occupied after line rasterization, and do not need to mark the occupied grid when the intersection point is at the intersection of horizontal and vertical grid lines;
[0028] 3.3) Calculate the intersection points of the vertical grid lines and line features, and save the intersection points to the set of points P contained in the line. L In the diagram, the left and right grids of this intersection point are marked as the grids occupied after line rasterization, and the occupied grid g is marked as the grid. j Save it to the set of grids L occupied after line rasterization. When the intersection point is at the intersection of horizontal and vertical grid lines, there is no need to mark the occupied grid.
[0029] In step five, when the occupied grid contains both polygon and line features, it is divided into two categories: all four corner points of the occupied grid are in the set of points contained in the polygon, and only some of the four corner points of the occupied grid are in the set of points contained in the polygon. The specific judgment steps are as follows:
[0030] 5.1) When all four corner points of the grid are within the set of points contained in the face;
[0031] When a polygon feature contains four grid points, it means that the polygon feature occupies the entire grid. If a line feature contains points within the grid, it means that the line feature falls within the polygon feature. If the line feature is on the grid edge, the polygon feature and the line feature are tangent, meaning that the line feature does not fall within the polygon feature.
[0032] 5.2) When only a portion of the four corner points of the grid are among the points contained in the face;
[0033] When the points contained in a face within a grid include not only grid corners but also intersections or face endpoints, it indicates that the face feature occupies only a portion of the grid. This can be categorized into four cases:
[0034] The polygon formed by the points contained in the face within the grid is geometrically judged with the line segment formed by the points contained in the line. By finding the intersection point, it is determined whether the line segment of the line element in the grid intersects with the polygon of the face element in the grid. If there is an intersection point, it is determined that the line element falls within the face element. If there is no intersection point, it is determined that the line element is not within the scope of the face element.
[0035] The polygon formed by the points contained in the polygon feature is geometrically judged to be related to the line segment formed by the points contained in the line. The judgment method is to find the intersection point of the polygon edge and the line segment. If there is an intersection point, the line feature is determined to be within the polygon feature. If there is no intersection point, the line feature is determined to be outside the polygon feature.
[0036] An electronic device includes: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to perform the methods described above.
[0037] A computer-readable storage medium storing program code that can be invoked by a processor to perform the method described above.
[0038] The beneficial effect of this invention is that by using a rasterization method for line and surface features, it can quickly and accurately determine the geometric relationships between line and surface features in digital map vector data. Under the same data and experimental environment, the time required by this algorithm is one-tenth that of traditional algorithms. Furthermore, in experiments determining line and surface relationships at different layers of complex terrain and in detecting line and surface relationships in a large batch of vector data (more than 500 maps), this algorithm yielded consistent results with a shorter processing time, achieving a dual guarantee of efficiency and quality, and obtaining a high-quality, high-efficiency, and fast inspection effect. Compared with traditional algorithms, this algorithm has higher inspection accuracy and better inspection results. Attached Figure Description
[0039] Figure 1 This is a flowchart of a raster-based line-to-surface algorithm.
[0040] Figure 2 It is a schematic diagram of the grid occupied by the rasterized surface and the set of points contained in the surface.
[0041] Figure 3 It is a schematic diagram of the grid occupied by the line rasterization and the set of points contained in the line.
[0042] Figure 4 It is a graph showing the relationship between the points contained in the surface and the points contained in the line within a grid where both lines and surfaces occupy the same area. Figure 4 (a) is a schematic diagram showing the position of the face in the grid. Figure 4 (b) is a schematic diagram showing the position of the face in the grid. Figure 4 (c) is a schematic diagram showing the position of the face in the grid. Figure 4 (d) is a schematic diagram showing the position of the face in the grid.
[0043] Figure 5 This is a schematic diagram of a special case where a line passes through a surface. Detailed Implementation
[0044] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0045] Step 1: Prepare for rasterization of digital map vector data. Obtain metadata and calculate the raster range, i.e., the Gaussian coordinate range between the four corner points of the map frame. The number of horizontal and vertical grids is obtained by dividing the Gaussian coordinates by the contour interval in the metadata to get the number of horizontal and vertical grids for the raster size, such as 600×400. The number of horizontal and vertical grids is a positive integer. To improve accuracy, multiply the number of horizontal and vertical grids by a constant, starting from 2, to get a new number of horizontal and vertical grids of (600×2)×(400×2)=1200×800. Draw the background grid based on the new number of horizontal and vertical grids. Read the coordinate data in the digital map vector data into memory and store it as polygon data and line data in a unified format.
[0046] Step 2: Rasterize the polygon features. Divide the polygon features into convex polygons or concave polygons. During rasterization, find the intersections of the convex or concave polygons with the grid lines and generate the points contained in the rasterized polygon features. The specific steps are as follows:
[0047] 2.1) As Figure 2 As shown, the coordinate endpoint p of the surface feature i ( Figure 2 During the rasterization process of polygon features (the blue dots), the endpoints of the polygon feature coordinates are inserted into the set of points P contained in the polygon. A ={p i …} is saved in; the line segment formed by two adjacent endpoints of a surface feature is the surface edge line ( Figure 2(The blue line); When rasterizing surface features, the coordinates of the intersection points formed by all horizontal grid lines and surface edges ( Figure 2 The red point is saved to the set of points P contained in the face. A In the diagram, the grid cells above and below the intersection of the face edge and the horizontal grid line are the grid cells occupied by the face element after rasterization. The grid cell value g occupied by the face is then set. i Saved to the grid set A = {g} occupied by the rasterized surface i …} In; calculate the intersection points formed by the vertical grid lines and the surface edges ( Figure 2 The green point is saved to the set of points P contained in the surface. A In the middle, the grids on the left and right sides of the intersection of the vertical grid lines are the grids occupied by the rasterized surface features, and are also saved to the set of occupied grids A;
[0048] 2.2) After finding the intersection points (i.e., red and green points) of the convex polygon and the horizontal and vertical grids in step 2.1), assign the value to the set P of all grid points (yellow points in the figure) between the two intersection points of each horizontal grid line and the face edge line to the point set P contained in the face. A In the diagram, all grid points (yellow dots in the diagram) between the two intersections of each vertical grid line and the surface edge are assigned to the set of points P contained in the surface. A In, such as Figure 2 The y3 parallel line is a horizontal grid line that intersects the surface edge at two points, namely the two red points on y3. Therefore, assign the set P of all grid points between the two intersection points on the same grid line to the points contained in the surface. A middle;
[0049] In step 2.1), after finding the intersection points (i.e., red and green points) between the concave polygon face edge and the horizontal and vertical grid lines, each horizontal grid line has an even number of intersection points with the face edge. Following the order from left to right, the grid points contained between every two intersection points are assigned to the point set P contained in the face. A In the case where the endpoint of a polygon feature intersects the same grid line (i.e., the point is both the endpoint of the polygon feature and the intersection with the grid line), the intersection point is not recorded repeatedly; only the point where the endpoint of the polygon feature is contained within the polygon is recorded. Figure 2 If a line parallel to y2 intersects the edge of a face at four points, then the grid points from the first intersection point to the second intersection point and the grid points from the third intersection point to the fourth intersection point are saved to the set of points P contained in the face. A In the middle; however, there is a special case where the intersection point of the parallel line y1 and the grid is the same point as the endpoint of the face edge. In this case, it can only be counted as a point contained in one face. Therefore, the grid points between the first and second intersection points are saved to the set P of points contained in the face. A In the middle, the third intersection point is the endpoint of the surface feature, so it is not saved repeatedly;
[0050] 2.3) The grid points obtained in step 2.2) are all points contained within polygon features. If four grid points in a certain grid are all points contained within a polygon, then this grid is assigned to the grid set occupied by the polygon. A middle;
[0051] Step 3: Perform line feature rasterization. Based on the nodes of the line features, the intersections of the line features and the grid lines, perform line rasterization and assign the set of grid cells occupied by the rasterized line features. L The set of points P contained in the line L The details are as follows:
[0052] 3.1) Rasterize line feature nodes;
[0053] The coordinates p of each node on the line feature j Divide each by the horizontal and vertical grid spacing to obtain the grid size g occupied by the line feature node. j Each node on a line feature is a point contained within the line, and these nodes are stored in the set P containing the points of the line. L =(p j …).
[0054] 3.2) Calculate the intersection points of the horizontal grid lines and line features, and save the intersection points to the set of points P contained in the line. L In the diagram, the grids above and below this intersection point are marked as the grids occupied after line rasterization, and the occupied grid g is marked as... j Save the data to the grid set L occupied after line rasterization. When the intersection point is at the intersection of horizontal and vertical grid lines, it is not necessary to label the occupied grid. Figure 3 As shown, the intersection point p of the horizontal parallel line y5 and the line element. j For (x3, y5), the endpoints cannot be assigned to occupied grid cells;
[0055] 3.3) Calculate the intersection points of the vertical grid lines and line features, and save the intersection points to the set of points P contained in the line. L In the diagram, the left and right grids of this intersection point are marked as the grids occupied after line rasterization, and the occupied grid g is marked as the grid. j Save it to the set of grids occupied after line rasterization, and do not need to mark the occupied grid when the intersection point is at the intersection of horizontal and vertical grid lines;
[0056] Step 4: After the line and polygon features are rasterized, you will obtain the grid set A occupied by the rasterized polygon and the point set P contained in the polygon. A The set of grids L occupied by the line after rasterization and the set of points P contained in the line. L Calculate the values that sets A and L have the same, such as sets A and L both occupying the same grid cell g. i Then calculate the grid g. i The set of points P contained in the face A set P in a Calculate the grid gi The set of points P contained online L set P in l .
[0057] Step 5: Based on the set P obtained in Step 4 a With set P l When an occupied grid contains both polygon and line features, it is divided into two categories: where all four corner points of the occupied grid are in the set of points contained in the polygon, and where only some of the four corner points of the occupied grid are in the set of points contained in the polygon. The specific judgment steps are as follows:
[0058] 1) When all four corner points of the grid are within the set of points contained in the face.
[0059] When a polygon feature contains four grid points, it means that the polygon feature occupies the entire grid. If a line feature contains points within the grid, it means that the line feature falls within the polygon feature. If the line feature is on the grid edge, the polygon feature and the line feature are tangent, meaning that the line feature does not fall within the polygon feature.
[0060] 2) When only some of the four corner points of the grid are among the points contained in the face.
[0061] like Figure 4 In a grid, if the points contained in a face include not only grid corners but also intersections or face endpoints, it indicates that the face feature occupies only a portion of the grid. This can be categorized into four cases.
[0062] Figure 4 (a) The polygon formed by the points (red points) contained in the face in the grid is geometrically judged with the line segment formed by the points contained in the line. By finding the intersection point, it is determined whether the line segment of the line element in the grid intersects with the polygon of the face element in the grid. If there is an intersection point, it is determined that the line element falls within the face element. If there is no intersection point, it is determined that the line element is not within the scope of the face element.
[0063] Similarly Figure 4 (d) The polygon formed by the points (red points) contained in the polygon feature is geometrically judged with the line segment (red line) formed by the points contained in the line. The judgment method is to find the intersection point of the polygon edge line and the line segment. If there is an intersection point, the line feature is determined to fall within the polygon feature. If there is no intersection point, the line feature is determined to be outside the polygon feature.
[0064] In the actual use of digital map vector data quality inspection, the judgment and inspection of the correctness of the geometric relationship between line features and polygon features is crucial. There are many inspection contents, such as feature placement in water, contour line placement in water, residential area placement in vegetation, water area placement in vegetation, and water area crossing residential areas. Specific examples are given below.
[0065] Example 1: Inspection of road surface submersion in water
[0066] Line elements are roads, including national and provincial highways, roads of all levels, rural roads, and small roads, but excluding linear bridges; area elements are water surfaces, including ponds, lakes, reservoirs, area rivers, and oceans; the inspection content is that roads cannot cross water surfaces, because in reality roads cannot be built on water unless a bridge is built, so linear bridges are excluded from the line element roads.
[0067] This algorithm uses rasterization to filter out grid values where line-polygon features exist in the same grid, records the valid values of the line-polygon features within this grid range, calculates the line-polygon geometric relationship within this range, and if the line-polygon relationship in a grid is intersecting, it is determined that the line feature has crossed the polygon feature, that is, the line-polygon feature information is recorded and an error is reported to the data inspector for modification.
[0068] In practical applications, judging the relationship between lines and surfaces using traditional algorithms requires a lot of time, which affects the work efficiency of data inspectors. Therefore, there is an urgent need to improve inspection efficiency, shorten inspection time, and meet the requirements of users.
[0069] Example 2: Inspection of residential areas where rivers flow through.
[0070] Line features are linear rivers, and area features are area settlements. In the mapping process, road lines are rendered as broken lines, and the line segment between two adjacent points on the line represents the area through which the river flows. Generally, houses in China are built on land, so when a river passes through an area settlement, an error needs to be reported to indicate the location of the error.
[0071] In traditional algorithms, based on the calculation method of points falling on residential areas, if each point of a river is not located within a residential area, it is determined that the river has not passed through a residential area. However, there is a situation where each point on the river line is not located within a residential area, but the line segment connecting the two points passes through a residential area. Traditional algorithms cannot identify this special case. Therefore, this algorithm increases the fineness of the line-area features by rasterizing them and treating the intersections and grid points of the raster as valid values, thereby improving the accuracy of the algorithm and achieving a situation where the algorithm is accurate and does not miss anything.
[0072] Two algorithms were tested separately using the same data under the same testing environment:
[0073] The efficiency comparison object of this invention is the existing traditional line-to-polygon algorithm. The test data is medium-complexity vector map data containing a large amount of line and polygon feature information. Multiple geometric relationship tests were performed on the line features of layers 1 and 2 and the polygon features of layer 3. The optimization rate of the algorithm's time consumption was calculated. The time optimization rate percentage = [1 - (time used by this algorithm ÷ time used by the traditional algorithm)] × 100. The unified test results are as follows:
[0074] Table 1 Algorithm Running Time Results
[0075]
[0076] In summary, the raster-based line-to-surface algorithm, in medium-complex vector maps with a large amount of data records, consumes nearly one-tenth the time of traditional algorithms, resulting in a time improvement of approximately 88%-93%.
[0077] This invention, through the method of rasterizing line and surface features, can quickly and accurately determine the geometric relationships between line and surface features in digital map vector data. Under the same data and experimental environment, the time required by this algorithm is one-tenth that of traditional algorithms. Furthermore, in experiments determining line and surface relationships at different layers of complex terrain and in detecting line and surface relationships in a large batch of vector data (more than 500 maps), this algorithm yielded consistent results with a shorter processing time, achieving a dual guarantee of efficiency and quality, and obtaining a high-quality, high-efficiency, and fast inspection effect.
[0078] Table 2 Algorithm Check Results Comparison Table
[0079]
[0080] As shown in Table 2, the inspection items for testing the surface alignment of multi-layer line features in the experiment are as follows: Figure 5 In the illustration of the special case of a line crossing a surface, the line node does not fall within the surface, but the line segment connecting the line crosses the surface feature. Traditional algorithms cannot detect this situation, leading to missed detections. However, this algorithm detects the situation where a line feature crosses a surface feature and reports the coordinates of the error, facilitating manual review. Therefore, compared with traditional algorithms, this algorithm has higher detection accuracy and better detection results.
Claims
1. A fast method for computing the line-of-sight based on rasterization, characterized in that It comprises the following steps: Step one: prepare for digital map vector data rasterization, get metadata calculation grid range, that is, the Gauss coordinate range between the four corners of the map outline, the horizontal and vertical grid numbers are the Gauss coordinates divided by the elevation interval in the metadata, get the horizontal and vertical grid numbers of the grid size, read the coordinate data in the digital map vector data into the memory, and store it as face data and line data in a unified format; Step two: face element rasterization, divide the face element into convex or concave polygons, and generate the intersection points of the convex or concave polygons and the grid lines during rasterization, and generate the points contained in the face element after rasterization; Step three: line element gridding is performed, line gridding is performed according to the intersection of the nodes of the line element, the line element and the grid line, and the grid set occupied after line gridding is valued and the point set contained by the line , Step four: after the rasterization of the line and surface elements, the grid set occupied by the rasterized surface is obtained and the point set contained by the surface , the grid set occupied by the rasterized line and the point set contained by the line , the calculation set and the same value, such as the set and occupy a grid at the same time ; then calculate the grid in the point set contained by the surface set , calculate the grid in the point set contained by the line set ; Step five: judging according to the set solved in step four with the set In step five, when the occupied grid has both face elements and line elements, it is divided into four corner points of the occupied grid being in the face contained point set and only part of the four corner points of the occupied grid being in the face contained point set, the specific judgment steps are as follows: 5.1) when the four corner points of the grid are in the face contained point set; When the face contained points of the face element are four grid points, it indicates that the face element occupies the entire grid, and when the line element contained points are in the grid, it indicates that the line element falls in the face element; if the line element is on the grid edge line, the face element and the line element are tangent, that is, the line element does not fall in the face element; 5.2) when the four corner points of the grid are only part of the face contained point set; When the face contained points in the grid include intersection points or face endpoints in addition to the grid corner points, it indicates that the face element only occupies part of the grid, which is divided into the following four cases: The polygon formed by the face contained points in the grid and the line segment composed of the line contained points are judged by geometric relationship, and the intersection points are calculated to determine whether the line segment in the grid and the polygon in the grid have intersection points, if there are intersection points, it is determined that the line element falls in the face element, if there are no intersection points, it is determined that the line element is not in the range of the face element; The polygon formed by the face contained points and the line segment composed of the line contained points are judged by geometric relationship, and the intersection points of the polygon edge line and the line segment are calculated, if there are intersection points, it is determined that the line element falls in the face element, if there are no intersection points, it is determined that the line element is not in the range of the face element.
2. The line falling face fast calculation method based on rasterization according to claim 1, wherein: In step one, the horizontal and vertical grid numbers of the grid size are 600x400, the horizontal and vertical grid numbers are positive integers, if the accuracy needs to be improved, the horizontal and vertical grid numbers are multiplied by a constant, the constant starts from 2, when the constant is 2, the new horizontal and vertical grid numbers are (600x2)x(400x2)=1200x800, and the background grid is drawn according to the new horizontal and vertical grid numbers.
3. The line falling face fast calculation method based on rasterization according to claim 1, wherein: The specific steps of step two are as follows: 2.1) Surface feature coordinate endpoints During the rasterization of polygon features, the coordinate endpoints of the polygon features are inserted into the set of points contained within the polygon. The coordinates of the intersections of all horizontal grid lines with the surface edges are saved in the set of points contained in the surface. When a surface feature is rasterized, the line segments formed by the two adjacent endpoints of the surface feature are called surface edges. In the diagram, the grid cells above and below the intersection of the face edge and the horizontal grid line are the grid cells occupied by the face element after rasterization. The grid cell values occupied by the face are... Saved to the grid set occupied by the rasterized surface In the middle; calculate the intersection points formed by the vertical grid lines and the surface edges, and save them to the set of points contained in the surface. In the diagram, the grids on the left and right sides of the intersection of the vertical grid lines are the grids occupied by the rasterized surface features, and are simultaneously saved to the set of occupied grids. middle; 2.2) After the intersection of the convex polygon with the horizontal-vertical grid in step 2.1), assign all grid points between the two intersection points of each horizontal grid line and the face edge line to the point set contained by the face , assign all grid points between the two intersection points of each vertical grid line and the face edge line to the point set contained by the face ; After the intersection of the concave polygon surface edge and the horizontal and vertical grid is obtained in step 2.1), each horizontal grid line has even intersection points with the surface edge, and the grid points contained between each two intersection points are sequentially assigned to the point set contained by the surface in accordance with the order from left to right However, when the intersection point of the surface element end point and the grid line is the same point, that is, the point is both the surface element end point and the intersection point of the grid line, the intersection point is not recorded repeatedly, and only the surface element end point is recorded as the point contained by the surface. 2.3) The grid points obtained in step 2.2) are all points contained by the surface element. If four grid points in a grid are all points contained by the surface, the grid is assigned to the grid set occupied by the surface in the middle.
4. The line falling face fast calculation method based on rasterization according to claim 1, wherein: The specific steps of step three are as follows: 3.1) line element node rasterization; Coordinates of each node on the line feature Divide by the horizontal and vertical grid spacing respectively to obtain the grid area occupied by the line feature node. Each node on a line feature is a point contained within the line, and these nodes are saved to a set of points contained within the line. ; 3.2) Calculate the intersection of the cross grid line and the line feature, save the intersection point to the point set contained by the line , and mark the upper and lower grid occupied by the line after gridization of the line, and save the occupied grid to the set of grids occupied by the line after gridization of the line , the intersection point does not need to be marked as the occupied grid when the intersection point is at the intersection of the cross grid line and the longitudinal grid line 3.3) Calculate the intersection of the longitudinal grid line and the line feature, save the intersection point to the point set contained by the line If the intersection point is in the grid cell occupied by the line after gridding, mark the left and right grid cells of the intersection point as the grid cells occupied by the line after gridding, and save the grid cells occupied by the line after gridding to the grid cell set occupied by the line after gridding If the intersection point is in the grid cell occupied by the line after gridding, mark the left and right grid cells of the intersection point as the grid cells occupied by the line after gridding, and save the grid cells occupied by the line after gridding to the grid cell set occupied by the line after gridding If the intersection point is in the grid cell occupied by the line after gridding, mark the left and right grid cells of the intersection point as the grid cells occupied by the line after gridding, and save the grid cells occupied by the line after gridding to the grid cell set 5. An electronic device, comprising: It comprises: One or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any one of claims 1-4.
6. A computer-readable storage medium, characterized in that, The computer readable storage medium stores program codes, and the program codes can be invoked by a processor to execute the method of any one of claims 1-4.
Citation Information
Patent Citations
Map data processing method and device
CN110647596A
Grid and voxel positioning method based on laser observation direction, robot and chip
CN116027341A