Line falling surface rapid calculation method based on rasterization
By rasterizing the digital map vector data, the problem of low efficiency in judging the geometric relationship between line-poly elements in the existing technology is solved, and fast and accurate geometric relationship judgment is achieved, which significantly improves the calculation efficiency and inspection accuracy.
Patent Information
- Application Number
- CN202411967049.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-30
AI Technical Summary
In the prior art, when checking the geometric relationship between line-poly elements in digital map vector data, the calculation efficiency is low, especially when the number of line or polygon coordinates is large, the time complexity increases exponentially, and it is impossible to identify the situation where line elements pass through the polygon elements.
The rapid calculation method of line falling surfaces based on rasterization is adopted. Through the rasterization of vector map data, the grid occupied by line-surface rasterization is recorded in the grid set, and geometric relationship judgment is performed to reduce the calculation complexity.
It significantly improves the efficiency of judging the geometric relationship of line falling surfaces, reduces the time complexity, and can achieve one-tenth of the time of traditional algorithms in the same data and the same experimental environment, and the inspection results are more accurate and the relationship between line through surface elements is not missed.
Smart Images

Figure CN119884098A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of surveying and mapping geographic information, and is used for quality inspection and acceptance of digital map vector data, and is used for quickly checking the geometric relationship between line elements and surface elements in geographic information elements. Background Art
[0002] In the process of checking the quality of digital map vector data, the line-to-surface technology used is still the traditional line-to-surface-to-polygon algorithm: that is, the geometric relationship between lines and polygons is simplified to a line-point-to-polygon algorithm, which calculates whether each point on the line element falls within the polygon, thereby determining whether the line falls within the polygon. The specific algorithm is:
[0003] (1) Poll each face element, the number of polling times is the number of face elements i, obtain the face coordinate data and calculate the face circumscribed rectangle rect1, and obtain face element attribute information;
[0004] (2) Poll each line feature, the number of polls is the number of line features j, obtain the line coordinate data and calculate the line circumscribed rectangle rect2, and obtain the line feature attributes and other information;
[0005] (3) Determine whether the surface circumscribed rectangle rect1 and the line circumscribed rectangle rect2 have an intersection. If there is no intersection, poll the next element. If there is an intersection, proceed to the next step.
[0006] (4) Based on the m coordinates of the line element, the traditional point-to-polygon algorithm is used for m times. The number of surface coordinates of the traditional point-to-surface algorithm is n. If a point falls within the surface polygon, then the line element is judged to fall within the range of the surface polygon. Otherwise, the line element does not fall within the range of the surface polygon.
[0007] According to the existing technical algorithm, when checking the vector data line-surface element coordinates that are too many, it usually takes a long time, and the time complexity is T=O(i×j×m×n). When the number of line or surface coordinates in the four variables is particularly large, the time required increases exponentially, and the time required for calculation is also particularly long. It often takes several hours or even more than ten hours to check the line-to-surface geometric relationship results.
[0008] In addition, in special cases, that is, when the point coordinates of two adjacent line elements fall outside the range of the surface element, but the line between the two points passes through the surface element, the existing algorithm cannot recognize it, resulting in omissions in the inspection results. Summary of the invention
[0009] In order to overcome the deficiencies of the prior art, the present invention provides a fast line-falling-surface calculation method 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. Through rasterization of vector map data, the grids occupied after rasterization of line-surface are recorded in a grid set, and the grid size is (x, y). Then, geometric relationship judgment is performed on the grids simultaneously occupied by line and surface elements. 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-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 smaller than the time complexity of traditional algorithms, thus solving the problem of slow calculation efficiency in the prior art.
[0011] Aiming at 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. By adding points included in the surface at the intersections of the raster horizontal and vertical grids, the expression accuracy of the surface elements can be expanded. At the same time, when the 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 between line and 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 rasterization of 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 intersections of convex polygons or concave polygons with grid lines and generate the points included after rasterization of surface elements. The specific steps are as follows:
[0015] Step 3: Perform rasterization of line elements. Perform line rasterization based on the nodes of line elements and the intersections of line elements and grid lines, 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 A, the grid set occupied by the line after 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 a grid g i ; then calculate the grid g i The set of points P contained in the surface A The set P in a , calculate the grid g i The set of points P contained in the line L The set P in l .
[0017] Step 5: Based on the set P solved in step 4 a With the set P l , make a judgment:
[0018] In the step 1, the number of horizontal and vertical grids of the grid size is 600×400, and the number of horizontal and vertical grids is a positive integer. To improve the accuracy, the number of horizontal and vertical grids is multiplied by a constant respectively, and the constant starts from 2, and the new number of horizontal and vertical grids is (600×2)×(400×2)=1200×800. The background grid is drawn according to the new number of horizontal and vertical grids.
[0019] The specific steps of step 2 are:
[0020] 2.1) Coordinates of the endpoints p of the surface element i In the process of rasterizing the surface features, the coordinate endpoints of the surface features are inserted into the point set P contained in the surface. A ={p i …}; the line segment formed by two adjacent endpoints of the surface element is the surface edge line; when the surface element is rasterized, the coordinates of the intersections formed by all horizontal grid lines and the surface edge lines are saved to the point set P contained in the surface A In the figure, the grids above and below the intersection of the face edge and the horizontal grid line are the grids occupied by the face element after rasterization. The grid value g occupied by the face i The grid set A occupied by the surface rasterization is saved = {g i …}; calculate the intersection points formed by the longitudinal grid lines and the surface edges and save them to the point set P contained in the surface A In the figure, the grids on the left and right sides of the intersection of the longitudinal grid lines are the grids occupied by the surface elements after rasterization, and are saved in the occupied grid set A at the same time;
[0021] 2.2) After finding the intersection points between the convex polygon and the horizontal and vertical grids in step 2.1), assign the set of points P between all grid points and the surface edge lines between the two intersection points to the surface. AIn the example, assign the set of points P between all grid points and the intersection points of each longitudinal grid line and the surface edge line to the point set P contained in the surface A middle;
[0022] After the intersection points of the concave polygonal face edge and the horizontal and vertical grids are found in step 2.1), each horizontal grid line has an even number of intersection points with the face edge. From left to right, the grid points between each 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 and the intersection of a grid line are the same point, that is, the point is both the endpoint of the polygon feature and the intersection of the grid line, the intersection point is not recorded repeatedly, and only the point where the endpoint of the polygon feature is contained in the polygon is recorded;
[0023] 2.3) The grid points obtained in step 2.2) are all points included in the surface element. If the four grid points in a grid are all points included in the surface, then this grid is assigned to the grid set A occupied by the surface;
[0024] The details of step three are as follows:
[0025] 3.1) Line feature node rasterization;
[0026] The coordinates of each node on the line feature are p j Divide by the horizontal and vertical grid spacing respectively to get the grid g occupied by the line feature node j , each node on the line feature is a point contained in the line, and is saved to the point set P contained in the line L =(p j …).
[0027] 3.2) Calculate the intersection points of the horizontal grid lines and line elements, and save the intersection points to the point set P contained in the line L In the figure, mark the upper and lower grids of this intersection as the grids occupied by the line grid, and change the occupied grid g j Save it in the grid set L occupied by the line after rasterization. When the intersection point is at the intersection of the horizontal and vertical grid lines, it is not necessary to mark the occupied grid;
[0028] 3.3) Calculate the intersection points of the longitudinal grid lines and line elements, and save the intersection points to the point set P contained in the line L In the figure, the left and right grids of this intersection are marked as the grids occupied by the line grid, and the occupied grid g j Save it in the grid set L occupied by the line rasterization. When the intersection is at the intersection of the horizontal and vertical grid lines, there is no need to mark the occupied grid.
[0029] In step 5, when the occupied grid has both area elements and line elements, it is divided into the case where the four corner points of the occupied grid are all in the point set contained in the surface and the case where only some of the four corner points of the occupied grid are in the points contained in the surface. The specific judgment steps are as follows:
[0030] 5.1) When the four corner points of the grid are all in the point set contained by the surface;
[0031] When the points contained in the polygon feature are four grid points, it means that the polygon feature occupies the entire grid. If the points contained in the line feature are 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, that is, the line feature does not fall within the polygon feature.
[0032] 5.2) When only some of the four corner points of the grid are included in the points of the polygon;
[0033] When the points contained in the grid surface include intersection points or surface endpoints in addition to grid corner points, it means that the surface feature only occupies part of the grid, which can be divided into the following four cases:
[0034] The polygon formed by the points included in the surface in the grid is judged by the geometric relationship with the line segment formed by the points included in the line. By finding the intersection point, it is judged whether the line segment of the line element in the grid and the polygon of the surface element in the grid have an intersection. If there is an intersection, it is determined that the line element falls within the surface element. If there is no intersection, it is determined that the line element is not within the range of the surface element.
[0035] The geometric relationship between the polygon formed by the points contained in the surface element and the line segment formed by the points contained in the line is judged by finding the intersection point between the polygon edge and the line segment. If there is an intersection point, the line element is judged to fall within the surface element. If there is no intersection point, the line element is judged to be outside the surface element.
[0036] An electronic device comprises: 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 execute the method as described above.
[0037] A computer-readable storage medium stores program codes, and the program codes can be called by a processor to execute the method as described above.
[0038] The beneficial effect of the present invention is that the geometric relationship of line and surface elements in digital map vector data can be quickly and accurately determined by rasterizing line and surface elements. In the same data and the same test environment, the time used by this algorithm is one tenth of that of the traditional algorithm. In addition, in the test of determining the relationship between lines and surfaces in different layers of complex terrain and the test of detecting the relationship between lines and surfaces in large quantities of vector data with more than 500 maps, the inspection results of this algorithm are the same, the inspection time is shorter, and the dual guarantee of efficiency and quality is achieved, and the inspection effect of high quality, efficiency and speed is achieved. Compared with the inspection results of the traditional algorithm, the inspection accuracy of this algorithm is higher and the inspection effect is better. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a flow chart of the line-to-surface algorithm based on rasterization.
[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 relationship diagram between the points contained in the surface and the points contained in the line in the grid occupied by the line and the surface at the same time. Figure 4 (a) is a schematic diagram of the position 1 of the surface in the grid. Figure 4 (b) is a schematic diagram of the position 2 of the surface in the grid. Figure 4 (c) is a schematic diagram of the position 3 of the surface in the grid. Figure 4 (d) is a schematic diagram of the location 4 of the surface in the grid.
[0043] Figure 5 This is a schematic diagram of the special case of a line passing through a surface. DETAILED DESCRIPTION
[0044] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0045] Step 1: Prepare for rasterization of digital map vector data, obtain metadata to calculate the grid range, that is, the Gaussian coordinate range between the four corner points of the map outline, the horizontal and vertical grid numbers are the Gaussian coordinates divided by the equal height interval in the metadata, and the horizontal and vertical grid numbers of the grid size are obtained, such as 600×400, and the horizontal and vertical grid numbers are positive integers. To improve the accuracy, multiply the horizontal and vertical grid numbers by constants, starting from 2, and obtain the new horizontal and vertical grid numbers of (600×2)×(400×2)=1200×800. Draw the background grid according to the new horizontal and vertical grid numbers; read the coordinate data in the digital map vector data into the memory, and store them as surface data and line data in a unified format;
[0046] Step 2: Rasterize the surface elements. Divide the surface elements into convex polygons or concave polygons. When rasterizing, find the intersection points of the convex polygons or concave polygons with the grid lines, and generate the points contained in the rasterized surface elements. The specific steps are as follows:
[0047] 2.1) If Figure 2 As shown, the coordinate endpoint p of the surface element i ( Figure 2 In the process of rasterizing the surface feature, the coordinate endpoints of the surface feature are inserted into the point set P contained in the surface. A ={p i …}; the line segment formed by two adjacent endpoints of a surface element is the surface edge ( Figure 2blue line); when rasterizing a surface feature, the coordinates of the intersections of all horizontal grid lines and surface edges ( Figure 2 The red point in the middle) is saved to the point set P contained in the surface A In the figure, the grids above and below the intersection of the face edge and the horizontal grid line are the grids occupied by the face element after rasterization. The grid value g occupied by the face i The grid set A occupied by the surface rasterization is saved = {g i …}; calculate the intersection points formed by the longitudinal grid lines and the surface edges ( Figure 2 The green point in the middle) is saved to the point set P contained in the surface A In the figure, the grids on the left and right sides of the intersection of the longitudinal grid lines are the grids occupied by the surface elements after rasterization, and are saved in the occupied grid set A at the same time;
[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 all grid points (such as the yellow points in the figure) between the two intersection points of each horizontal grid line and the surface edge line to the point set P contained in the surface. A Assign all grid points between the two intersection points of each longitudinal grid line and the surface edge line (such as the yellow points in the figure) to the point set P contained in the surface A In Figure 2 The parallel line of y3 in is a horizontal grid line, and has two intersections with the edge of the surface, namely the two red points on y3. Then the set of points P from all grid points on the same grid line to the surface is assigned. A middle;
[0049] In step 2.1), after finding the intersection points (i.e., red points 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. From left to right, assign the grid points between each two intersection points to the point set P contained in the face. A In the case where the endpoint of a polygon feature and the intersection of a grid line are the same point, that is, the point is both the endpoint of the polygon feature and the intersection of the grid line, the intersection point is not recorded repeatedly, and only the point where the endpoint of the polygon feature is contained in the polygon is recorded. Figure 2 If the parallel line of y2 in has four intersections with the edge of the face, then the grid points from the first intersection to the second intersection and the grid points from the third intersection to the fourth intersection are saved in the point set P contained in the face. A In the case of the intersection of the parallel line y1 and the grid, there is a special case where the intersection point and the endpoint of the surface edge line are the same point, which can only be considered as a point contained in one surface. Then the grid points between the first intersection point and the second intersection point are saved in the point set P contained in the surface. A In the example, the third intersection point is the endpoint of the polygon feature, so it is not saved repeatedly.
[0050] 2.3) The grid points obtained in step 2.2) are all points included in the surface element. If the four grid points in a grid are all points included in the surface, then this grid is assigned to the grid set occupied by the surface. A middle;
[0051] Step 3: Grid the line elements, grid the lines according to the nodes of the line elements, the intersections of the line elements and the grid lines, and assign the grid set occupied by the line after gridding L The set of points P contained in the line L , as shown below:
[0052] 3.1) Line feature node rasterization;
[0053] The coordinates of each node on the line feature are p j Divide by the horizontal and vertical grid spacing respectively to get the grid g occupied by the line feature node j , each node on the line feature is a point contained in the line, and is saved to the point set P contained in the line L =(p j …).
[0054] 3.2) Calculate the intersection points of the horizontal grid lines and line elements, and save the intersection points to the point set P contained in the line L In the figure, mark the upper and lower grids of this intersection as the grids occupied by the line grid, and change the occupied grid g j Save it in the grid set L occupied by the line rasterization. When the intersection point is at the intersection of the horizontal and vertical grid lines, it is not necessary to mark the occupied grid, such as Figure 3 As shown, the y5 horizontal parallel line intersects the line element p j is (x3,y5), the endpoint cannot be assigned to the occupied grid;
[0055] 3.3) Calculate the intersection points of the longitudinal grid lines and line elements, and save the intersection points to the point set P contained in the line L In the figure, the left and right grids of this intersection are marked as the grids occupied by the line grid, and the occupied grid g j Save it in the grid set L occupied by the line after rasterization. When the intersection point is at the intersection of the horizontal and vertical grid lines, it is not necessary to mark the occupied grid;
[0056] Step 4: After the rasterization of line elements and surface elements is completed, the grid set A occupied by the surface after rasterization and the point set P contained in the surface are obtained. A , the grid set L occupied by the line after rasterization and the point set P contained by the line L , calculate the same value of set A and L, such as set A and L occupy a grid g at the same time i ; then calculate the grid g i The set of points P contained in the surface A The set P in a , calculate the grid gi The set of points P contained in the line L The set P in l .
[0057] Step 5: Based on the set P solved in step 4 a With the set P l When the occupied grid has both area elements and line elements, it is divided into the case where the four corner points of the occupied grid are all in the point set contained by the surface and the case where only some of the four corner points of the occupied grid are in the points contained by the surface. The specific judgment steps are as follows:
[0058] 1) When the four corner points of the grid are all in the point set contained by the surface
[0059] When the points contained in the area feature are four grid points, it means that the area feature occupies the entire grid. When the points contained in the line feature are within the grid, it means that the line feature falls within the area feature. If the line feature is on the edge of the grid, the area feature and the line feature are tangent, that is, the line feature does not fall within the area feature.
[0060] 2) When only some of the four corner points of the grid are included in the points of the polygon
[0061] like Figure 4 In the grid, when the points contained in the surface include intersection points or surface endpoints in addition to the grid corner points, it means that the surface feature only occupies part of the grid, which is divided into the following four cases
[0062] Figure 4 (a) The polygon formed by the points (red points) included in the surface in the grid is judged by the geometric relationship with the line segments formed by the points included in the line. By finding the intersection points, it is judged whether the line segments of the line element in the grid and the polygons of the surface element in the grid have intersections. If there are intersections, it is determined that the line element falls within the surface element. If there are no intersections, it is determined that the line element is not within the surface element.
[0063] Same reason Figure 4 (d) The geometric relationship between the polygon formed by the points (red points) contained in the surface element and the line segment (red line) formed by the points contained in the line is judged by finding the intersection point between the polygon edge and the line segment. If there is an intersection point, the line element is judged to fall within the surface element. If there is no intersection point, the line element is judged to be outside the surface element.
[0064] In the actual use of digital map vector data quality inspection, it is crucial to check the correctness of the geometric relationship between line elements and surface elements. There are many inspection contents, such as element falling into water, contour line falling into water, vegetation falling into residential areas, vegetation falling into water areas, and water areas passing through residential areas. Specific examples are given below.
[0065] Example 1: Road water surface inspection
[0066] Line features are roads, including national and provincial roads and highways of all levels, rural roads, paths and other line features, but do not include linear bridges; area features are water areas, including ponds, lakes, reservoirs, surface rivers and oceans, etc.; the inspection content is that roads cannot pass through water areas, because in reality roads cannot be built on water surfaces unless bridges are built, so linear bridges are excluded from line feature roads.
[0067] This algorithm uses rasterization to screen out the grid values of line-surface elements in the same grid, and records the valid values corresponding to the line-surface elements within this grid range, and calculates the line-surface geometric relationship within this range. If the line-surface relationship in a grid intersects, it is determined that the line element passes through the surface element, that is, the line-surface element information is recorded and the error is reported to the data inspector for modification.
[0068] In actual application, the use of traditional algorithms to judge the relationship between lines and surfaces consumes a lot of time, affecting the work efficiency of data inspectors. Therefore, it is urgent to improve the inspection efficiency, shorten the inspection time, and meet the requirements of users.
[0069] Example 2: Inspection of river crossing residential areas
[0070] Line features are linear rivers, and surface features are surface settlements. In the process of making map data, road line graphics are broken lines, and the line segment between two adjacent points on the line represents the area through which the river flows. Generally, domestic houses are built on land, so when a river passes through a surface settlement, an error needs to be reported to point out the error location.
[0071] In the traditional algorithm, according to the calculation method of the point falling on the residential area, if every point of the river is not on the residential ground, it is judged that the river does not pass through the residential ground. However, there is a situation that every point on the river line is not on the residential ground, but the line segment connecting the two points passes through the residential ground. For this special case, the traditional algorithm cannot identify its error content. Therefore, this algorithm rasterizes the line-surface elements, and regards the intersection points and grid points passing through the raster as valid values, thereby increasing the refinement of the line-surface elements and improving the accuracy of the algorithm, so as to achieve an accurate algorithm without omissions.
[0072] Under the same test environment, the two algorithms are tested separately with unified data:
[0073] The test efficiency of the present invention is compared with the traditional line-drop-face-polygon algorithm of the prior art. The test data is medium-complex vector map data, containing a large amount of line element and surface element information. The line elements of layer 1 and layer 2 are tested for multiple geometric relationships with the surface elements of layer 3. The optimization rate of the time consumed by the algorithm is calculated. The time optimization rate percentage = [1-(time used by the present 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 line-to-surface algorithm based on rasterization consumes nearly one-tenth of the time of the traditional algorithm in a medium-complex vector map with a large amount of data records, and the time of this algorithm is improved by about 88%-93%.
[0077] The present invention can quickly and accurately determine the geometric relationship of line and surface elements in digital map vector data by rasterizing line and surface elements. In the same data and the same test environment, the time used by this algorithm is one tenth of that of the traditional algorithm. In addition, in the test of determining the relationship between lines and surfaces in different layers of complex terrain and the test of detecting the relationship between lines and surfaces in large quantities of vector data with more than 500 maps, the inspection results of this algorithm are the same, and the inspection time is shorter, achieving a dual guarantee of efficiency and quality, and achieving a high-quality, efficient and fast inspection effect.
[0078] Table 2 Algorithm inspection results comparison table
[0079]
[0080] As shown in Table 2, the inspection contents of the multi-layer line element falling surface tested in the experiment are as follows: Figure 5 In the special case diagram of line-through-surface, the line node does not fall in the surface, but the line segment connecting line passes through the surface element. The traditional algorithm cannot detect this situation, which will lead to missed reports. However, this algorithm detects the situation where the line element passes through the surface element and reports the coordinate position of the inspection error to facilitate manual review. Therefore, compared with the inspection results of the traditional algorithm, this algorithm has higher inspection accuracy and better inspection effect.
Claims
1. A fast line-falling surface calculation method based on rasterization, characterized in that The steps include: Step 1: Prepare for rasterization of digital map vector data, obtain metadata to calculate the grid 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 coordinates divided by the equal height interval in the metadata, and the number of horizontal and vertical grids of the grid size is obtained. The coordinate data in the digital map vector data is read into the memory and stored as surface data and line data in a unified format; Step 2: Rasterize the surface elements. Divide the surface elements into convex polygons or concave polygons. When rasterizing, find the intersection points of the convex polygons or concave polygons with the grid lines, and generate the points contained in the rasterized surface elements. The specific steps are as follows: Step 3: Grid the line elements, grid the lines according to the nodes of the line elements, the intersections of the line elements and the grid lines, and assign the grid set occupied by the line after gridding L The set of points P contained in the line L , Step 4: After the rasterization of line elements and surface elements is completed, the grid set occupied by the surface after rasterization is obtained A And the point set P contained in the surface A , the grid set occupied by the line after 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 a grid g i ; then calculate the grid g i The set of points P contained in the surface A The set P in a , calculate the grid g i The set of points P contained in the line L The set P in l ; Step 5: Based on the set P solved in step 4 a With the set P l , make a judgment.
2. The method for rapid line-falling-surface calculation based on rasterization according to claim 1, characterized in that: In the step 1, the number of horizontal and vertical grids of the grid size is 600×400, and the number of horizontal and vertical grids is a positive integer. To improve the accuracy, the number of horizontal and vertical grids is multiplied by a constant respectively, and the constant starts from 2, and the new number of horizontal and vertical grids is (600×2)×(400×2)=1200×800. The background grid is drawn according to the new number of horizontal and vertical grids.
3. The method for rapid line-falling-surface calculation based on rasterization according to claim 1, characterized in that: The specific steps of step 2 are: 2.1) Coordinates of the endpoints p of the surface element i In the process of rasterizing the surface features, the coordinate endpoints of the surface features are inserted into the point set P contained in the surface. A ={p i …}; the line segment formed by two adjacent endpoints of the surface element is the surface edge line; when the surface element is rasterized, the coordinates of the intersections formed by all horizontal grid lines and the surface edge lines are saved to the point set P contained in the surface A In the figure, the grids above and below the intersection of the face edge and the horizontal grid line are the grids occupied by the face element after rasterization. The grid value g occupied by the face i Save to the grid collection occupied by the face rasterization A = {g i …}middle; Calculate the intersection points formed by the longitudinal grid lines and the surface edges and save them to the point set P contained in the surface A The grids on the left and right sides of the intersection of the vertical grid lines are the grids occupied by the area elements after rasterization, and are saved to the occupied grids collection. A middle; 2.2) After finding the intersection points between the convex polygon and the horizontal and vertical grids in step 2.1), assign the set of points P between all grid points and the surface edge lines between the two intersection points to the surface. A In the example, assign the set of points P between all grid points and the intersection points of each longitudinal grid line and the surface edge line to the point set P contained in the surface A middle; After the intersection points of the concave polygonal face edge and the horizontal and vertical grids are found in step 2.1), each horizontal grid line has an even number of intersection points with the face edge. From left to right, the grid points between each 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 and the intersection of a grid line are the same point, that is, the point is both the endpoint of the polygon feature and the intersection of the grid line, the intersection point is not recorded repeatedly, and only the point where the endpoint of the polygon feature is contained in the polygon is recorded; 2.3) The grid points obtained in step 2.2) are all points included in the surface element. If the four grid points in a grid are all points included in the surface, then this grid is assigned to the grid set occupied by the surface. A middle.
4. The method for rapid line-falling-surface calculation based on rasterization according to claim 1, characterized in that: The details of step three are as follows: 3.1) Line feature node rasterization; The coordinates of each node on the line feature are p j Divide by the horizontal and vertical grid spacing respectively to get the grid g occupied by the line feature node j , each node on the line feature is a point contained in the line, and is saved to the point set P contained in the line L =(p j …); 3.2) Calculate the intersection points of the horizontal grid lines and line elements, and save the intersection points to the point set P contained in the line L In the figure, mark the upper and lower grids of this intersection as the grids occupied by the line grid, and change the occupied grid g j Save to the grid collection occupied by the line after rasterization L In the diagram, when the intersection point is at the intersection of the horizontal and vertical grid lines, it is not necessary to mark the grid occupied; 3.3) Calculate the intersection points of the longitudinal grid lines and line elements, and save the intersection points to the point set P contained in the line L In the figure, the left and right grids of this intersection are marked as the grids occupied by the line grid, and the occupied grid g j Save to the grid collection occupied by the line after rasterization L In the figure, when the intersection point is at the intersection of the horizontal and vertical grid lines, there is no need to mark the occupied grid.
5. The method for rapid line-falling-surface calculation based on rasterization according to claim 1, characterized in that: In step 5, when the occupied grid has both area elements and line elements, it is divided into the case where the four corner points of the occupied grid are all in the point set contained in the surface and the case where only some of the four corner points of the occupied grid are in the points contained in the surface. The specific judgment steps are as follows: 5.1) When the four corner points of the grid are all in the point set contained by the surface; When the points contained in the polygon feature are four grid points, it means that the polygon feature occupies the entire grid. If the points contained in the line feature are 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, that is, the line feature does not fall within the polygon feature. 5.2) When only some of the four corner points of the grid are included in the points of the polygon; When the points contained in the grid surface include intersection points or surface endpoints in addition to grid corner points, it means that the surface feature only occupies part of the grid, which can be divided into the following four cases: The polygon formed by the points included in the surface in the grid is judged by the geometric relationship with the line segment formed by the points included in the line. By finding the intersection point, it is judged whether the line segment of the line element in the grid and the polygon of the surface element in the grid have an intersection. If there is an intersection, it is determined that the line element falls within the surface element. If there is no intersection, it is determined that the line element is not within the range of the surface element. The geometric relationship between the polygon formed by the points contained in the surface element and the line segment formed by the points contained in the line is judged by finding the intersection point between the polygon edge and the line segment. If there is an intersection point, the line element is judged to fall within the surface element. If there is no intersection point, the line element is judged to be outside the surface element.
6. An electronic device, characterized in that: include: 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, and the one or more programs are configured to execute the method according to any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, and the program codes can be called by a processor to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Complex planar element automatic edge connection method based on a picture grid indentation technology
CN109658336A
Map data processing method and device
CN110647596A
Spark-based high-performance calculation method for result flow of massive second-third dispatch data
CN112562040A
Grid map generation method and device, moving tool and storage medium
CN115114387A
Grid and voxel positioning method based on laser observation direction, robot and chip
CN116027341A