Methods, devices, storage media, and electronic equipment for matching latitude and longitude coordinate regions

CN116089554BActive Publication Date: 2026-09-01DAZHEN (HANGZHOU) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211705378.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2026-09-01
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

[0004]有鉴于此,本申请提供了一种经纬坐标归属区域匹配方法及装置、存储介质和电子设备,解决了现有的经纬坐标归属区域匹配方法边界信息采集成本较高、匹配准确度不高的问题

Benefits of technology

[0063]借由上述技术方案,本申请该实施例将经纬坐标系下的坐标归属区域匹配问题,转换成为平面坐标系下的坐标归属区域匹配问题,从而可利用平面几何知识解决该问题,简化了经纬坐标归属区域匹配难度,降低了运算量,提高了运算效率。同时,本实施例根据第一平面坐标是否在平面区域内部,来判断待匹配经纬坐标是否归属于平面区域对应的待选区域,而非现有网格分割法的利用网格近似估计,提高了区域匹配的精准程度。此外,该实施例通过依次将待选区域集合中的待选区域作为备选区域并进行判断的方式,若判定待匹配经纬坐标在备选区域,则可停止判断而无需将所有待选区域的边界经纬坐标都计算出来,降低了边界坐标的采集成本。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116089554B_ABST
    Figure CN116089554B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, storage medium, and electronic device for matching latitude and longitude coordinates to a given region. The method includes: acquiring the latitude and longitude coordinates to be matched; converting the latitude and longitude coordinates to be matched into first planar coordinates; acquiring a set of candidate regions; determining one candidate region from the set as a backup region; sampling the boundary of the backup region to obtain boundary latitude and longitude coordinates; converting the boundary latitude and longitude coordinates into second planar coordinates; determining the planar region corresponding to the backup region based on the second planar coordinates; determining whether the first planar coordinates are inside the planar region; if so, determining the backup region as the target region to which the latitude and longitude coordinates to be matched belong; otherwise, deleting the backup region from the list of candidate regions and returning to the step of determining one candidate region from the set of candidate regions as a backup region. The method of this application solves the problems of high boundary information acquisition cost and low matching accuracy in existing latitude and longitude coordinate matching methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular to a method and apparatus for matching latitude and longitude coordinates to a given region, as well as a storage medium and electronic device. Background Technology

[0002] Latitude and longitude coordinate region matching is a method that, given the latitude and longitude of a geographical location and a known set of target regions, determines which region the corresponding geographical location belongs to. For example, it can determine the province, city, district, street, or community to which a given latitude and longitude coordinate belongs. Latitude and longitude coordinate region matching plays an important role in assisting the supervision and governance of geographical location-related projects.

[0003] Existing methods for matching latitude and longitude coordinates to their assigned regions fall into two categories. First, one involves collecting extensive boundary point location information along the boundaries of each candidate region to construct a high-precision region model and achieve region matching. However, this method is costly in terms of information collection and faces practical difficulties in acquiring boundary information. Second, it involves dividing the candidate regions into grids and determining grid affiliation based on the proportion of each region's area within the grid. In this method, the coordinates to be matched are first mapped to the grid, and then the target region is determined by the grid affiliation. However, this method suffers from significant rounding errors in determining grid affiliation in certain boundary scenarios (e.g., the grid area is occupied by two regions, each with a proportion close to 1 / 2). Therefore, existing methods for matching latitude and longitude coordinates to their assigned regions are not very accurate when dealing with regions with irregular boundaries. Summary of the Invention

[0004] In view of this, this application provides a method, apparatus, storage medium, and electronic device for matching latitude and longitude coordinate attribution areas, which solves the problems of high cost of boundary information acquisition and low matching accuracy of existing latitude and longitude coordinate attribution area matching methods.

[0005] According to one aspect of this application, a method for matching latitude and longitude coordinate attribution regions is provided, comprising:

[0006] Obtain the latitude and longitude coordinates to be matched, and convert the latitude and longitude coordinates to be matched into first plane coordinates;

[0007] Obtain a set of candidate regions, determine one candidate region from the set as a backup region, and sample the boundary of the backup region to obtain multiple boundary latitude and longitude coordinates;

[0008] Each of the boundary latitude and longitude coordinates is converted into second plane coordinates, and the plane region corresponding to the candidate region is determined according to the second plane coordinates, wherein the first plane coordinates and the second plane coordinates are in the same plane coordinate system;

[0009] Determine whether the first plane coordinates are inside the plane region;

[0010] If so, then the candidate area is determined to be the target area to which the latitude and longitude coordinates to be matched belong;

[0011] If not, delete the candidate region from the candidate region list and return to the step of determining a candidate region from the candidate region set as a candidate region.

[0012] Optionally, determining the planar region corresponding to the candidate region based on the second planar coordinates includes:

[0013] In a plurality of second plane coordinates, each second plane coordinate is taken as the target coordinate, and the two coordinates adjacent to the target coordinate are determined as adjacent coordinates;

[0014] If there is no line segment between the target coordinates and the adjacent coordinates, then line segments are constructed using the target coordinates and the adjacent coordinates as vertices respectively;

[0015] The closed region formed by the multiple line segments is determined as the planar region corresponding to the candidate region.

[0016] Optionally, determining whether the first planar coordinates are inside the planar region includes:

