Method and system for quickly checking large-scale trace points in area

By polygonal division and multi-thread processing of large-area areas, the problem of high time complexity in large-scale spot area verification in the existing technology is solved, efficient spot area verification is achieved, Cartesian product is avoided, and improvement is achieved performance and flexibility.

CN118779576APending Publication Date: 2024-10-15XIAMEN RUISUAN INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410744900.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

When performing large-scale point trace area verification, the existing technology has high time complexity and is prone to produce Cartesian products, resulting in high consumption of computing resources and poor performance.

Method used

By polygonally dividing a large area into small area units, multi-threads are used to concurrently process point data, and Geotool tools are used for graphics processing and spatial operations to avoid Cartesian products and reduce time complexity.

Benefits of technology

The efficiency of spot trace area verification is significantly improved, and the time complexity is reduced from O(mn) to

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779576A_ABST
    Figure CN118779576A_ABST
Patent Text Reader

Abstract

The invention provides a method and system for quickly verifying large-scale trace points in an area, and the method comprises the steps: importing a file: importing a trace point file comprising a set area, the trace point data in the trace point file comprising longitude information lng and latitude information lat; a Geotool is called to carry out graphic processing, a set area file is loaded into a memory, a large-area area is processed according to the area division principle, a relatively small area set M0 is obtained, the area set M0 comprises all area units, and each trace point in the area set M0 only falls into one area unit; reading all trace point data in the trace point file; multi-thread batch verification: creating a multi-thread task, and processing trace point data in batches until data processing is completed; and counting the verification data, and ending. The method has the beneficial effects that the Cartesian product is avoided, and the check efficiency of the trace point area is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of big data processing, and in particular to a method and system for quickly verifying large-scale point traces in an area. Background Art

[0002] For large amounts of point data, such as large-scale point data in large-scale track association algorithms, if regional verification is required, there are usually two methods:

[0003] 1. Program logic implementation, mainly through iterative judgment of each sub-region to be judged, and then judge whether it is completely contained in the target area one by one. Although this solution is highly flexible, it has high computational complexity, especially for large-scale regional data, which will consume more computing resources and time;

[0004] Second, with the help of the extended spatiotemporal data storage and retrieval technology of relational databases (MYSQL / POSTGRESQL), use the Geometry type to store large-scale point traces and regional data respectively, and then use SQL spatial operation analysis functions to perform data association query operations to determine whether the point is included in the region. Although this solution can be implemented, it will generate a large amount of temporary data for massive data and has poor performance.

[0005] Although both of the above two solutions can realize the verification of the point trace area, it is easy to generate Cartesian products when verifying massive data through iteration / association, and the time complexity is as high as O(mn). Summary of the invention

[0006] In order to solve the problems of high time complexity and easy generation of Cartesian product during verification in the prior art, the present invention provides a method for quickly verifying large-scale points in an area, which uses space for time to increase memory usage and reduce time complexity, thereby effectively improving the verification efficiency of the point area.

[0007] The method for quickly verifying large-scale point traces in an area of ​​the present invention comprises the following steps:

[0008] S1: Import file: import a point trace file including a set area, wherein the point trace data in the point trace file includes longitude information lng and latitude information lat;

[0009] S2: Initialize the region: call the Geotool tool to perform graphic processing, load the set region file into the memory, and process the large area according to the region division principle to obtain a relatively small region set M0, which contains all region units, and each point in the region set M0 falls into only one of the region units;

[0010] S3: read all the trace data in the trace file;

[0011] S4: Multi-threaded batch verification: create multi-threaded tasks and process the trace data in batches until the data processing is completed; S5: count and verify the data, and then end.

[0012] Furthermore, in step S2, the region division processing method is:

[0013] S201: Divide the set area into polygons and calculate the area of ​​the polygons;

[0014] S202: Determine whether the polygon area is greater than a threshold, and if so, further segment the polygon;

