A GIS map-based grid region dynamic calculation generation method
Patent Information
- Application Number
- CN202211359432.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-02
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2042-11-02
AI Technical Summary
[0030] This invention dynamically generates seamless, non-intersecting GIS map grids using a GIS map grid area calculation method, and can automatically determine the grid to which a target point belongs based on its GIS latitude and longitude. For example, when a GIS map grid area is added or adjusted, the method described in this invention can quickly determine whether the new grid intersects with other existing grids and whether they are seamlessly connected. After the grid area is successfully adjusted, the GIS latitude and longitude of buildings within all grids are traversed to determine the grid to which each building belongs and the building attributes are automatically updated. It can also be applied to grid-based incident handling, i.e., selecting any point on the GIS map and automatically assigning an incident handling workflow by analyzing the grid to which it belongs through an algorithm. However, when the target point is located on the adjacent edge of two grids, manual decision-making can be assisted to determine the grid to which the incident belongs.
Smart Images

Figure CN115661294B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of grid-based regional governance technology, specifically to a method for dynamically calculating and generating grid-based regions based on GIS maps. Background Technology
[0002] GIS, short for Geographic Information Science, is a technological system that, with the support of computer hardware and software systems, collects, stores, manages, calculates, analyzes, displays, and describes geographic distribution data across the entire or part of the Earth's surface (including the atmosphere). GIS technology has applications ranging from earthquake prediction by seismological bureaus and branch location selection for large banks to user distribution for startups and even travel guides in your pocket. In current urban grassroots governance processes, grid-based segmentation is frequently required for implementation. Based on this, this invention proposes a method for dynamically generating seamless, non-overlapping GIS map grids through a GIS map grid area calculation method. Summary of the Invention
[0003] The purpose of this invention is to provide a method for dynamically calculating and generating gridded areas based on GIS maps, comprising the following steps:
[0004] Step 1: Draw a grid area that has no intersections and is seamlessly connected;
[0005] Step 2: Determine that the two grids do not intersect and are seamlessly connected;
[0006] Step 3: Determine whether all drawn grids have fully covered the target GIS map area and have not exceeded it.
[0007] Furthermore, in step 1, a grid is drawn on the GIS map. The grid vertices are drawn sequentially by clicking in a clockwise or counterclockwise order. After the drawing is finished, the system connects two adjacent grid vertices to form a closed polygon based on the grid vertex drawing order, which generates a grid. The connecting lines are called grid segments. If grid segments intersect, the intersection point is also recorded as a grid intersection vertex.
[0008] The following three situations may occur in step 1:
[0009] (1) Grid 1 is a correct grid, meaning that there are no grid lines inside the grid;
[0010] (2) If grid 2 has intersections of grid line segments, but no other grid vertices are inside the grid, then this situation can still be considered a correct grid;
[0011] (3) If there is a complete closed region in grid 3, that is, there is no less than one grid vertex in the grid region, then it is an incorrect grid.
[0012] Furthermore, in step 2, the three possible outcomes for any two correct meshes are as follows:
[0013] (1) Mesh 4 and Mesh 5: When a new mesh is drawn, if all its vertices are not on any other mesh line segment and are not within any mesh area, then the mesh is drawn successfully, indicating that the meshes are not adjacent and there are gaps.
[0014] (2) Grid 1 and Grid 5: When there is a grid vertex of one grid on the grid line segment of another grid, and one of the grid line segments connected to the vertex of the grid partially or completely overlaps with the current grid line segment, the two grids are considered to be seamlessly connected, and the overlapping grid line segments are called adjacent edges.
[0015] (3) Mesh 1 and Mesh 4: If any vertex of one mesh exists within the mesh area of the other mesh, the two meshes are considered to intersect. If so, the mesh drawing is incorrect, the drawn mesh should be canceled, and a message indicating that the mesh cannot be generated should be displayed. The mesh should then be redrawn.
[0016] Furthermore, in step 3, when all grids have at least one adjacent edge with another grid, i.e., seamless connection, the grid drawing of the target GIS map area may have been completed; at this time, it is necessary to determine whether the currently drawn grid has fully covered the target GIS map area that needs to be drawn.
[0017] Furthermore, the specific implementation method for step 3 is as follows:
[0018] Determine whether the vertex set of all current grids contains all vertices of the target GIS map area, and whether the sum of the areas of all grids is equal to the sum of the areas of the target GIS map area, and whether there are no vertices of any grid outside the target GIS map area. If this condition is met, the currently drawn grid has fully covered the target GIS map area and has not exceeded it, and the dynamic drawing of the GIS grid area ends.
[0019] If any grid vertex is outside the target GIS map area, the system will prompt that the grid containing that vertex should be canceled and redrawn; or the grid vertex that is outside the grid area will be deleted, and the grid intersection vertex of the two grid segments adjacent to that vertex and the boundary of the target GIS map area will be selected as the replacement. Then the grid will be redrawn in clockwise or counterclockwise order, and then the sum of the areas of all grids will be checked to see if it is equal to the target GIS map area. If it is equal, the grid drawing of the target GIS map area is completed.
[0020] If they are not equal, the subsequent steps continue. That is, if no grid vertex is outside the target GIS map area, but the sum of the areas of all grids is less than the target GIS map area, it means that there is an unfilled grid area. Then, without changing the number of grids, the full coverage of the target GIS map area can be achieved by expanding the grids adjacent to the edge of the target GIS map area.
[0021] Furthermore, the specific steps to achieve full coverage of the target GIS map area are as follows:
[0022] ① Locate the vertices of the uncovered target GIS map area, determine the grid vertex Y that is closest to it in a straight line, and the nearest point a2 to it;
[0023] If no grid segment of the grid has an adjacent edge with the grid segment of the target GIS grid area, and point a2 is not on the grid segment of another grid, then find the nearest grid vertex f1 on the nearest grid segment of the two grid segments adjacent to point Y of point a2; determine whether point a2 is on the grid segment of another non-adjacent target GIS grid area of point f1. If it is, add point f1 and point Y to point a2 of the grid vertex set of grid A in sequence, and regenerate the grid in a clockwise or counterclockwise direction; if not, delete grid vertex a2, add grid A1 of point f1 and point Y to point a2 of the original grid vertex set of grid A in sequence, and regenerate the grid in a clockwise or counterclockwise direction.
[0024] If a grid segment in the grid has an adjacent edge to a grid segment in the target GIS grid area, and points e2 and e3 are on grid segments in the target GIS grid area, then similar to grid E, it is determined whether the grid vertex e1 of grid E closest to point Y is on a grid segment of another grid. If so, it is determined whether there is a grid vertex closer to point Y on the segment. If so, points a1 and Y are added to the grid vertex set of grid E as point e1, and then grid E1 is regenerated in a clockwise or counterclockwise direction. If there is no grid vertex closer to point Y on the segment, only point Y is added to the grid vertex set of grid E as point e1, and then the grid is regenerated in a clockwise or counterclockwise direction.
[0025] Next, follow these steps to cover all grid vertices of the GIS target area;
[0026] ② Determine whether the area of all current grids is the same as the area of the GIS target grid region. If so, end grid drawing. If not, there are multiple grids that are not adjacent. Find the grid line segments without adjacent edges that form a closed grid region. Take any point O in it and connect it to the grid vertex without adjacent edges. Then add point O between the two vertices of the grid line segments without adjacent edges. Add point O to the grid vertex set of this grid. Regenerate the grid in a clockwise or counterclockwise direction to generate new grids A2, B1, and C1.
[0027] Next, follow these steps to create a grid and fill all GIS target areas with full coverage.
[0028] ③ Finally, verify that all drawn grids have fully covered the target GIS map area and have not exceeded it.
[0029] The beneficial effects of this invention are:
[0030] This invention dynamically generates seamless, non-intersecting GIS map grids using a GIS map grid area calculation method, and can automatically determine the grid to which a target point belongs based on its GIS latitude and longitude. For example, when a GIS map grid area is added or adjusted, the method described in this invention can quickly determine whether the new grid intersects with other existing grids and whether they are seamlessly connected. After the grid area is successfully adjusted, the GIS latitude and longitude of buildings within all grids are traversed to determine the grid to which each building belongs and the building attributes are automatically updated. It can also be applied to grid-based incident handling, i.e., selecting any point on the GIS map and automatically assigning an incident handling workflow by analyzing the grid to which it belongs through an algorithm. However, when the target point is located on the adjacent edge of two grids, manual decision-making can be assisted to determine the grid to which the incident belongs. Attached Figure Description
[0031] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0032] Figure 1 These are three cases of the grid in the embodiments of the present invention;
[0033] Figure 2 This describes the connection between two grids in an embodiment of the present invention;
[0034] Figure 3 This refers to the grid of the target GIS map area drawn in this embodiment of the invention;
[0035] Figure 4 This is a full-coverage filling of the target GIS map area in this embodiment of the invention;
[0036] Figure 5 This is the second embodiment of the invention, which involves full coverage filling of the target GIS map area.
[0037] Figure 6 This is the full coverage filling of the target GIS map area in the embodiment of the present invention. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings.
[0039] Example
[0040] This embodiment proposes a method for dynamically calculating and generating GIS grids for smart communities, including the following steps:
[0041] Step 1: Draw a grid area that has no intersections and is seamlessly connected.
[0042] When a user draws a grid on a GIS map, they can click to draw grid vertices in a clockwise or counterclockwise order. After the drawing is finished, the system connects two adjacent grid vertices to form a closed polygon based on the grid vertex drawing order, thus generating a grid. The connecting lines are called grid segments. If grid segments intersect, the intersection point is also recorded as a grid intersection vertex.
[0043] It should be noted that, by default, this embodiment does not require the user to set the start and end vertices of the mesh to the same vertex.
[0044] Then there will exist as follows Figure 1 Of the three cases shown, grid 1 is a correct grid, meaning there are no grid lines inside the grid. Grid 2 has intersections of grid lines, but no other grid vertices inside the grid, so it can still be considered a correct grid. Grid 3 has a completely closed region inside the grid, meaning there is at least one grid vertex within the grid region, which is an incorrect grid.
[0045] Step 2: Determine if the two grids do not intersect and are seamlessly connected.
[0046] Any two grids form Figure 2 The situations shown are as follows: grid 1 and grid 5, grid 1 and grid 4, grid 4 and grid 5.
[0047] For example, grids 4 and 5: when a new grid is drawn, if all of its vertices are not on any other grid line segment and are not within any grid area, then the grid is drawn successfully, indicating that the grids are not adjacent and there are gaps.
[0048] For example, in grids 1 and 5: if a grid vertex of one grid is on a grid segment of another grid (excluding the grid vertex), and one of the grid segments connected to that grid vertex partially or completely overlaps with the current grid segment (i.e., the GIS latitude and longitude directions of the grid segments are the same), then the two grids are considered to be seamlessly connected, and the overlapping grid segment is called an adjacent edge.
[0049] For example, in grids 1 and 4: if any vertex of one grid exists within the grid area of the other grid, then the two grids are considered to intersect. In this case, the grid drawing is incorrect, the drawn grid should be canceled, and a message indicating that the grid cannot be generated should be displayed, and the drawing should continue.
[0050] Step 3: Determine whether all drawn grids have fully covered the target GIS map area and have not exceeded it.
[0051] When all grids have at least one adjacent edge, i.e., seamless connection, the grid drawing of the target GIS map area may have been completed. At this point, it's necessary to determine whether the currently drawn grids have fully covered the target GIS map area and have not exceeded it. For example... Figure 3 Provide an example.
[0052] Based on the above, the specific implementation method for step 3 is as follows:
[0053] First, determine whether the vertex set of all current grids contains all vertices of the target GIS map area, and whether the sum of the areas of all grids equals the sum of the areas of the target GIS map area, and whether any grid vertex is outside the target GIS map area. If this condition is met, the currently drawn grid has fully covered the target GIS map area and has not exceeded it, and the dynamic drawing of the GIS grid area ends.
[0054] If any grid vertex is outside the target GIS map area, the system will prompt that the grid containing that vertex should be canceled and redrawn. Alternatively, the system can delete the grid vertex that is outside the grid area and replace it with the grid intersection vertex where the two adjacent grid segments intersect the boundary of the target GIS map area. Then, the grid is redrawn in a clockwise or counterclockwise order, and the sum of the areas of all grids is checked to see if it equals the area of the target GIS map area. If they are equal, the grid drawing of the target GIS map area is complete.
[0055] If they are not equal, continue with the next steps. That is, if no grid vertex is outside the target GIS map area, but the sum of the areas of all grids is less than the target GIS map area, then there are unfilled grid areas. Figure 3As shown. Therefore, without changing the number of grid cells, full coverage of the target GIS map area can be achieved by expanding the grid cells adjacent to the edge of the target GIS map area. For example... Figure 4 As shown.
[0056] Furthermore, the specific steps to achieve full coverage of the target GIS map area are as follows:
[0057] ① Locate the vertices of the uncovered target GIS map area and determine the grid vertex with the closest straight-line distance to it, for example, find Figure 4 The midpoint Y, and its nearest point a2.
[0058] If no grid segment in the current grid has an adjacent edge to a grid segment in the target GIS grid region, and point a2 is not on a grid segment of another grid, then find the nearest grid vertex f1 on the nearest grid segment between the two grid segments adjacent to point Y of point a2. Determine whether point a2 is on a grid segment of another non-adjacent target GIS grid region of point f1. If it is, add point f1 and point Y to the grid vertex set of grid A after point a2, and regenerate the grid in a clockwise or counterclockwise direction; otherwise, ... Figure 5 As shown, after deleting grid vertex a2, the grid A1 and Y point of point f1 are added to the original grid vertex set of grid A in sequence, and then the grid is regenerated in a clockwise or counterclockwise direction.
[0059] If a grid segment in this grid has an adjacent edge to a grid segment in the target GIS grid area (points e2 and e3 are on grid segments in the target GIS grid area), then similar to grid E, it checks whether grid vertex e1 of grid E, which is closest to point Y, is on a grid segment of another grid. If so, it checks whether there is a grid vertex on that segment that is closer to point Y. If so, then... Figure 4 Point a1, and then point Y, are added sequentially to point e1 of the grid vertex set of grid E. The grid is then regenerated in either a clockwise or counter-clockwise direction, as follows: Figure 5 As shown, for grid E1; if there is no grid vertex closer to point Y on this line segment, then only add point Y to the grid vertex set e1 of grid E, and then regenerate the grid in a clockwise or counterclockwise direction.
[0060] Next, follow these steps to cover all grid vertices of the GIS target area.
[0061] ② Then, determine whether the area of all current grids is the same as the area of the GIS target grid region. If so, end grid drawing; otherwise, there are multiple non-adjacent grids. Figure 5As shown, find the closed grid region formed by grid line segments without adjacent edges. Take any point O within this region and connect it to a grid vertex without adjacent edges, as shown. Figure 5 As shown. Then, add point O between the two vertices of the grid line segment without adjacent edges, add point O to the grid vertex set of that grid, and regenerate the grid in a clockwise or counterclockwise direction, as shown. Figure 6 As shown, new meshes A2, B1, and C1 are generated.
[0062] Next, follow these steps to create a grid and fill all GIS target areas.
[0063] ③ Finally, verify that all drawn grids have fully covered the target GIS map area and have not exceeded it.
[0064] It should be noted that the general algorithm used in this embodiment is:
[0065] (1) Polygon area calculation: First, if a polygon has two intersecting grid segments, it is considered as two polygons and its area is calculated. When calculating the area of each polygon, the area of the triangle formed by connecting any vertex to the other vertex is added together to get the polygon area.
[0066] (2) Determining whether a point is inside a polygon: This can be done by using methods such as ray method, angle judgment, and area judgment.
[0067] ① Ray detection: Draw a straight line (two rays in opposite directions) through the target point. If the number of intersections between each ray and the edge of the polygon is odd, then the point is inside the polygon; otherwise, it is outside the polygon.
[0068] ② Angle determination: Take the target point as the vertex and form an angle with the two endpoints of one side of the polygon (the endpoints are in order of arrival). The sum of all angles is 360 degrees.
[0069] ③ Area judgment: If the sum of the areas of the triangles formed by the target point and each side of the polygon is equal to the area of the polygon, then the target point is inside; otherwise, it is outside (the principle is similar to judging the included angle, but the area calculation is more complex).
[0070] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for dynamically calculating and generating gridded areas based on GIS maps, characterized in that, Includes the following steps: Step 1: Draw a grid area that has no intersections and is seamlessly connected; Step 2: Determine that the two grids do not intersect and are seamlessly connected; Step 3: Determine whether all drawn grids have fully covered the target GIS map area and have not exceeded it; In step 2, the three possible outcomes for any two correct meshes are as follows: (1) Mesh 4 and Mesh 5: When a new mesh is drawn, if all its vertices are not on any other mesh line segment and are not within any mesh area, then the mesh is drawn successfully, indicating that the meshes are not adjacent and there are gaps; (2) Grid 1 and Grid 5: When there is a grid vertex of one grid on the grid line segment of the other grid, and one of the grid line segments connected to the grid vertex partially or completely overlaps with the current grid line segment, the two grids are considered to be seamlessly connected, and the overlapping grid line segments are called adjacent edges. (3) Mesh 1 and Mesh 4: If any vertex of one mesh is located within the mesh area of the other mesh, the two meshes are considered to intersect. If so, the mesh drawing is incorrect, the drawn mesh should be canceled, and a message indicating that the mesh cannot be generated should be displayed. The mesh should then be redrawn. In step 1, a grid is drawn on the GIS map. The grid vertices are drawn in a clockwise or counterclockwise order. After the drawing is finished, the system connects two adjacent grid vertices to form a closed polygon based on the grid vertex drawing order, which generates a grid. The connecting line is called a grid line segment. If there is an intersection of grid line segments, the intersection point is also recorded as a grid intersection vertex. When grid 1 is a correct grid, that is, there are no grid lines inside the grid; If grid 2 has intersections of grid line segments, but no other grid vertices are inside the grid, then this situation can still be considered a correct grid. A grid is considered faulty if there is a completely closed region within the grid, meaning there is at least one grid vertex within the grid region. When all grids have at least one adjacent edge to another grid, i.e., seamless connection, the grid drawing of the target GIS map area is completed; at this point, it is necessary to determine whether the currently drawn grid has fully covered the target GIS map area to be drawn.
2. The method according to claim 1, characterized in that, By default, it is not necessary to set the start and end vertices of the mesh to the same vertex.
3. The method according to claim 1, characterized in that, The specific implementation method for step 3 is as follows: If the current set of vertices of all grids contains all vertices of the target GIS map area, and the sum of the areas of all grids equals the sum of the areas of the target GIS map area, and no grid vertex is outside the target GIS map area, then the current grid drawing has fully covered the target GIS map area and has not exceeded it, and the dynamic drawing of the GIS grid area ends. If any grid vertex is outside the target GIS map area, a message will be displayed indicating that the grid containing that vertex should be canceled and redrawn. Alternatively, delete the vertices of the grid that extend beyond the grid area, and replace them with the grid intersection vertices where the two adjacent grid line segments intersect the boundary of the target GIS map area. Then, redraw the grid in a clockwise or counterclockwise order, and then check whether the sum of the areas of all grids is equal to the target GIS map area. If they are equal, the grid drawing of the target GIS map area is complete. If they are not equal, the subsequent steps continue. That is, if no grid vertex is outside the target GIS map area, but the sum of the areas of all grids is less than the target GIS map area, it means that there is an unfilled grid area. Then, without changing the number of grids, the grids adjacent to the edge of the target GIS map area are expanded to achieve full coverage filling of the target GIS map area.
4. The method according to claim 3, characterized in that, The specific steps to achieve full coverage of the target GIS map area are as follows: (1) Find the vertex Y of the uncovered target GIS map area and determine the grid vertex a2 that is closest to it in a straight line; If no grid segment in the grid has an adjacent edge to the grid segment of the target GIS grid area, and point a2 is not on the grid segment of another grid, then find the nearest grid vertex f1 on the nearest grid segment of the two grid segments adjacent to point Y of point a2; determine whether point a2 is on the grid segment of another non-adjacent target GIS grid area of point f1. If it is, add point f1 and point Y to point a2 in the grid vertex set of grid A in sequence, and regenerate the grid in a clockwise or counterclockwise direction; if not, delete grid vertex a2, add point f1 and point Y to point a2 in the original grid vertex set of grid A in sequence, and regenerate the grid in a clockwise or counterclockwise direction. If a grid segment has an adjacent edge to a grid segment in the target GIS grid area, and points e2 and e3 are on grid segments in the target GIS grid area, then the grid pattern is E. Next, it is determined whether the grid vertex e1 of the grid E closest to point Y is on a grid segment of another grid. If so, it is determined whether there is a grid vertex closer to point Y on that segment. If so, points a1 and Y are added to the grid vertex set of grid E as point e1, and then grid E1 is regenerated in a clockwise or counterclockwise direction. If there is no grid vertex closer to point Y on that segment, only point Y is added to the grid vertex set of grid E as point e1, and then the grid is regenerated in a clockwise or counterclockwise direction. Next, follow these steps to cover all grid vertices of the GIS target area; (2) Determine whether the area of all current grids is the same as the area of the GIS target grid area. If so, end grid drawing. If not, there are multiple grids that are not adjacent. Find the grid line segments without adjacent sides in the grid and form a closed grid area. Take any point O in it and connect it with the grid vertex without adjacent sides. Then add point O between the two vertices of the grid line segments without adjacent sides. Add point O to the grid vertex set of the grid. Regenerate the grid in a clockwise or counterclockwise direction to generate new grids A2, B1, and C1. Next, follow these steps to create a grid and fill all GIS target areas with full coverage. (3) Finally, verify that all grids drawn have been fully covered and have not exceeded the target GIS map area to be drawn.
Citation Information
Patent Citations
Map data processing method and device, electronic equipment and storage medium
CN114419185A
Grid drawing method and device, electronic equipment and computer readable storage medium
CN114627206A