[0017] A third plane coordinate system is set in the plane coordinate system, wherein the third plane coordinate system is different from the first plane coordinate system.

[0018] Draw a ray starting from the first plane coordinates, wherein the ray passes through the third plane coordinates;

[0019] Based on the positional relationship between the ray and the planar region, determine whether the first plane coordinates are inside the planar region.

[0020] Optionally, determining whether the first plane coordinates are inside the plane region based on the positional relationship between the ray and the plane region includes:

[0021] Determine whether the ray intersects with each of the line segments, and determine the total number of intersections between the ray and the multiple line segments based on the determination results;

[0022] If the total number is odd, then the first plane coordinates are determined to be inside the plane region;

[0023] If the total number is even, then the first plane coordinates are determined not to be inside the plane region.

[0024] Optionally, sampling the boundaries of the candidate regions to obtain multiple boundary latitude and longitude coordinates includes:

[0025] Obtain the matching accuracy and the boundary complexity of the candidate regions, and determine the number of samples based on the matching accuracy and the boundary complexity;

[0026] The boundary of the candidate region is sampled to obtain the number of sampled boundary latitude and longitude coordinates.

[0027] Optionally, determining a candidate region from the set of candidate regions as an alternative region includes:

[0028] In the set of candidate regions, the center position of each candidate region is determined;

[0029] Based on the distance between the latitude and longitude coordinates to be matched and each of the center positions, the candidate regions are sorted to obtain a list of candidate regions;

[0030] In the list of candidate areas, the candidate area that is ranked first is determined as the alternative area.

[0031] Optionally, sorting the candidate regions according to the distance between the latitude and longitude coordinates to be matched and each of the center locations includes:

[0032] The latitude and longitude coordinates corresponding to each of the central positions are respectively transformed into fourth plane coordinates, wherein the fourth plane coordinates and the first plane coordinates are in the same coordinate system;

[0033] Calculate the planar distance between the first plane coordinates and each of the fourth plane coordinates, and sort the candidate regions corresponding to the fourth plane coordinates in ascending order of the planar distance.

[0034] According to another aspect of this application, a latitude and longitude coordinate attribution area matching device is provided, the device comprising:

[0035] The module for obtaining coordinates to be matched is used to obtain the latitude and longitude coordinates to be matched and convert the latitude and longitude coordinates to be matched into first plane coordinates;

[0036] The candidate region acquisition module is used to acquire a set of candidate regions, determine one candidate region from the set of candidate regions as a candidate region, sample the boundary of the candidate region to obtain multiple boundary latitude and longitude coordinates; and convert each boundary latitude and longitude coordinate into a second plane coordinate, and determine the plane region corresponding to the candidate region based on the second plane coordinate, wherein the first plane coordinate and the second plane coordinate are in the same plane coordinate system;

[0037] The judgment module is used to determine whether the first planar coordinates are inside the planar region; if so, the candidate region is determined to be the target region to which the latitude and longitude coordinates to be matched belong; if not, the candidate region is deleted from the candidate region list.

[0038] The loop module is used to return to the step of determining a candidate region from the set of candidate regions as an alternative region.

[0039] Optionally, the candidate area acquisition module is used for:

[0040] In a plurality of second plane coordinates, each second plane coordinate is taken as the target coordinate, and the two coordinates adjacent to the target coordinate are determined as adjacent coordinates;

[0041] If there is no line segment between the target coordinates and the adjacent coordinates, then line segments are constructed using the target coordinates and the adjacent coordinates as vertices respectively;

[0042] The closed region formed by the multiple line segments is determined as the planar region corresponding to the candidate region.

[0043] Optionally, the determination module is used for:

[0044] A third plane coordinate system is set in the plane coordinate system, wherein the third plane coordinate system is different from the first plane coordinate system.

[0045] Draw a ray starting from the first plane coordinates, wherein the ray passes through the third plane coordinates;

[0046] Based on the positional relationship between the ray and the planar region, determine whether the first plane coordinates are inside the planar region.

[0047] Optionally, the determination module is used for:

[0048] Determine whether the ray intersects with each of the line segments, and determine the total number of intersections between the ray and the multiple line segments based on the determination results;

[0049] If the total number is odd, then the first plane coordinates are determined to be inside the plane region;

[0050] If the total number is even, then the first plane coordinates are determined not to be inside the plane region.

[0051] Optionally, the candidate area acquisition module is used for:

[0052] Obtain the matching accuracy and the boundary complexity of the candidate regions, and determine the number of samples based on the matching accuracy and the boundary complexity;

[0053] The boundary of the candidate region is sampled to obtain the number of sampled boundary latitude and longitude coordinates.

[0054] Optionally, the candidate area acquisition module is used for:

[0055] In the set of candidate regions, the center position of each candidate region is determined;

[0056] Based on the distance between the latitude and longitude coordinates to be matched and each of the center positions, the candidate regions are sorted to obtain a list of candidate regions;

[0057] In the list of candidate areas, the candidate area that is ranked first is determined as the alternative area.

[0058] Optionally, the candidate area acquisition module is used for:

[0059] The latitude and longitude coordinates corresponding to each of the central positions are respectively transformed into fourth plane coordinates, wherein the fourth plane coordinates and the first plane coordinates are in the same coordinate system;

[0060] Calculate the planar distance between the first plane coordinates and each of the fourth plane coordinates, and sort the candidate regions corresponding to the fourth plane coordinates in ascending order of the planar distance.