[0015] S203: Get the coordinate midpoint p0(x,y) of the polygon, p0(x,y)=(maxX-minX,maxY-minY), where x and y are the X coordinate value and Y coordinate value respectively, maxX is the maximum X coordinate value in the polygon, minX is the minimum X coordinate value, maxY is the maximum Y coordinate value in the polygon, and minY is the minimum Y coordinate value;

[0016] S204: According to the coordinate midpoint p0, the polygon is divided into four rectangles [minX, minY, p0x, p0y], [minX, maxY, p0x, p0y], [maxX, maxY, p0x, p0y], [maxX, minY, p0x, p0y], and then the intersection parts with the polygon are obtained respectively: Geometry.Intersection(geometry);

[0017] S205: After obtaining the segmented polygon, recursively execute steps S202-204 on the segmented polygon in sequence until the minimum area unit is obtained;

[0018] S206: Assembling area unit objects: setting the grid size, creating an area set M0 of a two-dimensional set object, and setting the segmented minimum polygon into the area set M0 according to the x and y intervals and the grid size.

[0019] Furthermore, in step S4, in the multi-thread batch verification, the specific processing method for each thread is:

[0020] S401: Create Geo object: read each point data, and construct Geo point object Point(x,y) according to longitude information lng and latitude information lat;

[0021] S402: Retrieve point trace area data: According to the position of x, y of the Point (x, y) object in M0, obtain the list of areas to be inspected L1;

[0022] S403: Verify point traces: loop through each area in the list of areas to be checked L1, and determine whether the area contains point trace data. If found, end this loop and mark the current point trace data as within the area.

[0023] Furthermore, each thread uses the contains method of the GeoTool tool for verification.

[0024] Furthermore, in step S4, the multithreading is executed on multiple computing nodes respectively, a distributed computing system is used to disperse the trace data to multiple computing nodes for verification, and a cache middleware is set for storing and reading the regional information of multiple computing nodes.

[0025] Furthermore, it also includes the step of evaluating each technical node: obtaining the load condition of each computing node, automatically dynamically expanding or shrinking the service according to the load condition, and then dynamically allocating and adjusting the number of point trace data verified by each computing node.

[0026] The present invention also provides a system for quickly verifying large-scale point traces in an area, which is used to implement the method for quickly verifying large-scale point traces in an area, comprising:

[0027] Import file module: used to import a point trace file including a set area, where the point trace data in the point trace file includes longitude information lng and latitude information lat;

[0028] Initialize region module: used to call Geotool for graphics processing, load the set region file into memory, and process the large area according to the region division principle to obtain a relatively small region set, which contains all region units, and each point in the region set falls into only one of the region units;

[0029] Reading module: used to read all the point trace data in the point trace file;

[0030] Multi-threaded batch verification module: used to create multi-threaded tasks and process point trace data in batches until the data processing is completed;

[0031] Statistics module: used to count and verify data.

[0032] Furthermore, the initialization region module is provided with a region division submodule, and the processing method of the region division submodule is:

[0033] S201: Divide the set area into polygons and calculate the area of ​​the polygons;

[0034] S202: Determine whether the polygon area is greater than a threshold, and if so, further segment the polygon;

[0035] S203: Obtain the coordinate midpoint p0(x, y) of the polygon, p0(x, y) = (maxX - minX, maxY - minY), where x and y are the X coordinate value and Y coordinate value respectively, maxX is the maximum X coordinate in the polygon, minX is the minimum X coordinate, maxY is the maximum Y coordinate in the polygon, and minY is the minimum Y coordinate;

[0036] S204: According to the coordinate midpoint p0, divide the polygon into four rectangles [minX, minY, p0x, p0y], [minX, maxY, p0x, p0y], [maxX, maxY, p0x, p0y], [maxX, minY, p0x, p0y], and then respectively obtain the intersecting parts with the polygon: Geometry.Intersection(geometry);

[0037] S205: After obtaining the divided polygons, perform recursion: sequentially execute steps S202 - 204 on the divided polygons until the smallest area unit is obtained;

