Regional map graph merging method and apparatus
By searching for the nearest boundary point in adjacent area map graphics and merging gap sub-regions, the problem of not being able to merge map graphics in the prior art is solved, realizing the formation of single-loop map graphics and improving the intuitiveness of map display.
Patent Information
- Application Number
- CN202210305367.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2042-03-25
AI Technical Summary
Existing map processing functions cannot effectively merge map graphics of adjacent areas, resulting in the inability to merge them from a graphical perspective, which affects the intuitiveness of map display.
By searching for the two nearest boundary points in adjacent area map graphics, determining whether their distance is less than a preset error distance, and searching for gap sub-regions with a width less than the error distance in the gap region and merging them, a single-loop merged map graphic is formed.
It effectively merges adjacent map graphics to form a single-loop merged map graphic, improving the intuitiveness of map display.
Smart Images

Figure CN114596387B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to a method and apparatus for merging regional map graphics. Background Technology
[0002] Currently, there is a need in certain scenarios to merge multiple adjacent areas on a map into a larger area. For example, it may be necessary to merge map images of multiple areas within the same administrative region to more intuitively display each administrative region.
[0003] Existing map processing functions simply place the boundary points of multiple regions into the same set to indicate that the multiple regions belong to the same set. For example, two adjacent regions can be merged into one large region, and the boundaries of the map graphics of these two regions are each represented by four coordinate points.
[0004] The four coordinate points on the boundary of the map of the first region A are as follows:
[0005] A1: (120.23704541565495, 30.259403153190103),
[0006] A2: (120.245214173442, 30.25769670986258),
[0007] A3: (120.23712486714516, 30.256547190518503),
[0008] A4: (120.23704541565495, 30.259403153190103);
[0009] The four coordinate points on the boundary of the map in the second region B are as follows:
[0010] B1: (120.23582159711295, 30.26536585304578),
[0011] B2: (120.2315190385622, 30.26186717323703),
[0012] B3: (120.23644791892727, 30.25983409875913),
[0013] B4: (120.23582159711295, 30.26536585304578).
[0014] Existing map processing functions use the following set to represent that regions A and B belong to the same large region:
[0015] 【MULTIPOLYGON(((120.2370454156549530.259403153190103,120.24521417344230.25769670986258,120.23712486714516 30.256547190518503,120.2370454156549530.259403153190103)),((120.23582159711295 30.26536585304578,120.231519038562230.26186717323703,120.2364479189272730.25983409875913,120.2358215971129530.26536585304578)))).
[0016] It is evident that existing map processing functions do not merge the map graphics that need to be merged by combining their perspectives. Summary of the Invention
[0017] This invention provides a method, apparatus, non-transient computer-readable storage medium, and computer program product for merging regional map graphics, so as to merge map graphics of adjacent regions into a single-loop map graphic.
[0018] The technical solution of this invention is implemented as follows:
[0019] A method for merging regional map graphics, the method comprising:
[0020] Search for the two closest boundary points in the first and second regional map graphics, where the first boundary point is located at the boundary of the first regional map graphics and the second boundary point is located at the boundary of the second regional map graphics.
[0021] Determine whether the distance between the first boundary point and the second boundary point is less than the preset error distance;
[0022] If the width is less than the preset error distance, in the gap area between the first area map graphic and the second area map graphic, search for each gap sub-region whose width is always less than the preset error distance. If a gap sub-region is found, merge the searched gap sub-region with the first area map graphic and the second area map graphic to obtain a single-loop merged map graphic.
[0023] A regional map graphics merging device, the device comprising: a processor and a memory, wherein:
[0024] The memory stores a computer program or instructions configured to cause the processor to perform the steps of the regional map graphic merging method as described in any one of claims 1 to 7 when executed by the processor.
[0025] A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, cause the processor to perform the steps of the regional map graphic merging method as described in any of the preceding claims.
[0026] A computer program product includes a computer program or instructions that, when executed by a processor, implement the steps of the regional map graphic merging method as described in any of the preceding claims.
[0027] In this embodiment of the invention, the closest distance between the boundaries of the first region map graphic and the second region map graphic is first determined. If the closest distance is less than a preset error distance, the gap between the first region map graphic and the second region map graphic with a width less than the preset error distance is filled, and finally a single-loop merged map graphic is obtained, thereby realizing the merging of adjacent region map graphics. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a flowchart of a regional map graphic merging method provided in an embodiment of the present invention;
[0030] Figure 2-1 The original graphics of the first and second area map graphics in an example of the present invention;
[0031] Figure 2-2 To determine the boundary points based on the first and second boundary points, Figure 2-1 The first example image of the first merged map is obtained by bridging the first regional map graphic and the second regional map graphic shown.
[0032] Figure 2-3 To determine the boundary points based on the first and second boundary points, Figure 2-1 The first and second area map graphics shown are bridged together to obtain a second example image of the first merged map graphics.
[0033] Figure 2-4 for Figure 2-2A schematic diagram of the third closed figure T3 formed by the gap region in the middle;
[0034] Figure 2-5 According to Figure 2-2 A schematic diagram of the fourth closed figure T4 obtained;
[0035] Figure 3-1 This is the original graphic of the first area map and the second area map in another example of the present invention;
[0036] Figure 3-2 To Figure 3-1 The diagram shown illustrates the merging of the first and second region map graphics by connecting them with line segments.
[0037] Figure 3-3 If Figure 3-1 The diagram shows a merged map obtained by connecting the initial boundary point sets of the first and second region map graphics with line segments when the drawing directions are opposite.
[0038] Figure 4 This is an example of determining the drawing direction corresponding to the initial set of boundary points of the graphic to be judged in this invention. Figure 1 ;
[0039] Figure 5 Figure 2 is an example of the drawing direction corresponding to the initial set of boundary points of the graphic to be judged in this invention;
[0040] Figure 6 Figure 3 is an example of the drawing direction corresponding to the initial set of boundary points of the graphic to be judged in this invention;
[0041] Figure 7 This is an example of determining the drawing direction corresponding to the initial set of boundary points of the graphic to be judged in this invention. Figure 4 ;
[0042] Figure 8 This is an example of determining the drawing direction corresponding to the initial set of boundary points of the graphic to be judged in this invention. Figure 5 ;
[0043] Figure 9 This is a schematic diagram of the structure of the regional map graphic merging device provided in an embodiment of the present invention;
[0044] Figure 10 This is an exemplary structural diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0046] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0047] The technical solution of the present invention will be described in detail below with reference to specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0048] This invention proposes a method for merging regional map graphics. In this method, two closest boundary points are searched in a first regional map graphic and a second regional map graphic, denoted as a first boundary point and a second boundary point, respectively. The first boundary point is located on the boundary of the first regional map graphic, and the second boundary point is located on the boundary of the second regional map graphic. It is then determined whether the distance between the first and second boundary points is less than a preset error distance. If it is less, a search is conducted in the gap region between the first and second regional map graphics for each gap sub-region whose width is always less than the preset error distance. If found, the searched gap sub-regions are merged with the first and second regional map graphics to obtain a final single-loop merged map graphic. This invention achieves the merging of adjacent regional map graphics.
[0049] Figure 1 The flowchart of a regional map graphic merging method according to an embodiment of the present invention is as follows:
[0050] Step 101: Search for the two closest boundary points in the first and second regional map graphics. Let these two boundary points be the first boundary point and the second boundary point, respectively. The first boundary point is located on the boundary of the first regional map graphics, and the second boundary point is located on the boundary of the second regional map graphics.
[0051] In one optional embodiment, before step 101, the process further includes: determining whether the first region map graphic and the second region map graphic overlap; if so, determining that the two graphics cannot be merged and ending the process; otherwise, executing step 101.
[0052] Step 102: Determine whether the distance between the first boundary point and the second boundary point is less than the preset error distance.
[0053] The preset error distance can be set in advance according to the actual situation.
[0054] Step 103: If the width is less than the preset error distance, search for sub-regions within the gap between the first and second regional map graphics. If found, merge these sub-regions with the first and second regional map graphics to obtain the final single-loop merged map. For the gap between the first and second regional map graphics, some boundary points on the boundary of this gap are located on the first regional map, while others are located on the second regional map. The "width" in this step refers to the distance between the boundary points on the first and second regional map graphics within the gap. For example, for any boundary point A on the first regional map graphics within the gap... i If A i If the distances between A and multiple consecutive boundary points on the second region map are all less than the preset error distance, then A i The sub-gap region between these multiple consecutive boundary points is the region that can be merged with the first region map graphic and the second region map graphic.
[0055] In this step, "single loop" refers to a loop in which all boundary points on the merged map are linked together in a specific order (e.g., clockwise or counterclockwise).
[0056] In the above embodiment, the closest distance between the boundaries of the first region map graphic and the second region map graphic is first determined. If the closest distance is less than the preset error distance, the gap between the first region map graphic and the second region map graphic with a width less than the preset error distance is filled, and finally a single-loop merged map graphic is obtained, thereby realizing the merging of adjacent region map graphics.
[0057] In one optional embodiment, prior to step 101, the method further includes: enriching the coordinate points of the initial boundary point sets of the first and second region map graphics through the following process:
[0058] Step 01: Take the initial set of boundary points of the first region map and the second region map as the set of boundary points to be enriched, and perform the following processing on each set of boundary points to be enriched:
[0059] Step 02: Calculate the number of boundary points contained in the set of boundary points to be enriched;
[0060] Step 03: Read one boundary point from the set of boundary points to be enriched as the current boundary point;
[0061] Step 04: Calculate the sum of the preset error distance plus 1, calculate the distance between the current boundary point and the next boundary point in the set of boundary points to be enriched, calculate the quotient of the distance and the sum, round the quotient down and then subtract 1. The difference is the number of boundary points that should be added between the current boundary point and the next boundary point. Add the corresponding number of boundary points between the current boundary point and the next boundary point according to this number, and add the corresponding number of added boundary points to the set of boundary points to be enriched. Repeat Step 04 until the last boundary point in the set of boundary points to be enriched is completed. The next boundary point of the last boundary point in the set of boundary points to be enriched is the first boundary point in the set of boundary points to be enriched.
[0062] For example, if M boundary points need to be added between the current boundary point and the next boundary point, then calculate: sx = (longitude of the next boundary point - longitude of the current boundary point) / (M+1) and sy = (latitude of the next boundary point - latitude of the current boundary point) / (M+1), where sx and sy are the longitude interval and latitude interval between the newly added adjacent boundary points, respectively.
[0063] Furthermore, in step 101, searching for the two closest boundary points in the first and second regional map graphics includes: calculating the distance between each pair of boundary points in the first and second regional map graphics based on the enriched boundary point set of the first and second regional map graphics.
[0064] In an optional embodiment, step 103, in the gap region between the first region map graphic and the second region map graphic, searching for each gap sub-region whose width is always less than a preset error distance, may specifically include the following steps 1031-1032:
[0065] Step 1031: Based on the first boundary point and the second boundary point, bridge the first region map graphic and the second region map graphic to obtain the first merged map graphic of a single loop.
[0066] Here, "bridging" is used to merge the set of boundary points of the first region map and the set of boundary points of the second region map into a single-loop set of boundary points.
[0067] Step 1032: In the largest closed shape that can be formed by the boundary points of the first merged map graphic, search for each gap sub-region whose width is always less than the preset error distance. If a gap sub-region is found, merge the searched gap sub-region with the first merged map graphic to obtain the final single-loop merged map graphic.
[0068] Here, "maximum closed shape" refers to bridging the gap sub-regions between the first and second map shapes whose width is always less than the preset error distance, that is, merging them into the first or second map shape.
[0069] In one optional embodiment, step 1031 may specifically include the following steps 10311-10313:
[0070] Step 10311: Take the first boundary point as the starting boundary point of the first boundary point set, and take the second boundary point as the starting boundary point of the second boundary point set, and the drawing direction of the boundary points in the first boundary point set is the same as the drawing direction of the boundary points in the second boundary point set; wherein, the first boundary point set contains the boundary points on the boundary of the first area map graphic arranged in order of drawing direction, and the second boundary point set contains the boundary points on the boundary of the second area map graphic arranged in order of drawing direction;
[0071] Step 10312: Calculate the distance between the second boundary point of the first boundary point set and the last boundary point of the second boundary point set, and set it as the first distance; calculate the distance between the last boundary point of the first boundary point set and the second boundary point of the second boundary point set, and set it as the second distance;
[0072] Step 10313: Determine whether the first distance is less than the second distance. If it is less, delete the first boundary point from the first boundary point set, then merge the first boundary point set and the second boundary point set, and add the starting boundary point of the first boundary point set to the end of the merged boundary point set to obtain the boundary point set of the first merged map graphic. The starting boundary point of the second boundary point set follows immediately after the last boundary point of the first boundary point set.
[0073] If it is not smaller than the preset threshold, the second boundary point is removed from the second boundary point set, then the first boundary point set and the second boundary point set are merged, and the first boundary point is added to the end of the merged boundary point set to obtain the boundary point set of the first merged map graphic, wherein the starting boundary point of the second boundary point set immediately follows the last boundary point of the first boundary point set.
[0074] Figure 2-1 shows the original graphics of the first area map graphic and the second area map graphic in an example of the present invention, wherein the left side is the first area map graphic and the right side is the second area map graphic. The boundary point set of the first area map graphic: the first boundary point set is: S1 = (A1, A2, A3, ..., A n ), where A1 is the first boundary point described in step 101; the boundary point set of the second area map graphic: the second boundary point set is: S2 = (B1, B2, B3, ..., B m ), where B1 is the second boundary point described in step 101.
[0075] Figure 2-2 , Figure 2-3 respectively show the first example diagram and the second example diagram of the first merged map graphic obtained by bridging the first area map graphic and the second area map graphic shown in Figure 2-1 according to the first boundary point and the second boundary point, wherein:
[0076] First, the distance between the second boundary point A2 of the first boundary point set and the last boundary point B m of the second boundary point set is calculated, which is set as the first distance d1; the distance between the last boundary point A n of the first boundary point set and the second boundary point B2 of the second boundary point set is calculated, which is set as the second distance d2;
[0077] As shown in Figure 2-2 , if d1 < d2, then A1 is removed from the first boundary point set S1, and then S1 and S2 are merged to obtain the boundary point set S = (A2, A3, ..., A n , B1, B2, B3, ..., B m ) of the first merged map graphic. Here, to make S more like a closed graphic, A2 can also be added to the end of S. For convenience of description, in this embodiment, A2 is not added to the end of S, but since S corresponds to the boundary point set of the first merged map graphic, it still essentially represents the boundary / contour of a map graphic with connected head and tail.
[0078] As shown in Figure 2-3As shown, if d1 ≥ d2, then B1 is removed from the second boundary point set S2, and then S1 and S2 are merged to obtain the boundary point set S = (A1, A2, A3, ..., A...). n ,B2,B3,...,B m To make S resemble a closed shape, A1 can be added to the end of the merged boundary point set S. For ease of description, in this embodiment, A1 is not added to the end of S. However, since S corresponds to the boundary point set of the first merged map shape, it essentially still represents the boundary / outline of a map shape with its head and tail connected.
[0079] In an optional embodiment, step 1032, in the largest closed shape that can be formed by the boundary points of the first merged map graphic, searching for each gap sub-region whose width is always less than a preset error distance, may specifically include the following steps 10321-10327:
[0080] Step 10321: Take one boundary point from the set of boundary points of the first merged map graphic in sequence and set it as the current boundary point;
[0081] Step 10322: Among the boundary points in the boundary point set of the first merged map graphic that are located after the current boundary point, take out the boundary point with the first preset length and put it into the temporary boundary point set; wherein, the length of the temporary boundary point set must be equal to the preset length. When the last boundary point of the boundary point set of the first merged map graphic is taken, and the length of the temporary boundary point set is still not equal to the preset length, then continue to take from the first boundary point of the boundary point set of the first merged map graphic until the length of the temporary boundary point set is equal to the preset length.
[0082] In one optional embodiment, the preset length is within the range of: not less than one-sixth of the number of boundary points in the boundary point set of the first merged map graphic, and not greater than one-half of the number of boundary points in the boundary point set of the first merged map graphic.
[0083] Step 10323: Calculate the distance between the current boundary point and each boundary point in the temporary boundary point set;
[0084] Step 10324: Determine whether there is a distance less than the preset error distance among the calculated distances. If there is, select the boundary point with the largest number of boundary points between the current boundary point and the boundary point corresponding to the distance less than the preset error distance, and use the selected boundary point as the selected boundary point.
[0085] Step 10325: Combine the current boundary point, the selected boundary point, and the boundary points in the first merged map graph set that are located before the current boundary point and after the selected boundary point to form a closed map graph, which is set as the third map graph;
[0086] Step 10326: Remove all boundary points (excluding the current boundary point and the selected boundary point) located between the current boundary point and the selected boundary point on the boundary of the first merged map graphic from the boundary point set of the first merged map graphic, and use the closed shape formed by the remaining boundary points of the boundary point set of the first merged map graphic as the fourth map graphic.
[0087] It should be noted that the boundary point mentioned in the embodiments of the present invention, located between any two points such as point A and point B, does not include points A and B.
[0088] Step 10327: Determine whether the third map graphic is contained in the fourth map graphic. If so, update the first merged map graphic with the fourth map graphic and return to step 10321. Continue until the current boundary point is the last boundary point of the first merged map graphic, and then use the first merged map graphic at this time as the final merged map graphic. Otherwise, return directly to step 10321 until the current boundary point is the last boundary point of the first merged map graphic, and then use the first merged map graphic at this time as the final merged map graphic.
[0089] by Figure 2-2 For example, steps 10321-10327 will be explained in detail:
[0090] like Figure 2-2 As shown, the set of boundary points S = (A2, A3, ..., A...) of the first merged map graphic is... n ,B1,B2,B3,...,B m ),but:
[0091] Execute step 10321: Take one boundary point from S in sequence as the current boundary point CurE;
[0092] The first boundary point taken from S is A2, i.e., CurE = A2;
[0093] Execution step 10322: Starting from the third boundary point in S after CurE, take out the first preset number of boundary points in sequence and put them into the temporary boundary point set St;
[0094] Let the preset length L = p - 4, where L is 1 / 3 of the number of boundary points contained in S. For example: if CurE = A2, then St = (A5, A6, ..., A p ).
[0095] Execute step 10323: Calculate the distance between each boundary point in CurE and St, and a total of p-4 distances will be calculated;
[0096] For example: If CurE = A2, then calculate A2 and St = (A5, A6, ..., A p The distance between each boundary point in ).
[0097] Execute step 10324: Determine whether there is a distance less than the preset error distance among the p-4 distances. If there is, select the boundary point with the most boundary points that are separated from CurE from the boundary points in St corresponding to the distance less than the preset error distance. Let the selected boundary point be represented as MindE.
[0098] If it does not exist, return to step 10321, continue to extract the next boundary point from S as the current boundary point CurE, and then continue to execute the subsequent steps;
[0099] For example: For Figure 2-2 For boundary point A2 in the p-4 distances, if there is no distance less than the preset error distance, then return to step 10321: take the second boundary point A3 from S as the current boundary point CurE, and then continue to execute the subsequent steps.
[0100] like Figure 2-2 As shown, suppose when CurE = B m-2 At that time, calculate B m-2 The distance dx between A4 and B is less than the preset error distance, and, in relation to B m-2 Among the boundary points in St corresponding to the distance between points less than the preset error distance, A4 is the point of intersection with B. m-2 The boundary point with the most interval boundary points is then executed, and step 10325 continues.
[0101] Execute step 10325: Combine CurE, MindE, and all boundary points in S that are before CurE and after MindE to form a closed map shape, and set it as the third map shape;
[0102] Execute step 10326: Delete all boundary points in S located between CurE and MindE from S, and use the closed shape formed by the remaining boundary points in S as the fourth map shape.
[0103] Execute step 10327: Determine whether the third map graphic is included in the fourth map graphic. If so, update the first merged map graphic with the fourth map graphic (i.e. update the set of boundary points S of the first merged map graphic), return to step 10321, and sequentially take the next boundary point from the updated S as the current boundary point CurE until CurE is the last boundary point in the current S. Then, take the first merged map graphic at this time as the final merged map graphic.
[0104] For steps 10325-10327, Figure 2-2 For example, suppose when CurE = B m-2 At that time, calculate B m-2 The distance dx between A4 and B is less than the preset error distance, and, in relation to B m-2 Among the boundary points in St corresponding to the distance between points less than the preset error distance, A4 is the point of intersection with B. m-2 The boundary point with the most interval boundary points is:
[0105] In step 10325, B m-2 A4, and S located in B m-2 B after that m-1 B m The six points A3 and A2, located before A4, together form a third closed figure, as shown below. Figure 2-4 The third closed figure T3 in the diagram;
[0106] In step 10326, the part of S located at B m-2 B after that m-1 B m The four points A3 and A2, located before A4, are deleted from S, resulting in a new set of boundary points S4. The closed shape formed by all the boundary points in S4 is used as the fourth map figure, as shown below. Figure 2-5 The fourth closed figure T4 in the diagram;
[0107] In step 10327, it is determined whether T3 is contained in T4, such as... Figure 2-4 , 2-5 As shown, T3 is contained within T4, so the first merged map graphic is updated with T4, and the updated first merged map graphic is... Figure 2-5 As shown in the diagram, T4 corresponds to the set of boundary points S = (A4, A5, ..., A...). n ,B1,B2,B3,...,B m-2 Therefore, we know that: the current CurE = B m-2 B m-2If the last boundary point in the updated S is already set, there is no need to return to step 10321. The first merged map graph T4 at this point is taken as the final merged map graph.
[0108] In step 102, if it is determined that the distance between the first boundary point and the second boundary point is not less than the preset error distance, then the first boundary point and the second boundary point are connected by a line segment to obtain the final merged map graphic.
[0109] In one optional embodiment, after connecting the first boundary point and the second boundary point with line segments to obtain the final merged map graphic, the method further includes: determining whether the initial drawing directions of the boundaries of the first region map graphic and the second region map graphic are the same based on the initial boundary point set of the first region map graphic and the initial boundary point set of the second region map graphic; if they are not the same, then reversing the initial boundary point set of the first region map graphic and merging it with the initial boundary point set of the second region map graphic to obtain the boundary point set of the merged map graphic; or, if they are not the same, then reversing the initial boundary point set of the second region map graphic and merging it with the initial boundary point set of the first region map graphic to obtain the boundary point set of the merged map graphic.
[0110] Here, the "initial boundary point set" of the first region map and the "initial boundary point set" of the second region map refer to the boundary point sets of the first region map and the second region map before any processing using the method provided in this embodiment (i.e., before the implementation of this embodiment). Before the implementation of this embodiment, boundary points on the boundaries of the first and second region map are sampled. The boundary points sampled on the boundary of the first region map constitute the "initial boundary point set" of the first region map, and the boundary points sampled on the boundary of the second region map constitute the "initial boundary point set" of the second region map. The boundary points in both the "initial boundary point set" of the first and second region map are arranged in a specific order (clockwise or counterclockwise).
[0111] Figure 3-1 In another example of the present invention, the original graphics of the first and second region map graphics are shown. The distance between the nearest first and second boundary points of the first region map graphics on the left and the second region map graphics on the right is greater than a preset error distance. Therefore, a line segment is used to connect the first and second boundary points, resulting in a merged map graphics as shown below. Figure 3-2 As shown.
[0112] After obtaining the merged map graphics, the boundaries of the merged map graphics need to be represented by a set of boundary points. At this time, since the drawing direction represented by the initial boundary point set of the first region map graphics and the drawing direction represented by the initial boundary point set of the second region map graphics may be different, for example, the drawing direction represented by the initial boundary point set of the first region map graphics is clockwise, while the drawing direction represented by the initial boundary point set of the second region map graphics is counterclockwise, then the initial boundary point sets of the two region map graphics cannot be directly merged to become the boundary point set of the merged map graphics. Instead, the drawing direction of the boundary point set of one of the region map graphics should be reversed first.
[0113] like Figure 3-1 As shown, if the initial boundary point set of the first region map on the left represents a clockwise drawing direction, and the initial boundary point set of the second region map on the right represents a counter-clockwise drawing direction, then after merging the two, if the drawing direction of one of the region map graphics is not reversed, the resulting merged map will look like... Figure 3-3 As shown, the map of the second area on the right is distorted.
[0114] In one optional embodiment, determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same, based on the initial boundary point set of the first region map graphics and the initial boundary point set of the second region map graphics, includes:
[0115] Select either the first or second region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following conditions: the initial boundary point set of the map to be judged includes a third boundary point with the minimum longitude and minimum latitude and a fourth boundary point with the maximum longitude and maximum latitude; wherein the third boundary point and the fourth boundary point are different boundary points; the coordinates of each boundary point are expressed in longitude and latitude.
[0116] If the condition is met, then determine whether the third boundary point in the initial set of boundary points is located before the fourth boundary point.
[0117] If it is located, calculate the average slope of all line segments between the origin and each boundary point in the initial boundary point set located between the third and fourth boundary points, and set it as the first average slope. Also calculate the average slope of all line segments between the origin and each boundary point in the initial boundary point set located before the third boundary point and after the fourth boundary point, and set it as the second average slope. If the first average slope is less than the second average slope, the initial drawing direction of the boundary of the figure to be judged is determined to be counterclockwise; otherwise, it is clockwise. The origin is usually a point where both longitude and latitude are 0.
[0118] If not located, calculate the average slope of all line segments between the origin and each boundary point in the initial boundary point set located between the fourth and third boundary points, and set it as the first average slope. Also calculate the average slope of all line segments between the origin and each boundary point in the initial boundary point set located before the fourth boundary point and after the third boundary point, and set it as the second average slope. If the first average slope is greater than the second average slope, then determine that the initial drawing direction of the boundary of the graphic to be judged is counterclockwise; otherwise, it is clockwise.
[0119] If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
[0120] Figure 4 Example of determining the drawing direction corresponding to the initial set of boundary points of the graphic to be judged. Figure 1 .
[0121] It should be noted that my country's latitude and longitude range is 73°33′E to 135°05′E, and its latitude range is 3°51′N to 53°33′N. Figures 4-8 Examples 1 through 5 shown are all within the territory of China, with the origin at 0 longitude and 0 latitude.
[0122] like Figure 4 As shown, let A to D be four boundary points on the map to be judged, where the minimum longitude and minimum latitude are both located at point A, and the maximum longitude and maximum latitude are both located at point C. Then:
[0123] 1) If point A is listed before point C in the initial set of boundary points of the map to be judged, then:
[0124] For each boundary point between points A and C in the initial set of boundary points of the map graphic to be judged, calculate the slope of the line segment between each boundary point and the origin, and then take the average of all the calculated slopes to obtain the first average slope.
[0125] For each boundary point in the initial set of boundary points of the map graphic to be judged that is before point A and after point C, calculate the slope of the line segment between each boundary point and the origin, and then take the average of all the calculated slopes to obtain the second average slope.
[0126] If the first average slope is less than the second average slope, then the drawing direction corresponding to the initial boundary point set of the figure to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0127] 2) If point A is after point C in the initial set of boundary points of the map to be judged, then:
[0128] For each boundary point between points C and A in the initial boundary point set of the map graphic to be judged, calculate the slope of the line segment between each boundary point and the origin, and then take the average of all the calculated slopes to obtain the first average slope.
[0129] For each boundary point in the initial set of boundary points of the map to be judged that is before point C and after point A, calculate the slope of the line segment between each boundary point and the origin, and then take the average of all the calculated slopes to obtain the second average slope.
[0130] If the first average slope is greater than the second average slope, then the drawing direction corresponding to the initial boundary point set of the figure to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0131] In one optional embodiment, determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same, based on the initial boundary point set of the first region map graphics and the initial boundary point set of the second region map graphics, includes:
[0132] Select either the first or second region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following conditions: the initial boundary point set of the map to be judged includes a fifth boundary point with the minimum longitude and maximum latitude and a sixth boundary point with the maximum longitude and minimum latitude; wherein the fifth and sixth boundary points are different boundary points; the coordinates of each boundary point are expressed in longitude and latitude.
[0133] If the condition is met, then determine whether the fifth boundary point in the initial set of boundary points is located after the sixth boundary point.
[0134] If it is located, calculate the average distance between the origin and each boundary point in the initial boundary point set located between the sixth and fifth boundary points, and set it as the first average distance. Also calculate the average distance between the origin and each boundary point in the initial boundary point set located before the sixth boundary point and after the fifth boundary point, and set it as the second average distance. If the first average distance is greater than the second average distance, determine that the initial drawing direction of the boundary of the graphic to be judged is counterclockwise; otherwise, it is clockwise.
[0135] If not located, calculate the average distance between the origin and each boundary point in the initial boundary point set located between the fifth and sixth boundary points, and set it as the first average distance. Also calculate the average distance between the origin and each boundary point in the initial boundary point set located before the fifth boundary point and after the sixth boundary point, and set it as the second average distance. If the first average distance is less than the second average distance, determine that the initial drawing direction of the boundary of the graphic to be judged is counterclockwise; otherwise, it is clockwise.
[0136] If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
[0137] Figure 5 Example Figure 2 shows the drawing direction corresponding to the initial set of boundary points of the graphic to be judged. Figure 5 As shown, let A to D be four boundary points on the map to be judged, where the minimum longitude and maximum latitude are located at point A, and the maximum longitude and minimum latitude are located at point C. Then:
[0138] 1) If point A is after point C in the initial set of boundary points of the map to be judged, then:
[0139] For each boundary point located between points C and A in the initial set of boundary points of the map graphic to be judged, calculate the distance between each boundary point and the origin, and then take the average of all the calculated distances to obtain the first average distance;
[0140] For each boundary point in the initial set of boundary points of the map graphic to be judged that is before point C and after point A, calculate the distance between each boundary point and the origin, and then take the average of all the calculated distances to obtain the second average distance.
[0141] If the first average distance is greater than the second average distance, then the drawing direction corresponding to the initial boundary point set of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0142] 2) If point A is ranked before point C in the initial boundary point set of the map to be judged, then:
[0143] For each boundary point between points A and C in the initial set of boundary points of the map graphic to be judged, calculate the distance between each boundary point and the origin, and then take the average of all the calculated distances to obtain the first average distance;
[0144] For each boundary point in the initial set of boundary points of the map graphic to be judged that is before point A and after point C, calculate the distance between each boundary point and the origin, and then take the average of all the calculated distances to obtain the second average distance;
[0145] If the first average distance is less than the second average distance, then the drawing direction corresponding to the initial boundary point set of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0146] In one optional embodiment, determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same, based on the initial boundary point set of the first region map graphics and the initial boundary point set of the second region map graphics, includes:
[0147] Select either the first or second region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following conditions: the initial boundary point set of the map to be judged includes a seventh boundary point with the minimum longitude, an eighth boundary point with the maximum longitude, and a ninth boundary point with the maximum latitude, and the seventh boundary point or / and the eighth boundary point have the minimum latitude. Among these conditions, the seventh, eighth, and ninth boundary points are different boundary points. The coordinates of each boundary point are expressed in longitude and latitude.
[0148] Determine whether the initial set of boundary points of the figure to be judged simultaneously satisfies both Condition 1 and Condition 2, or satisfies Condition 3:
[0149] Condition 1: The seventh boundary point is located before the eighth boundary point;
[0150] Condition 2: The ninth boundary point is located before the seventh boundary point, or the ninth boundary point is located after the eighth boundary point;
[0151] Condition 3: The seventh boundary point is located after the eighth boundary point, and the ninth boundary point is located between the eighth boundary point and the seventh boundary point;
[0152] If the conditions are met, the initial drawing direction of the boundary of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0153] If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
[0154] Figure 6 Example Figure 3 shows the drawing direction corresponding to the initial set of boundary points of the graphic to be judged. Figure 6As shown, let A to D be four boundary points on the map to be judged, where the minimum longitude is located at point A, the maximum longitude is located at point B, the minimum latitude is located at both points A and B, and the maximum latitude is located at point C. Then:
[0155] 1) If point A is listed before point B in the initial set of boundary points of the map to be judged, then:
[0156] If point C is placed before point A or after point B in the initial boundary point set of the map to be judged, then the drawing direction corresponding to the initial boundary point set of the map to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0157] 2) If point A is after point B in the initial set of boundary points of the map to be judged, then:
[0158] If point C is located between points B and A in the initial boundary point set of the map to be judged, then the drawing direction corresponding to the initial boundary point set of the map to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0159] In one optional embodiment, determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same, based on the initial boundary point set of the first region map graphics and the initial boundary point set of the second region map graphics, includes:
[0160] Select either the first or second region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following conditions: the initial boundary point set of the map to be judged includes the tenth boundary point with the minimum longitude, the eleventh boundary point with the maximum longitude, and the twelfth boundary point with the minimum latitude, and the tenth boundary point or / and the eleventh boundary point have the maximum latitude, wherein the tenth boundary point, the eleventh boundary point, and the twelfth boundary point are different boundary points; the coordinates of each boundary point are expressed in longitude and latitude.
[0161] Determine whether the initial set of boundary points of the figure to be judged satisfies condition one, or simultaneously satisfies conditions two and three:
[0162] Condition 1: The tenth boundary point is located before the eleventh boundary point, and the twelfth boundary point is located between the tenth and eleventh boundary points;
[0163] Condition 2: The tenth boundary point is located after the eleventh boundary point;
[0164] Condition 3: The twelfth boundary point is located after the tenth boundary point, or the twelfth boundary point is located before the eleventh boundary point;
[0165] If the conditions are met, the initial drawing direction of the boundary of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0166] If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
[0167] Figure 7 Example of determining the drawing direction corresponding to the initial set of boundary points of the graphic to be judged. Figure 4 ,like Figure 7 As shown, let A to D be four boundary points on the map to be judged, where the minimum longitude is located at point A, the maximum longitude is located at point B, the maximum latitude is located at both points A and B, and the minimum latitude is located at point C. Then:
[0168] 1) If point A is listed before point B in the initial set of boundary points of the map to be judged, then:
[0169] If point C is located between points A and B in the initial boundary point set of the map to be judged, then the drawing direction corresponding to the initial boundary point set of the map to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0170] 2) If point A is after point B in the initial set of boundary points of the map to be judged, then:
[0171] If point C is ranked before point B or after point A in the initial boundary point set of the map to be judged, then the drawing direction corresponding to the initial boundary point set of the map to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0172] In one optional embodiment, determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same, based on the initial boundary point set of the first region map graphics and the initial boundary point set of the second region map graphics, includes:
[0173] Select either the first or second region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following conditions: the initial boundary point set of the map to be judged includes the thirteenth boundary point with the minimum longitude, the fourteenth boundary point with the maximum longitude, the fifteenth boundary point with the minimum latitude, and the sixteenth boundary point with the maximum latitude, wherein the thirteenth, fourteenth, fifteenth, and sixteenth boundary points are different boundary points; the coordinates of each boundary point are expressed in longitude and latitude.
[0174] Determine whether the initial set of boundary points of the figure to be judged satisfies condition one, or simultaneously satisfies conditions two and three:
[0175] Condition 1: The thirteenth boundary point is located before the fourteenth boundary point, and the fifteenth boundary point is located between the thirteenth and fourteenth boundary points;
[0176] Condition 2: The thirteenth boundary point is located after the fourteenth boundary point;
[0177] Condition 3: The fifteenth boundary point is located after the thirteenth boundary point, or the fifteenth boundary point is located before the fourteenth boundary point;
[0178] If the conditions are met, the initial drawing direction of the boundary of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0179] If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
[0180] Figure 8 Example of determining the drawing direction corresponding to the initial set of boundary points of the graphic to be judged. Figure 5 ,like Figure 8 As shown, let A to D be four boundary points on the map to be judged, where the minimum longitude is at point A, the maximum longitude is at point B, the minimum latitude is at point C, and the maximum latitude is at point D. Then:
[0181] 1) If point A is listed before point B in the initial set of boundary points of the map to be judged, then:
[0182] If point C is located between points A and B in the initial boundary point set of the map graphic to be judged, then the initial drawing direction of the boundary of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0183] 2) If point A is after point B in the initial set of boundary points of the map to be judged, then:
[0184] If point C is after point A or before point B in the initial boundary point set of the map graphic to be judged, then the initial drawing direction of the boundary of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0185] In one optional embodiment, after obtaining the final single-loop merged map graphic in step 103, the method further includes: for each boundary point in the boundary point set of the final merged map graphic, calculating the slope of the line segment between the boundary point and its two adjacent boundary points; if the two slopes are equal, then deleting the boundary point from the boundary point set of the final merged map graphic. Specifically, the adjacent boundary points of the first boundary point in the boundary point set are the last boundary point and the second boundary point in the set, and the adjacent boundary points of the last boundary point in the boundary point set are the second-to-last boundary point and the first boundary point in the set.
[0186] In practical applications, a boundary point n can be sequentially selected from the final set of boundary points of the merged single-loop map obtained in step 103 as a reference boundary point, and then processed as follows:
[0187] Step 1041: Take the slope of the line segment between the current reference boundary point n and its adjacent next boundary point n+1 as the reference slope Gr0.
[0188] Step 1042: Starting from boundary point n+2, each time a boundary point q is taken from the set, q≥n+2, and the slope Gr of the line segment between the current reference boundary point n and the taken boundary point q is calculated. q If Grq = Gr0, then remove the boundary point q-1 from the set; otherwise, update the current reference boundary point n = q-1 and return to step 1041 until the slope comparison has been performed on all boundary points in the set.
[0189] Through the above embodiments, the final set of boundary points in the merged map graphic retains only the boundary points that serve as inflection points, thereby achieving the simplification of the boundary point set without changing the boundary outline.
[0190] Figure 9 This is a schematic diagram of the structure of a regional map graphic merging device provided in an embodiment of the present invention. The device mainly includes:
[0191] The nearest boundary point search module 91 is used to search for the two closest boundary points in the first area map and the second area map. Let the two boundary points be the first boundary point and the second boundary point, wherein the first boundary point is located on the boundary of the first area map and the second boundary point is located on the boundary of the second area map.
[0192] The judgment module 92 is used to determine whether the distance between the first boundary point and the second boundary point searched by the nearest boundary point search module 91 is less than the preset error distance;
[0193] The gap search module 93 is used to search for each gap sub-region whose width is always less than the preset error distance in the gap region between the first region map graphic and the second region map graphic when the judgment module 92 determines that the distance between the first boundary point and the second boundary point is less than the preset error distance. If a gap sub-region is found, the searched gap sub-region is merged with the first region map graphic and the second region map graphic to obtain the final single-loop merged map graphic.
[0194] This invention also provides a regional map graphic merging device, which includes a processor and a memory, wherein:
[0195] The memory stores a computer program or instructions configured to cause the processor to perform the steps of the area map graphic merging method as described in any of the above embodiments when executed by the processor.
[0196] This application also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the regional map graphic merging method as described in any of the above embodiments.
[0197] This application also provides a computer-readable storage medium that stores instructions, which, when executed by a processor, can perform the steps in the area map graphic merging method described above. In practical applications, the computer-readable medium may be included in the devices / apparatus / systems described above, or it may exist independently and not be assembled into the device / apparatus / system. The computer-readable storage medium stores instructions, which, when executed by a processor, can perform the steps in the area map graphic merging method described above.
[0198] According to the embodiments disclosed in this application, the computer-readable storage medium can be a non-volatile computer-readable storage medium, such as including but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof, but not intended to limit the scope of protection of this application. In the embodiments disclosed in this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0199] like Figure 10 As shown, embodiments of the present invention also provide an electronic device. For example... Figure 10 As shown, it illustrates a structural schematic diagram of the electronic device involved in an embodiment of the present invention, specifically:
[0200] The electronic device may include a processor 101 with one or more processing cores, a memory 102 with one or more computer-readable storage media, and a computer program stored in the memory and executable on the processor. When the program in the memory 102 is executed, the above-described method for merging regional map graphics can be implemented.
[0201] Specifically, in practical applications, this electronic device may also include components such as a power supply 103 and an input / output unit 104. Those skilled in the art will understand that... Figure 10 The structure of the electronic device shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0202] The processor 101 is the control center of the electronic device. It connects various parts of the electronic device through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 102, and calling data stored in the memory 102, it performs various functions of the server and processes data, thereby monitoring the electronic device as a whole.
[0203] Memory 102 can be used to store software programs and modules, i.e., the aforementioned computer-readable storage medium. Processor 101 executes various functional applications and data processing by running the software programs and modules stored in memory 102. Memory 102 may primarily include a program storage area and a data storage area, wherein the program storage area may store the operating system, applications required for at least one function, etc.; the data storage area may store data created according to the use of the server, etc. In addition, memory 102 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, memory 102 may also include a memory controller to provide processor 101 with access to memory 102.
[0204] The electronic device also includes a power supply 103 that supplies power to the various components. This power supply can be logically connected to the processor 101 via a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 103 may also include one or more DC or AC power supplies, a recharging system, a power fault detection circuit, a power converter or inverter, a power status indicator, or any other components.
[0205] The electronic device may also include an input / output unit 104, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. The input unit output 104 can also be used to display information input by the user or information provided to the user, as well as various graphical user interfaces, which can be composed of graphics, text, icons, video, and any combination thereof.
[0206] This application discloses TS1, a method for merging regional map graphics, the method comprising:
[0207] Search for the two closest boundary points in the first and second regional map graphics, where the first boundary point is located at the boundary of the first regional map graphics and the second boundary point is located at the boundary of the second regional map graphics.
[0208] Determine whether the distance between the first boundary point and the second boundary point is less than the preset error distance;
[0209] If the width is less than the preset error distance, in the gap area between the first area map graphic and the second area map graphic, search for each gap sub-region whose width is always less than the preset error distance. If a gap sub-region is found, merge the searched gap sub-region with the first area map graphic and the second area map graphic to obtain a single-loop merged map graphic.
[0210] TS2, according to the method described in TS1, the search for each gap sub-region whose width is always less than a preset error distance in the gap region between the first area map graphic and the second area map graphic includes:
[0211] Based on the first boundary point and the second boundary point, the first area map graphic and the second area map graphic are bridged to obtain the first merged map graphic with a single loop.
[0212] In the largest closed shape that can be formed by the boundary points of the first merged map graphic, each gap sub-region whose width is always less than the preset error distance is searched. If a gap sub-region is found, it is merged with the first merged map graphic to obtain the final single-loop merged map graphic.
[0213] TS3, according to the method described in TS2, the step of bridging the first region map graphic and the second region map graphic based on the first boundary point and the second boundary point to obtain a single-loop first merged map graphic includes:
[0214] The first boundary point is used as the starting boundary point of the first boundary point set, and the second boundary point is used as the starting boundary point of the second boundary point set. The drawing direction of the boundary points in the first boundary point set is the same as that of the boundary points in the second boundary point set. The first boundary point set contains the boundary points on the boundary of the first area map graphic arranged in order of drawing direction, and the second boundary point set contains the boundary points on the boundary of the second area map graphic arranged in order of drawing direction.
[0215] Calculate the first distance between the second boundary point of the first boundary point set and the last boundary point of the second boundary point set;
[0216] Calculate the second distance between the last boundary point of the first boundary point set and the second boundary point of the second boundary point set;
[0217] Determine if the first distance is less than the second distance;
[0218] If it is less than, the first boundary point is removed from the first boundary point set, and then the first boundary point set and the second boundary point set are merged to obtain the boundary point set of the first merged map graphic, wherein the starting boundary point of the second boundary point set immediately follows the last boundary point of the first boundary point set;
[0219] If the value is not less than the value, the second boundary point is removed from the second boundary point set, and then the first boundary point set and the second boundary point set are merged to obtain the boundary point set of the first merged map graphic, wherein the starting boundary point of the second boundary point set immediately follows the last boundary point of the first boundary point set.
[0220] TS4. According to the method described in TS2 or TS3, the step of searching for each gap sub-region whose width is always less than a preset error distance in the largest closed shape that can be formed by the boundary points of the first merged map graphic includes:
[0221] A. Take one boundary point from the set of boundary points of the first merged map graphic in sequence and set it as the current boundary point;
[0222] B. Starting from the boundary point at a preset position after the current boundary point in the boundary point set of the first merged map graphic, sequentially take out the preset number of boundary points at the beginning of the set and place them into a temporary boundary point set; wherein, the number of boundary points contained in the temporary boundary point set must be equal to the preset number. When the last boundary point of the boundary point set of the first merged map graphic is taken, and the number of boundary points contained in the temporary boundary point set still does not reach the preset number, then continue to take boundary points starting from the first boundary point of the boundary point set of the first merged map graphic until the number of boundary points contained in the temporary boundary point set is equal to the preset number.
[0223] C. Calculate the distance between the current boundary point and each boundary point in the temporary boundary point set;
[0224] Determine if there is a distance less than the preset error distance among the calculated distances. If so, select the boundary point with the largest number of boundary points between the current boundary point and the boundary point corresponding to the distance less than the preset error distance, and use the selected boundary point as the selected boundary point.
[0225] D. Combine the current boundary point, the selected boundary point, and the boundary points in the first merged map graph set that are located before the current boundary point and after the selected boundary point to form a closed map graph, which is set as the third map graph.
[0226] E. Remove all boundary points located before the current boundary point and after the selected boundary point from the boundary point set of the first merged map graphic, and use the closed shape formed by the remaining boundary points of the boundary point set of the first merged map graphic as the fourth map graphic.
[0227] F. Determine whether the third map graphic is contained in the fourth map graphic. If so, update the first merged map graphic with the fourth map graphic and return to step A until the current boundary point is the last boundary point of the first merged map graphic. Then, use the first merged map graphic at this time as the final single-loop merged map graphic. Otherwise, return directly to step A until the current boundary point is the last boundary point of the first merged map graphic. Then, use the first merged map graphic at this time as the final single-loop merged map graphic.
[0228] TS5. According to the method described in TS4, the boundary point located at the preset position after the current boundary point is: the third boundary point after the current boundary point; or / and,
[0229] The preset number is within the range of: not less than one-sixth of the number of boundary points in the boundary point set of the first merged map graphic, and not greater than one-half of the number of boundary points in the boundary point set of the first merged map graphic.
[0230] TS6. According to the method described in TS1, after determining whether the distance between the first boundary point and the second boundary point is less than a preset error distance, the method further includes:
[0231] If it is not less than, then connect the first boundary point and the second boundary point with line segments to obtain the final merged map graphic of the single loop.
[0232] TS7, according to the method described in TS6, after connecting the first boundary point and the second boundary point with line segments to obtain the final single-loop merged map graphic if the boundary point is not less than the specified value, the method further includes:
[0233] Based on the initial boundary point set of the first region map and the initial boundary point set of the second region map, determine whether the initial drawing directions of the boundaries of the first region map and the second region map are the same.
[0234] If they are not the same, then one of the initial boundary point sets of the first region map graphic and the second region map graphic is reversed and merged with the other of the initial boundary point sets of the first region map graphic and the second region map graphic to obtain the boundary point set of the merged map graphic.
[0235] TS8. According to the method described in TS7, determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same based on the initial boundary point set of the first region map graphics and the initial boundary point set of the second region map graphics includes:
[0236] Select either a first-region map or a second-region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following condition: the initial boundary point set of the map to be judged includes a third boundary point with the minimum longitude and minimum latitude and a fourth boundary point with the maximum longitude and maximum latitude; wherein the third boundary point and the fourth boundary point are different boundary points.
[0237] If satisfied, then determine whether the third boundary point is located before the fourth boundary point in the initial set of boundary points;
[0238] If it is located, calculate the average slope of all line segments between the origin and each boundary point located between the third and fourth boundary points in the initial boundary point set, and set it as the first average slope. Also calculate the average slope of all line segments between the origin and each boundary point located before the third boundary point and after the fourth boundary point in the initial boundary point set, and set it as the second average slope. If the first average slope is less than the second average slope, then determine that the initial drawing direction of the boundary of the graphic to be judged is counterclockwise, otherwise it is clockwise.
[0239] If not located, calculate the average slope of all line segments between the origin and each boundary point in the initial boundary point set located between the fourth and third boundary points, and set it as the first average slope. Also calculate the average slope of all line segments between the origin and each boundary point in the initial boundary point set located before the fourth boundary point and after the third boundary point, and set it as the second average slope. If the first average slope is greater than the second average slope, then determine that the initial drawing direction of the boundary of the graphic to be judged is counterclockwise; otherwise, it is clockwise.
[0240] If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
[0241] TS9. According to the method described in TS7, determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same based on the initial boundary point set of the first region map graphics and the initial boundary point set of the second region map graphics includes:
[0242] Select either a first-region map or a second-region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following condition: the initial boundary point set of the map to be judged includes a fifth boundary point with the minimum longitude and maximum latitude and a sixth boundary point with the maximum longitude and minimum latitude; wherein the fifth boundary point and the sixth boundary point are different boundary points.
[0243] If the condition is met, then determine whether the fifth boundary point in the initial set of boundary points is located after the sixth boundary point.
[0244] If it is located, calculate the average distance between the origin and each boundary point in the initial boundary point set located between the sixth and fifth boundary points, and set it as the first average distance. Also calculate the average distance between the origin and each boundary point in the initial boundary point set located before the sixth boundary point and after the fifth boundary point, and set it as the second average distance. If the first average distance is greater than the second average distance, determine that the initial drawing direction of the boundary of the graphic to be judged is counterclockwise; otherwise, it is clockwise.
[0245] If not located, calculate the average distance between the origin and each boundary point in the initial boundary point set located between the fifth and sixth boundary points, and set it as the first average distance. Also calculate the average distance between the origin and each boundary point in the initial boundary point set located before the fifth boundary point and after the sixth boundary point, and set it as the second average distance. If the first average distance is less than the second average distance, determine that the initial drawing direction of the boundary of the graphic to be judged is counterclockwise; otherwise, it is clockwise.
[0246] If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
[0247] TS10. According to the method described in TS7, determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same based on the initial boundary point set of the first region map graphics and the initial boundary point set of the second region map graphics includes:
[0248] Select either a first-region map or a second-region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following conditions: the initial boundary point set of the map to be judged includes a seventh boundary point with the minimum longitude, an eighth boundary point with the maximum longitude, and a ninth boundary point with the maximum latitude, and the seventh boundary point or / and the eighth boundary point have the minimum latitude, wherein the seventh boundary point, the eighth boundary point, and the ninth boundary point are different boundary points;
[0249] Determine whether the initial set of boundary points of the figure to be judged simultaneously satisfies both Condition 1 and Condition 2, or satisfies Condition 3:
[0250] Condition 1: The seventh boundary point is located before the eighth boundary point;
[0251] Condition 2: The ninth boundary point is located before the seventh boundary point, or the ninth boundary point is located after the eighth boundary point;
[0252] Condition 3: The seventh boundary point is located after the eighth boundary point, and the ninth boundary point is located between the eighth boundary point and the seventh boundary point;
[0253] If the conditions are met, the initial drawing direction of the boundary of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0254] If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
[0255] TS11. According to the method described in TS7, determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same based on the initial boundary point set of the first region map graphics and the initial boundary point set of the second region map graphics includes:
[0256] Select either a first-region map or a second-region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following conditions: the initial boundary point set of the map to be judged includes a tenth boundary point with the minimum longitude, an eleventh boundary point with the maximum longitude, and a twelfth boundary point with the minimum latitude, and the tenth boundary point or / and the eleventh boundary point have the maximum latitude, wherein the tenth boundary point, the eleventh boundary point, and the twelfth boundary point are different boundary points;
[0257] Determine whether the initial set of boundary points of the figure to be judged satisfies condition one, or simultaneously satisfies conditions two and three:
[0258] Condition 1: The tenth boundary point is located before the eleventh boundary point, and the twelfth boundary point is located between the tenth and eleventh boundary points;
[0259] Condition 2: The tenth boundary point is located after the eleventh boundary point;
[0260] Condition 3: The twelfth boundary point is located after the tenth boundary point, or the twelfth boundary point is located before the eleventh boundary point;
[0261] If the conditions are met, the initial drawing direction of the boundary of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0262] If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
[0263] TS12. According to the method described in TS7, determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same based on the initial boundary point set of the first region map graphics and the initial boundary point set of the second region map graphics includes:
[0264] Select either a first-region map or a second-region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following condition: the initial boundary point set of the map to be judged includes a thirteenth boundary point with the minimum longitude, a fourteenth boundary point with the maximum longitude, a fifteenth boundary point with the minimum latitude, and a sixteenth boundary point with the maximum latitude, wherein the thirteenth, fourteenth, fifteenth, and sixteenth boundary points are different boundary points.
[0265] Determine whether the initial set of boundary points of the figure to be judged satisfies condition one, or simultaneously satisfies conditions two and three:
[0266] Condition 1: The thirteenth boundary point is located before the fourteenth boundary point, and the fifteenth boundary point is located between the thirteenth and fourteenth boundary points;
[0267] Condition 2: The thirteenth boundary point is located after the fourteenth boundary point;
[0268] Condition 3: The fifteenth boundary point is located after the thirteenth boundary point, or the fifteenth boundary point is located before the fourteenth boundary point;
[0269] If the conditions are met, the initial drawing direction of the boundary of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise.
[0270] If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
[0271] TS13. According to the method described in TS1, before searching for the two closest boundary points in the first and second area map graphics, and designating them as the first and second boundary points, the method further includes:
[0272] Determine whether the first region map and the second region map overlap. If they do, then the two maps cannot be merged. Otherwise, perform the action of searching for the two closest boundary points in the first region map and the second region map.
[0273] TS14. According to the method described in TS1, before searching for the two closest boundary points in the first and second area map graphics, and designating them as the first and second boundary points, the method further includes:
[0274] The initial set of boundary points for the first region map and the second region map are used as the set of boundary points to be enriched. The following boundary point enrichment process is performed on each set of boundary points to be enriched:
[0275] Calculate the number of boundary points contained in the set of boundary points to be enriched;
[0276] Read one boundary point at a time from the set of boundary points to be enriched and use it as the current boundary point;
[0277] Calculate the sum of the preset error distance plus 1, calculate the distance between the current boundary point and the next boundary point in the set of boundary points to be enriched, calculate the quotient of this distance and the sum, round the quotient down and then subtract 1, the resulting difference is the number of boundary points that should be added between the current boundary point and the next boundary point, add the number of boundary points between the current boundary point and the next boundary point according to this number, and put the added number of boundary points into the set of boundary points to be enriched, until the last boundary point in the set of boundary points to be enriched has completed the above boundary point enrichment process, wherein the next boundary point of the last boundary point in the set of boundary points to be enriched is the first boundary point in the set of boundary points to be enriched;
[0278] Furthermore, the step of searching for the two closest boundary points in the first and second area map graphics includes:
[0279] Based on the enriched boundary point set of the first region map and the enriched boundary point set of the second region map, calculate the distance between each pair of boundary points of the first and second region map.
[0280] TS15. According to the method described in TS1, after obtaining the final single-loop merged map graphic, the method further includes:
[0281] For each boundary point in the final set of boundary points of the merged single-loop map, calculate the slope of the line segment between the boundary point and its two adjacent boundary points. If the two slopes are equal, remove the boundary point from the set of boundary points of the final merged single-loop map.
[0282] This application also discloses TS16, a regional map graphic merging device, which includes: a processor and a memory, wherein:
[0283] The memory stores a computer program or instructions configured to cause the processor, when executed by the processor, to perform the steps of the regional map graphic merging method as described in any one of TS1 to TS15.
[0284] This application also discloses TS17, a non-transitory computer-readable storage medium storing instructions that, when executed by a processor, cause the processor to perform the steps of the regional map graphic merging method as described in any one of TS1 to TS15.
[0285] This application also discloses TS18, a computer program product including a computer program or instructions that, when executed by a processor, implement the steps of the regional map graphic merging method as described in any one of TS1 to TS15.
[0286] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments disclosed in this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those shown in the drawings. For example, two blocks shown connectedly may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0287] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, without departing from the spirit and teachings of this application, the features described in the various embodiments and / or claims of this application can be combined and / or combined in various ways, and all such combinations and / or combinations fall within the scope of this application.
[0288] This document uses specific embodiments to illustrate the principles and implementation methods of the present invention. The descriptions of these embodiments are merely illustrative of the method and core concepts of the present invention and are not intended to limit this application. Those skilled in the art can make changes to the specific implementation methods and application scope based on the ideas, spirit, and principles of the present invention. Any modifications, equivalent substitutions, or improvements made should be included within the scope of protection of this application.
Claims
1. A method for merging regional map graphics, characterized in that, The method includes: Search for the two closest boundary points in the first and second regional map graphics, where the first boundary point is located at the boundary of the first regional map graphics and the second boundary point is located at the boundary of the second regional map graphics. Determine whether the distance between the first boundary point and the second boundary point is less than the preset error distance; If it is smaller than the preset error distance, in the gap area between the first area map graphic and the second area map graphic, the search width of each gap sub-region is always smaller than the preset error distance. The gap regions between the first and second region map graphics, where the search width is always less than a preset error distance, include: Based on the first boundary point and the second boundary point, the first area map graphic and the second area map graphic are bridged to obtain the first merged map graphic with a single loop. In the largest closed shape that can be formed by the boundary points of the first merged map graphic, the search width of each gap sub-region is always less than the preset error distance; If found, the found gap sub-regions are merged with the first region map and the second region map to obtain a single-loop merged map. The step of bridging the first region map and the second region map based on the first boundary point and the second boundary point to obtain a single-loop first merged map includes: The first boundary point is used as the starting boundary point of the first boundary point set, and the second boundary point is used as the starting boundary point of the second boundary point set. The drawing direction of the boundary points in the first boundary point set is the same as that of the boundary points in the second boundary point set. The first boundary point set contains the boundary points on the boundary of the first area map graphic arranged in order of drawing direction, and the second boundary point set contains the boundary points on the boundary of the second area map graphic arranged in order of drawing direction. Calculate the first distance between the second boundary point of the first boundary point set and the last boundary point of the second boundary point set; Calculate the second distance between the last boundary point of the first boundary point set and the second boundary point of the second boundary point set; Determine if the first distance is less than the second distance; If it is less than, the first boundary point is removed from the first boundary point set, and then the first boundary point set and the second boundary point set are merged to obtain the boundary point set of the first merged map graphic, wherein the starting boundary point of the second boundary point set immediately follows the last boundary point of the first boundary point set; If the value is not less than the value, the second boundary point is removed from the second boundary point set, and then the first boundary point set and the second boundary point set are merged to obtain the boundary point set of the first merged map graphic, wherein the starting boundary point of the second boundary point set immediately follows the last boundary point of the first boundary point set.
2. The method according to claim 1, characterized in that, The search for each gap sub-region whose search width is always less than a preset error distance within the largest closed shape that can be formed by the boundary points of the first merged map graphic includes: A. Take one boundary point from the set of boundary points of the first merged map graphic in sequence and set it as the current boundary point; B. Starting from the boundary point at a preset position after the current boundary point in the boundary point set of the first merged map graphic, sequentially take out the preset number of boundary points at the beginning of the set and place them into a temporary boundary point set; wherein, the number of boundary points contained in the temporary boundary point set must be equal to the preset number. When the last boundary point of the boundary point set of the first merged map graphic is taken, and the number of boundary points contained in the temporary boundary point set still does not reach the preset number, then continue to take boundary points starting from the first boundary point of the boundary point set of the first merged map graphic until the number of boundary points contained in the temporary boundary point set is equal to the preset number. C. Calculate the distance between the current boundary point and each boundary point in the temporary boundary point set; Determine if there is a distance less than the preset error distance among the calculated distances. If so, select the boundary point with the largest number of boundary points between the current boundary point and the boundary point corresponding to the distance less than the preset error distance, and use the selected boundary point as the selected boundary point. D. Combine the current boundary point, the selected boundary point, and the boundary points in the first merged map graph set that are located before the current boundary point and after the selected boundary point to form a closed map graph, which is set as the third map graph. E. Remove all boundary points located before the current boundary point and after the selected boundary point from the boundary point set of the first merged map graphic, and use the closed shape formed by the remaining boundary points of the boundary point set of the first merged map graphic as the fourth map graphic. F. Determine whether the third map graphic is contained in the fourth map graphic. If so, update the first merged map graphic with the fourth map graphic and return to step A until the current boundary point is the last boundary point of the first merged map graphic. Then, use the first merged map graphic at this time as the final single-loop merged map graphic. Otherwise, return directly to step A until the current boundary point is the last boundary point of the first merged map graphic. Then, use the first merged map graphic at this time as the final single-loop merged map graphic.
3. The method according to claim 2, characterized in that, The boundary point located at the preset position after the current boundary point is: the third boundary point after the current boundary point; or / and, The preset number is within the range of: not less than one-sixth of the number of boundary points in the boundary point set of the first merged map graphic, and not greater than one-half of the number of boundary points in the boundary point set of the first merged map graphic.
4. The method according to claim 1, characterized in that, After determining whether the distance between the first boundary point and the second boundary point is less than a preset error distance, the method further includes: If it is not less than, then connect the first boundary point and the second boundary point with line segments to obtain the final merged map graphic of the single loop.
5. The method according to claim 4, characterized in that, If the value is not less than a certain threshold, then after connecting the first boundary point and the second boundary point with line segments to obtain the final single-loop merged map graphic, the following further steps are included: Based on the initial boundary point set of the first region map and the initial boundary point set of the second region map, determine whether the initial drawing directions of the boundaries of the first region map and the second region map are the same. If they are not the same, then one of the initial boundary point sets of the first region map graphic and the second region map graphic is reversed and merged with the other of the initial boundary point sets of the first region map graphic and the second region map graphic to obtain the boundary point set of the merged map graphic.
6. The method according to claim 5, characterized in that, The step of determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same, based on the initial boundary point set of the first and second region map graphics, includes: Select either a first-region map or a second-region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following condition: the initial boundary point set of the map to be judged includes a third boundary point with the minimum longitude and minimum latitude and a fourth boundary point with the maximum longitude and maximum latitude; wherein the third boundary point and the fourth boundary point are different boundary points. If satisfied, then determine whether the third boundary point is located before the fourth boundary point in the initial set of boundary points; If it is located, calculate the average slope of all line segments between the origin and each boundary point located between the third and fourth boundary points in the initial boundary point set, and set it as the first average slope. Also calculate the average slope of all line segments between the origin and each boundary point located before the third boundary point and after the fourth boundary point in the initial boundary point set, and set it as the second average slope. If the first average slope is less than the second average slope, then determine that the initial drawing direction of the boundary of the graphic to be judged is counterclockwise, otherwise it is clockwise. If not located, calculate the average slope of all line segments between the origin and each boundary point in the initial boundary point set located between the fourth and third boundary points, and set it as the first average slope. Also calculate the average slope of all line segments between the origin and each boundary point in the initial boundary point set located before the fourth boundary point and after the third boundary point, and set it as the second average slope. If the first average slope is greater than the second average slope, then determine that the initial drawing direction of the boundary of the graphic to be judged is counterclockwise; otherwise, it is clockwise. If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
7. The method according to claim 5, characterized in that, The step of determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same, based on the initial boundary point set of the first and second region map graphics, includes: Select either a first-region map or a second-region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following condition: the initial boundary point set of the map to be judged includes a fifth boundary point with the minimum longitude and maximum latitude and a sixth boundary point with the maximum longitude and minimum latitude; wherein the fifth boundary point and the sixth boundary point are different boundary points. If the condition is met, then determine whether the fifth boundary point in the initial set of boundary points is located after the sixth boundary point. If it is located, calculate the average distance between the origin and each boundary point in the initial boundary point set located between the sixth and fifth boundary points, and set it as the first average distance. Also calculate the average distance between the origin and each boundary point in the initial boundary point set located before the sixth boundary point and after the fifth boundary point, and set it as the second average distance. If the first average distance is greater than the second average distance, determine that the initial drawing direction of the boundary of the graphic to be judged is counterclockwise; otherwise, it is clockwise. If not located, calculate the average distance between the origin and each boundary point in the initial boundary point set located between the fifth and sixth boundary points, and set it as the first average distance. Also calculate the average distance between the origin and each boundary point in the initial boundary point set located before the fifth boundary point and after the sixth boundary point, and set it as the second average distance. If the first average distance is less than the second average distance, determine that the initial drawing direction of the boundary of the graphic to be judged is counterclockwise; otherwise, it is clockwise. If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
8. The method according to claim 5, characterized in that, The step of determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same, based on the initial boundary point set of the first and second region map graphics, includes: Select either a first-region map or a second-region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following conditions: the initial boundary point set of the map to be judged includes a seventh boundary point with the minimum longitude, an eighth boundary point with the maximum longitude, and a ninth boundary point with the maximum latitude, and the seventh boundary point or / and the eighth boundary point have the minimum latitude, wherein the seventh boundary point, the eighth boundary point, and the ninth boundary point are different boundary points; Determine whether the initial set of boundary points of the figure to be judged simultaneously satisfies both Condition 1 and Condition 2, or satisfies Condition 3: Condition 1: The seventh boundary point is located before the eighth boundary point; Condition 2: The ninth boundary point is located before the seventh boundary point, or the ninth boundary point is located after the eighth boundary point; Condition 3: The seventh boundary point is located after the eighth boundary point, and the ninth boundary point is located between the eighth boundary point and the seventh boundary point; If the conditions are met, the initial drawing direction of the boundary of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise. If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
9. The method according to claim 5, characterized in that, The step of determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same, based on the initial boundary point set of the first and second region map graphics, includes: Select either a first-region map or a second-region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following conditions: the initial boundary point set of the map to be judged includes a tenth boundary point with the minimum longitude, an eleventh boundary point with the maximum longitude, and a twelfth boundary point with the minimum latitude, and the tenth boundary point or / and the eleventh boundary point have the maximum latitude, wherein the tenth boundary point, the eleventh boundary point, and the twelfth boundary point are different boundary points; Determine whether the initial set of boundary points of the figure to be judged satisfies condition one, or simultaneously satisfies conditions two and three: Condition 1: The tenth boundary point is located before the eleventh boundary point, and the twelfth boundary point is located between the tenth and eleventh boundary points; Condition 2: The tenth boundary point is located after the eleventh boundary point; Condition 3: The twelfth boundary point is located after the tenth boundary point, or the twelfth boundary point is located before the eleventh boundary point; If the conditions are met, the initial drawing direction of the boundary of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise. If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
10. The method according to claim 5, characterized in that, The step of determining whether the initial drawing directions of the boundaries of the first and second region map graphics are the same, based on the initial boundary point set of the first and second region map graphics, includes: Select either a first-region map or a second-region map as the map to be judged. Determine the minimum longitude, minimum latitude, maximum longitude, and maximum latitude of the boundary points in the initial boundary point set of the map to be judged. Determine whether the initial boundary point set of the map to be judged satisfies the following condition: the initial boundary point set of the map to be judged includes a thirteenth boundary point with the minimum longitude, a fourteenth boundary point with the maximum longitude, a fifteenth boundary point with the minimum latitude, and a sixteenth boundary point with the maximum latitude, wherein the thirteenth, fourteenth, fifteenth, and sixteenth boundary points are different boundary points. Determine whether the initial set of boundary points of the figure to be judged satisfies condition one, or simultaneously satisfies conditions two and three: Condition 1: The thirteenth boundary point is located before the fourteenth boundary point, and the fifteenth boundary point is located between the thirteenth and fourteenth boundary points; Condition 2: The thirteenth boundary point is located after the fourteenth boundary point; Condition 3: The fifteenth boundary point is located after the thirteenth boundary point, or the fifteenth boundary point is located before the fourteenth boundary point; If the conditions are met, the initial drawing direction of the boundary of the graphic to be judged is determined to be counterclockwise; otherwise, it is clockwise. If the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is both clockwise or both counterclockwise, then the initial drawing direction of the boundary between the first area map graphic and the second area map graphic is determined to be the same.
11. The method according to claim 1, characterized in that, Before searching for the two closest boundary points in the first and second area map graphics, and designating them as the first and second boundary points, the process further includes: Determine whether the first region map and the second region map overlap. If they do, then the two maps cannot be merged. Otherwise, perform the action of searching for the two closest boundary points in the first region map and the second region map.
12. The method according to claim 1, characterized in that, Before searching for the two closest boundary points in the first and second area map graphics, and designating them as the first and second boundary points, the process further includes: The initial set of boundary points for the first region map and the second region map are used as the set of boundary points to be enriched. The following boundary point enrichment process is performed on each set of boundary points to be enriched: Calculate the number of boundary points contained in the set of boundary points to be enriched; Read one boundary point at a time from the set of boundary points to be enriched and use it as the current boundary point; Calculate the sum of the preset error distance plus 1, calculate the distance between the current boundary point and the next boundary point in the set of boundary points to be enriched, calculate the quotient of the distance and the sum, round the quotient down and then subtract 1, the difference is the number of boundary points that should be added between the current boundary point and the next boundary point, add the number of boundary points between the current boundary point and the next boundary point according to the number, and put the added number of boundary points into the set of boundary points to be enriched, until the last boundary point in the set of boundary points to be enriched has completed the above boundary point enrichment process, wherein the next boundary point of the last boundary point in the set of boundary points to be enriched is the first boundary point in the set of boundary points to be enriched; Furthermore, the step of searching for the two closest boundary points in the first and second area map graphics includes: Based on the enriched boundary point set of the first region map and the enriched boundary point set of the second region map, calculate the distance between each pair of boundary points of the first and second region map.
13. The method according to claim 1, characterized in that, After obtaining the final merged map graphic of a single loop, the process further includes: For each boundary point in the final set of boundary points of the merged single-loop map, calculate the slope of the line segment between the boundary point and its two adjacent boundary points. If the two slopes are equal, remove the boundary point from the set of boundary points of the final merged single-loop map.
14. A regional map graphic merging device, characterized in that, The device includes: a processor and a memory, wherein: The memory stores a computer program or instructions configured to cause the processor to perform the steps of the regional map graphic merging method as described in any one of claims 1 to 13 when executed by the processor.
15. A non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores instructions, characterized in that, When executed by a processor, the instructions cause the processor to perform the steps of the regional map graphic merging method as described in any one of claims 1 to 13.
16. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the regional map graphic merging method as described in any one of claims 1 to 13.
Citation Information
Patent Citations
Map welting method, terminal device and storage medium
CN110704561A