[0061] According to another aspect of this application, a storage medium is provided that stores a program or instructions thereon, which, when executed by a processor, implements the above-described latitude and longitude coordinate attribution region matching method.

[0062] According to another aspect of this application, an electronic device is provided, including a storage medium and a processor, wherein the storage medium stores a computer program, and the processor executes the computer program to implement the above-described latitude and longitude coordinate attribution area matching method.

[0063] By employing the above technical solution, this embodiment transforms the problem of matching coordinate attribution regions in a latitude and longitude coordinate system into a problem of matching coordinate attribution regions in a plane coordinate system. This allows the problem to be solved using plane geometry, simplifying the difficulty of matching latitude and longitude coordinates, reducing computational load, and improving computational efficiency. Furthermore, this embodiment determines whether the latitude and longitude coordinates to be matched belong to the corresponding candidate region based on whether the first plane coordinate is within the plane region, rather than using grid approximation in existing grid segmentation methods, thus improving the accuracy of region matching. In addition, this embodiment sequentially uses candidate regions from the candidate region set as alternative regions for judgment. If the latitude and longitude coordinates to be matched are determined to be within a candidate region, the judgment can be stopped without calculating the boundary latitude and longitude coordinates of all candidate regions, reducing the cost of acquiring boundary coordinates.

[0064] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0065] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0066] Figure 1 A flowchart illustrating a latitude and longitude coordinate attribution region matching method provided in an embodiment of this application is shown.

[0067] Figure 2 A flowchart illustrating another latitude and longitude coordinate attribution region matching method provided in an embodiment of this application is shown;

[0068] Figure 3 A flowchart illustrating another latitude and longitude coordinate attribution region matching method provided in an embodiment of this application is shown;

[0069] Figure 4 The diagram shows a structural block diagram of a latitude and longitude coordinate attribution area matching device provided in an embodiment of this application. Detailed Implementation

[0070] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.

[0071] This embodiment provides a method for matching latitude and longitude coordinates to their respective regions, such as... Figure 1 As shown, the method includes:

[0072] Step 101: Obtain the latitude and longitude coordinates to be matched, and convert the latitude and longitude coordinates to be matched into first plane coordinates;

[0073] Step 102: Obtain a set of candidate regions, determine one candidate region from the set as a backup region, and sample the boundary of the backup region to obtain multiple boundary latitude and longitude coordinates;

[0074] Step 103: Convert the latitude and longitude coordinates of each boundary into second plane coordinates, and determine the plane region corresponding to the candidate region based on the second plane coordinates, wherein the first plane coordinates and the second plane coordinates are in the same plane coordinate system;

[0075] Step 104: Determine whether the coordinates of the first plane are inside the planar region;

[0076] Step 105: If yes, then determine the candidate area as the target area to which the latitude and longitude coordinates to be matched belong;

[0077] Step 106: If not, delete the candidate area from the candidate area list and return to the step of determining a candidate area from the candidate area set as a candidate area.

[0078] The latitude and longitude coordinate region matching method provided in this application is used to determine the region to which the latitude and longitude coordinates belong, such as province, city, district, street, community, etc. In this application embodiment, the latitude and longitude coordinates to be matched and a set of candidate regions are first obtained. Then, the candidate regions in the set of candidate regions are sequentially used as alternative regions to determine whether the latitude and longitude coordinates to be matched are in the alternative regions. This process continues until the candidate region to which the latitude and longitude coordinates to be matched belongs, which is also the target region, or until all candidate regions in the set of candidate regions have been determined.

[0079] Specifically, in this embodiment, both the latitude and longitude coordinates to be matched and the candidate regions are transformed into the same planar coordinate system. The latitude and longitude coordinates to be matched are transformed into first planar coordinates, and the boundary latitude and longitude coordinates sampled from the candidate regions are transformed into second planar coordinates. Then, in the planar coordinate system, the region to which the latitude and longitude coordinates to be matched belong is determined based on the first and second planar coordinates. Methods such as ray casting, corner rotation, and angle determination can be used to determine whether the first planar coordinates are within the planar region, thereby achieving the matching between the latitude and longitude coordinates to be matched and the target region.

[0080] The following formula can be used to match the latitude and longitude coordinates (lon). o lat o Transform into first plane coordinates (x) o y o ):

[0081] x o =mue·lon o

[0082] y o =lambda·lat o

[0083] In the above formula, mue is the radius of curvature of the meridional circle, and lambda is the radius of curvature of the parallel circle. The formulas for calculating both are shown below:

[0084]

[0085] lanbda=N·cos B

[0086] In the above formula, N is the radius of curvature of the ellipse, and e is the first eccentricity of the ellipse. The calculation formula is shown below:

[0087]

[0088]

[0089] In the above formula, a is the length of the Earth's major axis, b is the length of the Earth's minor axis, and B is the geodetic latitude of the current location.

[0090] In addition, the above formula can also be used to calculate when converting the boundary latitude and longitude coordinates into second plane coordinates.

[0091] It is understood that the above formula is only an example of the transformation from latitude and longitude coordinates to plane coordinates in this application and is not a limitation. It is understood that other methods of coordinate transformation can also achieve the same effect.