[0038] S206: Assemble the area unit object: Set the grid size, create the area set M0 of the two-dimensional set object, and set the divided smallest polygons into the area set M0 according to the x and y intervals and the grid size.

[0039] Furthermore, the multi-threaded batch verification module includes:

[0040] Multi-threaded creation sub-module: Create multi-threads;

[0041] Geo object creation sub-module: Used to read each trace data point, and construct a Geo trace object Point(x, y) according to the longitude information lng and latitude information lat;

[0042] Retrieval of trace area data sub-module: Used to obtain the list L1 of areas to be verified according to the positions of x and y in the Point(x, y) object;

[0043] Trace verification sub-module: Loop through and verify the traces in each area of the list L1 of verification areas.

[0044] Compared with the prior art, the beneficial effects of the present invention are: By dividing the graphic area, converting a large area into small areas and then re-storing them in the form of an area unit set, the time complexity is reduced to O(1). Finally, multi-threading is used to concurrently verify a large number of traces one by one, and the time complexity is reduced from O(mn) to <O(n), where m is the number of threads and n is the number of a large number of traces, greatly improving the efficiency of trace area verification.

[0045] The present invention does not need to rely on a database, and can customize the judgment logic and data structure according to specific application requirements, thereby having higher flexibility, not generating a large amount of temporary data, greatly improving the verification performance, and being able to avoid the Cartesian product problem during verification. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the present invention or the solutions in the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0047] Figure 1 is a flow chart of the method of the present invention;

[0048] Figure 2 This is a flow chart of the area division process of the present invention;

[0049] Figure 3 This is a schematic diagram of the regional division principle. DETAILED DESCRIPTION

[0050] Unless otherwise defined, all technical and scientific terms used in the present invention have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs; the terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention; the terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present invention or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0051] Reference to "embodiments" in the present invention means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it mutually exclusive, independent, or alternative to other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in the present invention may be combined with other embodiments.

[0052] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings.

[0053] like Figure 1 As shown, the method for quickly verifying large-scale point traces in an area of ​​the present invention comprises the following steps:

[0054] S1: Import file.

[0055] In this example, a file including large-scale point traces is imported. The point trace data in the point trace file needs to contain longitude information lng and latitude information lat, otherwise the imported file is invalid.

[0056] S2: Initialization area.

[0057] This example is completed with the help of Geotool, calling Geotool for graphics processing and loading the set area file into memory. This example is applied in track association calculation. Therefore, this example loads the global land area file, and then processes the large area according to the regional division principle to obtain a relatively small area set M0. The areas in the regional units in the regional set M0 of this example do not intersect. When the loaded areas do not intersect, if the grid and area thresholds set according to the regional division principle are reasonable, each point data coordinate x and y in M0 corresponds to only one divided area, that is, the time complexity is O(1).

[0058] S3: Read all the trace data in the trace file.

[0059] S4: Multi-threaded batch verification.

[0060] Create a multi-threaded task to process the trace data in batches until the data processing is completed. The maximum number of core threads is 2*cpuNum-1, and the number of traces processed in a single thread batch is 1000, which can be adjusted according to actual conditions.

[0061] S5: Count the verification data, and then feed back the verification results to the front end, and then end.

[0062] like Figure 2 As shown, this example uses the polygonal area cutting principle to divide the area. The specific processing method is:

[0063] S201: Calculate the area of ​​the polygonal region;

[0064] S202: Determine whether the polygon area is greater than a threshold, and if so, further segment the polygon;

[0065] S203: Get the coordinate midpoint p0(x,y) of the polygon, p0(x,y)=(maxX-minX,maxY-minY), where x and y are the X coordinate value and Y coordinate value respectively, maxX is the maximum X coordinate value in the polygon, minX is the minimum X coordinate value, maxY is the maximum Y coordinate value in the polygon, and minY is the minimum Y coordinate value;

[0066] S204: According to the coordinate midpoint p0, the polygon is divided into four rectangles [minX, minY, p0x, p0y], [minX, maxY, p0x, p0y], [maxX, maxY, p0x, p0y], [maxX, minY, p0x, p0y], and then the intersection parts with the polygon are obtained respectively: Geometry.Intersection(geometry);

[0067] S205: After obtaining the segmented polygon, recursively execute steps S202-204 on the segmented polygon in sequence until the minimum area unit is obtained;

[0068] S206: Assembling area unit objects: setting the grid size (eg, 0.1°), creating an area set M0 of a two-dimensional set object, and setting the segmented minimum polygon into the area set M0 according to the x and y intervals and grid size.

[0069] like Figure 3 As shown, the specific implementation logic of this example is:

[0070]

[0071]

[0072] Set the minimum polygon after segmentation to the region set M0 according to the range of coordinates x and y values ​​and the grid size. For example, polygon[minX=0.1,maxX=0.22,minY=0.11,maxY=0.18], through the range of min and max and the grid size (0.1°), the X set to M0 should be 0.1 and 0.2, and the Y set to M0 should be 0.1, and M0 is obtained as follows:

[0073]

[0074] Example: Assume that the polygon p = Polygon((00,01,11,10,00)) has minX = 0, minY = 0, maxX = 1, and maxY = 1, then the midpoint p0x = 0.5p0y = 0.5.

[0075] Determine whether the polygon area is greater than the threshold: p.getArea()>threshold. If so, cut it.

[0076] Use Geotools to construct the cut graphic object, such as p1 = JTS.toGeometry (newEnvelope (0, 0.5, 0, 0.5)) = > Polygon ((0.50, 00, 00.5, 0.50.5, 0.50));

[0077] Execute p1.instersection(p) to obtain the intersecting new Polygon object;

[0078] After multiple recursive calculations, the grid tempP1=Polygon((0.250,00,00.25,0.250.25,0.250))=>Polygon((0.1250,00,00.125,0.1250.125,0.1250))=>Polygon((0.06250,00,00.0625,0.06250.0625,0.06250)) is obtained;

[0079] From the last one, we can see that the x and y of Polygon((0.06250,00,00.0625,0.06250.0625,0.06250)) fall in the interval [0,0.1), so the M0 set should be:

[0080]

[0081] Note: This example is only an implementation for calculating the minimum interval of the left area, and is not the final result of the entire graph.

[0082] In step S4 of this example, in the multi-thread batch verification, the specific processing method for each thread is:

[0083] S401: Create Geo object: read each point data, and construct Geo point object Point(x,y) according to longitude information lng and latitude information lat;

[0084] S402: Retrieve point trace area data: According to the position of x, y of the Point (x, y) object in M0, obtain the list of areas to be inspected L1;

[0085] S403: Verify point traces: loop through each area in the list of areas to be checked L1, and determine whether the area contains point trace data. If found, end this loop and mark the current point trace data as within the area.

[0086] In this example, each thread uses the contains method of the GeoTool tool for verification. This example is based on a distributed computing system, and the multiple threads are executed on multiple computing nodes. This solution uses a distributed computing system (such as Hadoop, Apache Flink, etc.) to distribute the point data to multiple computing nodes for verification, and uses cache middleware (Redis, memcache, etc.) to store and read the regional information of multiple computing nodes.

[0087] Preferably, in this example, a task scheduling mechanism of a distributed system can also be set up to automatically distribute data to each computing node and collect the results after the calculation is completed. And with the help of kubernetes, the CPU, memory and other load conditions of the distributed computing service can be checked, so as to dynamically expand / contract the service, and then dynamically allocate and adjust the number of trace data verified by each computing node, so as to improve the stability and efficiency of processing.

[0088] The present invention also provides a system for quickly verifying large-scale point traces in an area, which is used to implement the method for quickly verifying large-scale point traces in an area, comprising:

[0089] Import file module: used to import a point trace file including a set area, where the point trace data in the point trace file includes longitude information lng and latitude information lat;