[0092] This embodiment transforms the problem of matching coordinate regions in a latitude and longitude coordinate system into a problem of matching coordinate regions in a planar coordinate system. This allows for the use of planar geometry to solve the problem, simplifying the difficulty of matching latitude and longitude coordinate regions, reducing computational load, and improving computational efficiency. Furthermore, this embodiment determines whether the latitude and longitude coordinates to be matched belong to the corresponding candidate region based on whether the first planar coordinate is inside the planar region, rather than using grid approximation in existing grid segmentation methods, thus improving the accuracy of region matching. In addition, this embodiment improves the accuracy by sequentially considering candidate regions from the candidate region set as alternative regions and judging them accordingly. If the latitude and longitude coordinates to be matched are determined to be in a candidate region, the judgment can be stopped without calculating the boundary latitude and longitude coordinates of all candidate regions, reducing the cost of boundary coordinate acquisition.

[0093] Furthermore, as a refinement and extension of the specific implementation of the above embodiments, and to fully illustrate the specific implementation process of this embodiment, another method for matching latitude and longitude coordinate attribution regions is provided. In this method, as follows: Figure 2 As shown, the method includes:

[0094] Step 201: Obtain the latitude and longitude coordinates to be matched, and convert the latitude and longitude coordinates to be matched into first plane coordinates.

[0095] Step 202: Obtain the set of candidate regions, and determine the center position of each candidate region in the set of candidate regions.

[0096] Step 203: Sort the regions to be selected based on the distance between the latitude and longitude coordinates to be matched and each center position to obtain a list of regions to be selected.

[0097] In steps 202-203, the center position of each candidate region in the candidate region set is determined, and then the distance between the latitude and longitude coordinates to be matched and the center position is calculated. The candidate regions are then sorted according to the magnitude of the distance.

[0098] Specifically, obtain the set of candidate regions {A1, A2, ..., A...} m Each candidate region A in} i The latitude and longitude coordinates corresponding to the center position of (i = 1, 2, ..., m) (lon) i lat i Since the latitude and longitude coordinates of the center position are used to calculate the distance between the center position and the latitude and longitude coordinates to be matched, and thus optimize the matching order, therefore (lon) i lat i The center point can be an approximate location of the candidate region, rather than an absolute midpoint. Based on this, the accuracy requirement for selecting the center point can be flexibly determined according to factors such as matching efficiency requirements and the hardware resource limitations of existing computing devices.

[0099] Since the closer the latitude and longitude coordinates to be matched are to the center location, the greater the probability that the coordinates to be matched fall within the candidate region corresponding to that center location, the candidate regions can be sorted according to their distance from each center location. Regions ranked higher can be prioritized as candidate regions to reduce computational load and improve efficiency during the region matching process.

[0100] Preferably, in this embodiment of the application, the selected areas are sorted according to the distance between the latitude and longitude coordinates to be matched and each center position, including the following steps:

[0101] Step 2031: Convert the latitude and longitude coordinates corresponding to each center position into fourth plane coordinates, wherein the fourth plane coordinates and the first plane coordinates are in the same coordinate system;

[0102] Step 2032: Calculate the planar distance between the first plane coordinates and each fourth plane coordinate, and sort the candidate regions corresponding to the fourth plane coordinates in ascending order of planar distance.

[0103] In steps 2031-2032, the selection order of the candidate regions in the candidate region set is determined based on the distance between the latitude and longitude coordinates to be matched and the center position of each candidate region. Candidate regions that are closer to each other are selected as candidate regions first.