[0090] Initialize region module: used to call Geotool for graphics processing, load the set region file into memory, and process the large area according to the region division principle to obtain a relatively small region set, which contains all region units, and each point in the region set falls into only one of the region units;

[0091] Reading module: used to read all the point trace data in the point trace file;

[0092] Multi-threaded batch verification module: used to create multi-threaded tasks and process point trace data in batches until the data processing is completed;

[0093] Statistics module: used to count and verify data.

[0094] Preferably, the initialization region module is provided with a region division submodule, which divides the region using the polygon region segmentation principle. The multi-threaded batch verification module in this example includes:

[0095] Multithreaded creation submodule: used to create multithreaded;

[0096] Geo object creation submodule: used to read each point data and construct Geo point object Point(x,y) according to longitude information lng and latitude information lat;

[0097] Retrieve point trace area data submodule: used to obtain the list of areas to be inspected L1 according to the x, y positions of the Point (x, y) object in the ;

[0098] Verification point trace submodule: loop through the traces of each area in the verification area list L1.

[0099] From the above, it can be seen that this scheme greatly improves the efficiency of point trace area verification by recombining and concurrently processing regional data and reducing time complexity.

[0100] Specifically, the present invention uses the Geotool tool (Geotool tool provides methods for operating geographic spatial data, including graphics processing, conversion, calculation analysis, etc.) to improve memory usage and reduce time complexity by exchanging space for time. The present invention understands the earth as a plane, and no area on this plane will overlap with another area. Therefore, it is necessary to convert large areas into small areas and then store them again in the form of Map collection, reducing the time complexity to O(1). Finally, multi-threaded concurrent verification is used to verify large-scale points one by one, reducing the time complexity from O(mn) to <O(n)。

[0101] In addition, the present invention does not need to rely on a database, and the judgment logic and data structure can be customized according to specific application requirements, thereby having higher flexibility, not generating a large amount of temporary data, greatly improving verification performance, and being able to avoid the Cartesian product problem during verification.

[0102] The specific implementation modes described above are preferred implementation modes of the present invention, and are not intended to limit the specific implementation scope of the present invention. The scope of the present invention includes but is not limited to the specific implementation modes, and all equivalent changes made according to the present invention are within the protection scope of the present invention.

Claims

1. A method for quickly verifying large-scale points in an area, characterized in that: The steps include: S1: Import file: import a point trace file including a set area, wherein the point trace data in the point trace file includes longitude information lng and latitude information lat; S2: Initialize the region: call the Geotool tool to perform graphic processing, load the set region file into the memory, and process the large area according to the region division principle to obtain a relatively small region set M0, which contains all region units, and each point in the region set M0 falls into only one of the region units; S3: read all the trace data in the trace file; S4: Multi-threaded batch verification: Create multi-threaded tasks and process the trace data in batches until the data processing is completed; S5: Count and verify the data, end.

2. The method for quickly checking large-scale points in an area according to claim 1, characterized in that: In step S2, the processing method for region division is: S201: Divide the set area into polygons and calculate the area of ​​the polygons; S202: Determine whether the polygon area is greater than a threshold, and if so, further segment the polygon; S203: Get the coordinate midpoint p0(x,y) of the polygon, p0(x,y)=(maxX-minX,maxY-minY), where x and y are the X coordinate value and Y coordinate value respectively, maxX is the maximum X coordinate value in the polygon, minX is the minimum X coordinate value, maxY is the maximum Y coordinate value in the polygon, and minY is the minimum Y coordinate value; S204: According to the coordinate midpoint p0, the polygon is divided into four rectangles [minX, minY, p0x, p0y], [minX, maxY, p0x, p0y], [maxX, maxY, p0x, p0y], [maxX, minY, p0x, p0y], and then the intersection parts with the polygon are obtained respectively: Geometry.Intersection(geometry); S205: After obtaining the segmented polygon, recursively execute steps S202-204 on the segmented polygon in sequence until the minimum area unit is obtained; S206: Assembling area unit objects: setting the grid size, creating an area set M0 of a two-dimensional set object, and setting the segmented minimum polygon into the area set M0 according to the x and y intervals and the grid size.