[0104] Specifically, the set of regions to be selected {A1, A2, ..., A...} m Each candidate region A in} i The latitude and longitude coordinates corresponding to the center position of (i = 1, 2, ..., m) (lon i lat i Transform into the fourth plane coordinate system (x) i y i Where m is the total number of candidate regions in the candidate region set.

[0105] Then calculate the coordinates (x) of the first plane respectively. o y o ) and each fourth plane coordinate (x i y i The planar distance between two points can be calculated using, for example, the Euclidean distance formula.

[0106]

[0107] In the above formula, d i That is, the candidate area A i The Euclidean distance between the fourth plane coordinates and the first plane coordinates corresponding to the center position, d i The smaller the value, the closer the coordinates of the first plane are to the coordinates of the fourth plane, which means the distance between the latitude and longitude coordinates to be matched and the candidate region A. i The closer the center of the coordinates is, the more likely it is that the latitude and longitude coordinates to be matched are within the selected region A. i The higher the probability, the greater the chance that the selected region is the target region. Based on this, the regions to be selected can be sorted in ascending order of planar distance. In this case, the earlier the region is sorted, the greater the probability that it is the target region.

[0108] Furthermore, the Euclidean distance is only one example of calculating planar distance in this application and is not a limitation. It is understood that other distance calculation formulas can also achieve the same effect.

[0109] This embodiment is based on d i The candidate regions A are arranged in ascending order. i The matching results are sorted in order to optimize matching efficiency.

[0110] Step 204: In the list of candidate areas, determine the candidate area that is sorted first as the alternative area.

[0111] This application's embodiments sort the candidate regions based on the distance between the latitude and longitude coordinates to be matched and the center position, obtaining a list of candidate regions. The candidate regions are then determined according to the order of the list, achieving the effect of first judging candidate regions with shorter distances and then judging candidate regions with longer distances. That is, it prioritizes judging the candidate regions most likely to be the target region, and stops judging once the target region is obtained, greatly reducing the computational load in the judgment process and improving matching efficiency.

[0112] Step 205: Obtain the matching accuracy and the boundary complexity of the candidate regions, and determine the number of samples based on the matching accuracy and boundary complexity.

[0113] Step 206: Sample the boundaries of the candidate areas to obtain the latitude and longitude coordinates of the sampled boundaries.

[0114] In steps 205-206, it can be understood that when sampling the boundary of the candidate area to obtain the boundary latitude and longitude coordinates, the more samples are taken and the more boundary latitude and longitude coordinates are obtained, the better the fitting effect of the boundary of the candidate area and the more accurate the region matching result. However, the more samples are taken, the more sampling workload and the more computational workload in the matching process will be, and the matching efficiency will be reduced.

[0115] Therefore, the number of samples is determined based on the required matching accuracy and the boundary complexity of the candidate regions. Higher matching accuracy requires a larger number of samples, as does higher boundary complexity; in other words, both matching accuracy and boundary complexity are positively correlated with the number of samples.

[0116] Specifically, after determining the sampling quantity, the candidate area A is processed according to the sampling quantity. p The boundary is sampled to obtain a set of boundary latitude and longitude coordinates.

[0117] LLC = {(lon p1 lat p1 ), (lon p2 lat p2 ), ..., (lon pj lat pj )}

[0118] Where j is the number of samples. The larger the number of samples, the more sampling points there are, and the higher the accuracy of the subsequent fitting.

[0119] This embodiment takes into full account the actual matching accuracy requirements and the boundary complexity of the candidate regions when determining the number of samples, balancing matching accuracy and matching efficiency, and improving matching efficiency while ensuring matching accuracy.

[0120] Step 207: Convert the latitude and longitude coordinates of each boundary into second plane coordinates, wherein the first plane coordinates and the second plane coordinates are in the same plane coordinate system.

[0121] In step 207, the boundary latitude and longitude coordinates are transformed into second plane coordinates to obtain a set of second plane coordinates corresponding to the candidate areas:

[0122] XYC={(x p1 y p1 ), (x p2 y p2 ), ..., (x pj y pj )}

[0123] The steps for converting the boundary latitude and longitude coordinates into the second plane coordinates can be referred to the coordinate transformation formula for converting the latitude and longitude coordinates to the first plane coordinates mentioned above, and will not be repeated here.

[0124] Step 208: In the multiple second plane coordinates, each second plane coordinate is taken as the target coordinate, and the two coordinates adjacent to the target coordinate are determined as adjacent coordinates.

[0125] Step 209: If there is no line segment between the target coordinates and the adjacent coordinates, then construct line segments using the target coordinates and the adjacent coordinates as vertices respectively.

[0126] Step 210: Determine the closed area formed by multiple line segments as the planar area corresponding to the candidate area.

[0127] In steps 208-210, the coordinate points corresponding to adjacent second plane coordinates are connected pairwise to obtain a closed shape. This closed shape is then used for boundary fitting using the second plane coordinates to obtain the planar region corresponding to the candidate region. Specifically, each second plane coordinate is used as the target coordinate, and its two adjacent second plane coordinates are used as adjacent coordinates. If there is no line segment between the target coordinate and the adjacent coordinate, a line segment is constructed between the target coordinate and the adjacent coordinate to connect them. If there is already a line segment connecting the target coordinate and the adjacent coordinate, no further line segment is constructed to avoid duplication.

[0128] Among them, for the target coordinates (x) pa y pa ) and adjacent coordinates (x pb y pbThe following formula can be used to construct line segments:

[0129]

[0130] Where, x∈[min(x pa x pb ), max(x pa x pb )).

[0131] By constructing line segments between two adjacent second-plane coordinates and linking them pairwise, a closed polygonal region is obtained. Each edge of this closed region is a previously constructed line segment, and the number of edges j is equal to the number of line segments and also equal to the number of samples. This closed region MA p This is candidate area A. p Function set model representation in a planar coordinate system:

[0132] MA p ={f1(x), f2(x), ..., f j (x)}.

[0133] This embodiment uses the above transformation to match the latitude and longitude coordinates (lon). o lat o Is it in candidate area A? p The problem within is transformed into first-plane coordinates (x... o y o Is it in MA? p The problem of constructing a closed region from a set of line segments further simplifies the problem, reducing the complexity and computational cost of matching operations.

[0134] Step 211: Set the third plane coordinates in the plane coordinate system, where the third plane coordinates are different from the first plane coordinates.

[0135] Step 212: Draw a ray starting from the first plane coordinates, where the ray passes through the third plane coordinates.

[0136] Step 213: Determine whether the coordinates of the first plane are inside the plane region based on the positional relationship between the ray and the plane region.

[0137] In steps 211-213, determining whether a point is inside a polygon in a planar coordinate system can be achieved using the ray method. Specifically, a coordinate point other than the first planar coordinate is determined as the third planar coordinate in the planar coordinate system. Starting from the first planar coordinate, a ray is drawn through the third planar coordinate. Then, the positional relationship between the ray and the planar region can be used to determine whether the first planar coordinate is inside the planar region.

[0138] Specifically, the first plane coordinates (x o y o Starting from a point (x), construct a ray: randomly select a point (x) in the plane coordinate system. rand y rand ) is used as the coordinate system of the third plane, where x rand >x o Connect the two points and construct a ray using the following formula:

[0139]

[0140] Understandably, an x ​​can also be chosen. rand <x o The point (x) rand y rand Using the coordinates of the third plane as the coordinates, the ray can be constructed using the following formula:

[0141]

[0142] The process of determining whether the coordinates of the first plane are inside the plane region based on the positional relationship between the ray and the planar region includes the following steps:

[0143] Step 2131: Determine whether the ray intersects with each line segment, and determine the total number of intersections between the ray and multiple line segments based on the determination results;

[0144] Step 2132: If the total number is odd, then determine that the first plane coordinates are inside the plane region;

[0145] Step 2133: If the total number is even, then it is determined that the coordinates of the first plane are not inside the plane region.

[0146] In steps 2131-2133, the total number of intersections between the ray and the boundary of the planar region is used to determine whether the starting point of the ray, i.e., the coordinates of the first plane, is inside the planar region.

[0147] Specifically, it can be set

[0148]

[0149] Where, when ray f(x) and line segment f i When (x) has an intersection point, let tag be a symbol. i If the value is 1, then it is 0. Summing over all tags tagi (i = 1, 2, ..., j) yields the ray and MA. p The number of all intersection points of the boundary of the planar region represented by the set of line segments, i.e.

[0150]

[0151] The coordinates (x, y) of the first plane can be determined by the total number of intersection points Num. o , yo Is it in the planar region MA? p Internal: When Num is odd, (x o , yo In the planar region MA p Internal; when Num is even, (x o y o Not in the planar region MA p internal.

[0152] Furthermore, if ray f(x) intersects with a line segment f i (x) intersects and is parallel, that is, a part of the ray f(x) intersects and is parallel to the line segment f. i If ray f(x) coincides with line segment f(x), then denote the intersection of ray f(x) and line segment f(x). i The number of intersections of (x) is 1.

[0153] This embodiment determines whether the first plane coordinates are inside the plane region by the number of intersections between the ray and the boundary of the plane region, without having to analyze whether the first plane coordinates satisfy the constraints corresponding to each edge one by one. The calculation steps are simple and intuitive.

[0154] Step 214: If the first plane coordinates are inside the plane region, then the candidate region is determined as the target region to which the latitude and longitude coordinates to be matched belong.

[0155] Step 215: If the first plane coordinates are not inside the plane region, delete the candidate region from the candidate region list and return to the step of determining a candidate region from the candidate region set as a candidate region.

[0156] In this embodiment, when the first plane coordinate (x) o y o In the planar region MA p When internal, the output planar region MA p Corresponding alternative area A p The candidate area is the target area to which the latitude and longitude coordinates to be matched belong; when the first plane coordinate (x o y o Not in the planar region MA p When inside, the regions are sorted according to the distance between the center location and the latitude and longitude coordinates to be matched, and the next candidate region is selected as a new candidate region. The new candidate region is then re-evaluated.

[0157] Figure 3The figure illustrates a flowchart of another method for matching latitude and longitude coordinates to a given region. As shown, the method involves acquiring the latitude and longitude coordinates to be matched and a set of candidate regions. The latitude and longitude information of the coordinates to be matched is converted into first-plane coordinates, and the center position of each candidate region in the set is converted into second-plane coordinates. In the plane coordinate system, the distance between the first-plane coordinates corresponding to the latitude and longitude coordinates to be matched and the second-plane coordinates corresponding to the center positions are calculated. Candidate regions are then selected for matching in ascending order of distance. Each selected candidate region is used as a backup region. Boundary sampling is performed on the backup regions, and each sampled position is converted into a corresponding third-plane coordinate. Boundary fitting is performed based on the set of all third-plane coordinates, transforming the backup regions into closed planar regions of polygons in the plane coordinate system. Finally, it is determined whether the first-plane coordinates corresponding to the latitude and longitude coordinates to be matched are within the planar region of this polygon. If the first planar coordinates are within the planar region of the polygon, then the candidate region corresponding to the current planar region is output. This candidate region is the target region corresponding to the latitude and longitude coordinates to be matched. If the first planar coordinates are not within the planar region of the polygon, then the next candidate region is selected as the new candidate region and the judgment continues.

[0158] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0159] Furthermore, as a specific implementation of the above-mentioned latitude and longitude coordinate attribution region matching method, this application embodiment provides a latitude and longitude coordinate attribution region matching device, such as... Figure 4 As shown, the device includes: a module for obtaining coordinates to be matched, a module for obtaining candidate regions, a judgment module, and a loop module.

[0160] The module for obtaining coordinates to be matched is used to obtain the latitude and longitude coordinates to be matched and convert them into first plane coordinates.

[0161] The candidate region acquisition module is used to acquire a set of candidate regions, determine one candidate region from the set as a candidate region, sample the boundary of the candidate region to obtain multiple boundary latitude and longitude coordinates; and convert each boundary latitude and longitude coordinate into a second plane coordinate, and determine the plane region corresponding to the candidate region based on the second plane coordinate, wherein the first plane coordinate and the second plane coordinate are in the same plane coordinate system;

[0162] The judgment module is used to determine whether the first plane coordinates are inside the plane region; if so, the candidate region is determined as the target region to which the latitude and longitude coordinates to be matched belong; if not, the candidate region is deleted from the candidate region list.

[0163] The loop module is used to return the steps that determine a candidate region from the set of candidate regions.

[0164] In specific application scenarios, optionally, the alternative area acquisition module is used for:

[0165] In multiple second-plane coordinates, each second-plane coordinate is taken as the target coordinate, and the two coordinates adjacent to the target coordinate are determined as adjacent coordinates;

[0166] If there is no line segment between the target coordinates and the adjacent coordinates, then construct line segments using the target coordinates and the adjacent coordinates as vertices respectively;

[0167] The closed region formed by multiple line segments is identified as the planar region corresponding to the candidate region.

[0168] In specific application scenarios, optionally, the judgment module is used for:

[0169] In a planar coordinate system, a third planar coordinate is set, where the third planar coordinate is different from the first planar coordinate.

[0170] Draw a ray starting from the first plane coordinates, where the ray passes through the third plane coordinates;

[0171] Based on the positional relationship between the ray and the planar region, determine whether the coordinates of the first plane are inside the planar region.

[0172] In specific application scenarios, optionally, the judgment module is used for:

[0173] Determine whether the ray intersects with each line segment, and determine the total number of intersections between the ray and multiple line segments based on the determination results;

[0174] If the total number is odd, then the coordinates of the first plane are determined to be inside the plane region;

[0175] If the total number is even, then the coordinates of the first plane are determined to be outside the plane region.

[0176] In specific application scenarios, optionally, the alternative area acquisition module is used for:

[0177] Obtain the matching accuracy and the boundary complexity of the candidate regions, and determine the number of samples based on the matching accuracy and boundary complexity;

[0178] The boundaries of the candidate areas are sampled to obtain the latitude and longitude coordinates of the sampled boundaries.

[0179] In specific application scenarios, optionally, the alternative area acquisition module is used for:

[0180] In the set of candidate regions, determine the center position of each candidate region;

[0181] Based on the distance between the latitude and longitude coordinates to be matched and each center location, the regions to be selected are sorted to obtain a list of regions to be selected;

[0182] In the list of candidate areas, the candidate area that is sorted first is selected as the alternative area.

[0183] In specific application scenarios, optionally, the alternative area acquisition module is used for:

[0184] The latitude and longitude coordinates corresponding to each center position are transformed into fourth plane coordinates, wherein the fourth plane coordinates and the first plane coordinates are in the same coordinate system;

[0185] Calculate the planar distance between the first plane coordinates and each fourth plane coordinate, and sort the candidate regions corresponding to the fourth plane coordinates in ascending order of planar distance.

[0186] It should be noted that other corresponding descriptions of the functional modules involved in the latitude and longitude coordinate attribution area matching device provided in this application embodiment can be found in the corresponding descriptions in the above method, and will not be repeated here.

[0187] Based on the above method, the present application also provides a storage medium storing a computer program that, when executed by a processor, implements the above-described latitude and longitude coordinate attribution region matching method.

[0188] Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, or portable hard drive) and includes several instructions to cause an electronic device (such as a personal computer, server, or network device) to execute the methods described in the various implementation scenarios of this application.

[0189] Based on the above, Figures 1 to 3 The method shown, and Figure 4 To achieve the above objectives, this application also provides an electronic device, specifically a personal computer, server, network device, or self-moving device such as a cleaning robot, as illustrated in the virtual device embodiment. This electronic device includes a storage medium and a processor; the storage medium stores a computer program; the processor executes the computer program to achieve the above-described objectives. Figures 1 to 3 The method for matching the latitude and longitude coordinates to the assigned region is shown.

[0190] Optionally, the electronic device may also include a user interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB interfaces, card reader interfaces, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Bluetooth interfaces, Wi-Fi interfaces), etc.

[0191] Those skilled in the art will understand that the electronic device structure provided in this embodiment does not constitute a limitation on the electronic device, and may include more or fewer components, or combine certain components, or have different component arrangements.

[0192] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages and stores the hardware and software resources of the electronic device, supporting the operation of information processing programs and other software and / or programs. The network communication module is used to enable communication between various controls within the storage medium, as well as communication with other hardware and software within the physical device.

[0193] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platform, or it can be implemented by hardware.

[0194] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the units or processes shown in the drawings are not necessarily essential for implementing this application. Those skilled in the art will understand that the units in the apparatus of the embodiment can be distributed within the apparatus of the embodiment as described, or can be located in one or more apparatuses different from this embodiment, with corresponding changes. The units of the above-described embodiment can be combined into one unit, or further divided into multiple sub-units.

[0195] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of any particular implementation scenario. The above disclosures are merely a few specific implementation scenarios of this application; however, this application is not limited thereto, and any variations conceived by those skilled in the art should fall within the protection scope of this application.

Claims

1. A method for matching latitude and longitude coordinates to a given region, characterized in that, The method includes: Obtain the latitude and longitude coordinates to be matched, and convert the latitude and longitude coordinates to be matched into first plane coordinates according to the radius of curvature of the meridian circle and the radius of curvature of the parallel circle; Obtain a set of candidate regions, and determine a candidate region as a backup region in the set of candidate regions based on the distance between the latitude and longitude coordinates to be matched and the center position of the candidate region in the set of candidate regions. Then, sample the boundary of the backup region according to the required matching accuracy and the boundary complexity of the backup region, and obtain multiple boundary latitude and longitude coordinates. Each boundary latitude and longitude coordinate is converted into a second plane coordinate based on the radius of curvature of the meridian circle and the radius of curvature of the parallel circle, respectively. Based on the second plane coordinate, a plane region corresponding to the candidate region is determined. The first plane coordinate and the second plane coordinate are in the same plane coordinate system. The plane region is a polygonal closed region in the plane coordinate system obtained by converting the sampling position information of each boundary of the candidate region into corresponding third plane coordinates, and by performing boundary fitting based on the set of all third plane coordinates. The third plane coordinates are different from the first plane coordinates. Determine whether the first plane coordinates are inside the plane region; If so, then the candidate area is determined to be the target area to which the latitude and longitude coordinates to be matched belong; If not, delete the candidate region from the candidate region list and return to the step of determining a candidate region as a candidate region in the candidate region set based on the distance between the latitude and longitude coordinates to be matched and the center position of the candidate region in the candidate region set.

2. The method according to claim 1, characterized in that, The step of determining the planar region corresponding to the candidate region based on the second planar coordinates includes: In a plurality of second plane coordinates, each second plane coordinate is taken as the target coordinate, and the two coordinates adjacent to the target coordinate are determined as adjacent coordinates; If there is no line segment between the target coordinates and the adjacent coordinates, then line segments are constructed using the target coordinates and the adjacent coordinates as vertices respectively; The closed region formed by the multiple line segments is determined as the planar region corresponding to the candidate region.

3. The method according to claim 2, characterized in that, Determining whether the first plane coordinates are inside the plane region includes: A third plane coordinate system is established in the aforementioned plane coordinate system; Draw a ray starting from the first plane coordinates, wherein the ray passes through the third plane coordinates; Based on the positional relationship between the ray and the planar region, determine whether the first plane coordinates are inside the planar region.

4. The method according to claim 3, characterized in that, The step of determining whether the first plane coordinates are inside the plane region based on the positional relationship between the ray and the plane region includes: Determine whether the ray intersects with each of the line segments, and determine the total number of intersections between the ray and the multiple line segments based on the determination results; If the total number is odd, then the first plane coordinates are determined to be inside the plane region; If the total number is even, then the first plane coordinates are determined not to be inside the plane region.

5. The method according to claim 1, characterized in that, The process of sampling the boundaries of the candidate regions yields multiple boundary latitude and longitude coordinates, including: Obtain the matching accuracy and the boundary complexity of the candidate regions, and determine the number of samples based on the matching accuracy and the boundary complexity; The boundary of the candidate region is sampled to obtain the number of sampled boundary latitude and longitude coordinates.

6. The method according to claim 1, characterized in that, The step of determining a candidate region from the set of candidate regions as an alternative region includes: In the set of candidate regions, the center position of each candidate region is determined; Based on the distance between the latitude and longitude coordinates to be matched and each of the center positions, the candidate regions are sorted to obtain a list of candidate regions; In the list of candidate areas, the candidate area that is ranked first is determined as the alternative area.

7. The method according to claim 6, characterized in that, The step of sorting the candidate regions according to the distance between the latitude and longitude coordinates to be matched and each of the center positions includes: The latitude and longitude coordinates corresponding to each of the central positions are respectively transformed into fourth plane coordinates, wherein the fourth plane coordinates and the first plane coordinates are in the same coordinate system; Calculate the planar distance between the first plane coordinates and each of the fourth plane coordinates, and sort the candidate regions corresponding to the fourth plane coordinates in ascending order of the planar distance.

8. A device for matching latitude and longitude coordinate attribution areas, characterized in that, The device includes: The module for obtaining coordinates to be matched is used to obtain the latitude and longitude coordinates to be matched, and to convert the latitude and longitude coordinates to be matched into first plane coordinates according to the radius of curvature of the meridian circle and the radius of curvature of the parallel circle; The candidate region acquisition module is used to acquire a set of candidate regions, and determine a candidate region as a candidate region in the set of candidate regions based on the distance between the latitude and longitude coordinates to be matched and the center position of the candidate region in the set of candidate regions. The module also samples the boundary of the candidate region according to the required matching accuracy and the boundary complexity of the candidate region, and obtains multiple boundary latitude and longitude coordinates. The judgment module is used to convert the latitude and longitude coordinates of each boundary into second plane coordinates according to the radius of curvature of the meridian circle and the radius of curvature of the parallel circle, and to determine the plane region corresponding to the candidate region according to the second plane coordinates. The first plane coordinates and the second plane coordinates are in the same plane coordinate system. The plane region is a polygonal closed region in the plane coordinate system by converting the sampled position information of each boundary of the candidate region into corresponding third plane coordinates and performing boundary fitting based on the set of all third plane coordinates. The third plane coordinates are different from the first plane coordinates. The module also determines whether the first plane coordinates are inside the plane region. If yes, the candidate region is determined to be the target region to which the latitude and longitude coordinates to be matched belong. If no, the candidate region is deleted from the candidate region list. The loop module is used to return the step of determining a candidate region as a backup region in the candidate region set based on the distance between the latitude and longitude coordinates to be matched and the center position of the candidate region in the candidate region set.

9. A storage medium having a program or instructions stored thereon, characterized in that, When the program or instructions are executed by the processor, they implement the method as described in any one of claims 1 to 7.

10. An electronic device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the program, it implements the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and system for distinguishing regional attribution of longitude and latitude points

    CN113806457A

  • Target position indexing method and device and electronic equipment

    CN114579808A