3. The method for quickly checking large-scale points in an area according to claim 2, characterized in that: In step S4, in the multi-thread batch verification, the specific processing method for each thread is: S401: Create Geo object: read each point data, and construct Geo point object Point(x,y) according to longitude information lng and latitude information lat; S402: Retrieve point trace area data: According to the position of x, y of the Point (x, y) object in M0, obtain the list of areas to be inspected L1; S403: Verify point traces: loop through each area in the list of areas to be checked L1, and determine whether the area contains point trace data. If found, end this loop and mark the current point trace data as within the area.

4. The method for quickly checking large-scale points in an area according to claim 3, characterized in that: Each thread uses the contains method of the GeoTool tool for verification.

5. The method for quickly checking large-scale points in an area according to claim 1, characterized in that: In step S4, the multithreading is executed on multiple computing nodes respectively, and the point trace data is dispersed to multiple computing nodes for verification using a distributed computing system, and a cache middleware is set up for storing and reading the regional information of multiple computing nodes.

6. The method for quickly checking large-scale points in an area according to claim 5, characterized in that: It also includes the evaluation steps for each technical node: obtaining the load conditions of each computing node, automatically dynamically expanding or shrinking the service according to the load conditions, and then dynamically allocating and adjusting the number of point trace data verified by each computing node.

7. A system for quickly checking large-scale points in an area, used to implement the method for quickly checking large-scale points in an area as claimed in any one of claims 1 to 6, characterized in that: include: Import file module: used to import a point trace file including a set area, where the point trace data in the point trace file includes longitude information lng and latitude information lat; Initialize region module: used to call Geotool for graphics processing, load the set region file into memory, and process the large area according to the region division principle to obtain a relatively small region set, which contains all region units, and each point in the region set falls into only one of the region units; Reading module: used to read all the point trace data in the point trace file; Multi-threaded batch verification module: used to create multi-threaded tasks and process point trace data in batches until the data processing is completed; Statistics module: used for statistical verification data.

8. The system according to claim 7, characterized in that: The initialization area module is provided with an area division submodule, and the processing method of the area division submodule is: S201: Divide the set area into polygons and calculate the area of ​​the polygons; S202: Determine whether the polygon area is greater than a threshold, and if so, further segment the polygon; S203: Get the coordinate midpoint p0(x,y) of the polygon, p0(x,y)=(maxX-minX,maxY-minY), where x and y are the X coordinate value and Y coordinate value respectively, maxX is the maximum X coordinate value in the polygon, minX is the minimum X coordinate value, maxY is the maximum Y coordinate value in the polygon, and minY is the minimum Y coordinate value; S204: According to the coordinate midpoint p0, the polygon is divided into four rectangles [minX, minY, p0x, p0y], [minX, maxY, p0x, p0y], [maxX, maxY, p0x, p0y], [maxX, minY, p0x, p0y], and then the intersection parts with the polygon are obtained respectively: Geometry.Intersection(geometry); S205: After obtaining the segmented polygon, recursively execute steps S202-204 on the segmented polygon in sequence until the minimum area unit is obtained; S206: Assembling area unit objects: setting the grid size, creating an area set M0 of a two-dimensional set object, and setting the segmented minimum polygon into the area set M0 according to the x and y intervals and the grid size.

9. The system according to claim 8, characterized in that: The multi-threaded batch verification module includes: Multithreaded creation submodule: used to create multithreaded; Geo object creation submodule: used to read each point data and construct Geo point object Point(x,y) according to longitude information lng and latitude information lat; Retrieve point trace area data submodule: used to obtain the list of areas to be inspected L1 according to the x, y positions of the Point (x, y) object in the ; Verification point trace submodule: loop through the traces of each area in the verification area list L1.