An electronic fence data processing method, an electronic fence system and an electronic device
By including the entry and exit times of electronic fences in the data and combining it with missing data filling, the problem of data anomalies in existing technologies has been solved, and the accuracy and timeliness of monitoring logistics vehicle entry and exit data have been improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI ZHONGTONGJI NETWORK TECH CO LTD
- Filing Date
- 2023-04-19
- Publication Date
- 2026-05-29
AI Technical Summary
The underlying structure of electronic fence data in existing technologies is unreasonable, which makes it easy for anomalies to occur when processing data entering and leaving the fence, and it cannot accurately reflect the actual arrival of vehicles.
The system uses a single entry/exit data entry record that includes both the entry and exit times. Combined with gap filling, it acquires the location information and GPS time of logistics vehicles in real time. The system then uses a leaderboard for sorting and scheduled tasks to update the data and correct any anomalies.
This effectively avoids data anomalies when matching entry and exit times within the fence, improves the accuracy of data on logistics vehicles entering and exiting the fence, and ensures the rationality of timeliness monitoring.
Smart Images

Figure CN116578846B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of logistics data processing technology, specifically relating to a method for processing electronic fence data, an electronic fence system, and an electronic device. Background Technology
[0002] In the express delivery industry, vehicle timeliness is crucial. To accurately track vehicle arrival and departure status, relying solely on vehicle scanning is insufficient. For example, a vehicle may have actually arrived at the designated area (doorway), but due to long queues, a significant amount of time may have passed by the time the vehicle is scanned. Including queuing time in driver performance evaluations is clearly unreasonable.
[0003] To achieve more effective time-sensitive management, the timing of entry and exit from electronic fences is crucial. Some third-party services currently offer functions for uploading basic fence data and providing early warnings for entry and exit. However, many of these basic data entries use each entry or exit moment as a single entry / exit record, which is prone to anomalies when processing such data. Therefore, existing technologies suffer from an unreasonable basic data structure, leading to potential anomalies during subsequent data processing. Summary of the Invention
[0004] To address this issue, the present invention provides a method for processing electronic fence data, an electronic fence system, and an electronic device, in order to solve the problem that the basic data structure in the prior art is unreasonable and that anomalies are prone to occur during subsequent data processing.
[0005] To achieve the above objectives, the present invention adopts the following technical solution:
[0006] In a first aspect, the present invention provides a method for processing electronic fence data, comprising:
[0007] After creating an electronic fence, fence data is generated and stored in a database;
[0008] The system acquires the location, GPS time, and identification information of logistics vehicles in real time. Based on the identification information, it determines whether a logistics vehicle exists in the leaderboard. If it does not exist, it adds the identification information of the logistics vehicle to the leaderboard and sorts it.
[0009] Based on the location information, GPS time, and fence data of the logistics vehicle, the entry and exit fence data of the logistics vehicle are obtained and stored in the database. Each entry and exit fence data includes the entry time and exit time.
[0010] The entry and exit data of the logistics vehicles are filled in according to the ranking in the leaderboard, and the leaderboard is updated according to the end time of the filling in the data.
[0011] Furthermore, the step of obtaining and storing the logistics vehicle's entry and exit data from the fence based on the vehicle's location information, GPS time, and the fence data includes:
[0012] Based on the latitude and longitude in the location information and the latitude and longitude range in the fence data, it is determined whether the logistics vehicle is inside the electronic fence. If it is inside the electronic fence, the identification information and GPS time of the logistics vehicle are stored in an entry / exit fence data entry. The GPS time is the entry time of the entry fence in the entry / exit fence data entry. At this time, the exit time in the entry / exit fence data entry is empty. This process continues until it is determined that the logistics vehicle is not inside the electronic fence, at which point the GPS time at this time is updated to the entry / exit fence data entry as the exit time.
[0013] Furthermore, the real-time acquisition of the location information, GPS time, and identification information of logistics vehicles, and the determination of whether the logistics vehicle exists in the leaderboard based on the identification information, if not, adding the identification information of the logistics vehicle to the leaderboard and sorting it, includes:
[0014] Real-time acquisition of logistics vehicle location information, GPS time, and identification information;
[0015] The system searches the leaderboard to see if the identification information of the logistics vehicle exists. If it does not exist, the GPS time is converted into a score for the logistics vehicle, the score is associated with and stored with the identification information, and then added to the leaderboard.
[0016] The leaderboard includes identification information and scores, and is sorted in descending order of scores; the closer the GPS time is to the current time, the higher the score.
[0017] Furthermore, the step of performing gap-filling processing on the entry and exit fence data of the logistics vehicles based on the ranking in the leaderboard, and updating the leaderboard according to the end time of the gap-filling processing, includes:
[0018] Set a scheduled task to retrieve a preset number of identifiers from the leaderboard at preset intervals.
[0019] Determine whether the entry / exit data corresponding to the identification information meets the preset conditions. If it does not meet the preset conditions, remove the identification information and the corresponding score from the leaderboard.
[0020] After performing the missing data filling process on the entry and exit data that meet the preset conditions, the data is updated to the database. The end time of each missing data filling process is converted into a score and updated to the leaderboard, thereby changing the ranking of each logistics vehicle in the leaderboard.
[0021] Further, determining whether the entry / exit data corresponding to the identification information meets preset conditions, and removing the identification information and the corresponding score from the leaderboard if they do not meet the preset conditions, includes:
[0022] The current GPS time of the logistics vehicle is obtained based on the identification information;
[0023] If the current GPS time cannot be obtained, it is determined that the preset conditions are not met, and the identification information and the corresponding score are removed from the leaderboard.
[0024] If the current GPS time can be obtained, the current GPS time is converted into a current score. If the current score is less than or equal to the corresponding score in the leaderboard, it is determined that the preset condition is not met, and the identification information and the corresponding score are removed from the leaderboard.
[0025] Furthermore, the process of updating the database after performing the missing data filling process on the entry and exit data that meet the preset conditions, and converting the end time of each missing data filling process into a score to update the leaderboard, thereby changing the ranking of each logistics vehicle in the leaderboard, includes:
[0026] Take one of the identification information that meets the preset conditions, obtain the corresponding score in the leaderboard based on the identification information, and convert the score into time as the leaderboard time of the logistics vehicle.
[0027] The start and end times are calculated based on the ranking time. The location information and GPS time of the logistics vehicle between the start and end times are obtained by combining the identification information as trajectory data. The trajectory data consists of trajectory points, and the trajectory points include the location information, GPS time and identification information.
[0028] The electronic fence is filtered based on the trajectory data to obtain a set of valid electronic fences;
[0029] The most recent time is obtained based on the set of valid electronic fences and the entry / exit data of the fences;
[0030] Based on the most recent time, traverse the trajectory points in the trajectory data and update the entry and exit fence data;
[0031] The end time is converted into a score, and the score is updated in the leaderboard according to the identification information. This completes the missing information filling process.
[0032] Take one more identifier from the identifier information that meets the preset conditions, and continue the above missing information filling process until all the identifier information that meets the preset conditions has been taken out, then the current timed task stops.
[0033] Further, the calculation of the start time and end time based on the leaderboard time includes:
[0034] If the time in the leaderboard is more than a first preset time away from the current time, then the current time is shifted forward by the first preset time as the start time; if the time in the leaderboard is less than a first preset time away from the current time, then the time in the leaderboard is directly used as the start time.
[0035] If the difference between the start time and the current time exceeds the second preset duration, the start time plus the second preset duration is used as the end time. If the difference between the start time and the current time does not exceed the second preset duration, the latest GPS time of the logistics vehicle is directly obtained as the end time.
[0036] Further, the step of filtering the electronic fence based on the trajectory data to obtain a set of effective electronic fences includes:
[0037] Traverse all location information in the trajectory data, record the maximum longitude, maximum latitude, minimum longitude, and minimum latitude, thereby obtaining the effective area of the trajectory data;
[0038] Traverse all the fence data, and determine whether the electronic fence is within the effective area based on the longitude and latitude of the center of the electronic fence in the fence data. If the electronic fence is within the effective area, store the electronic fence in the set of effective electronic fences.
[0039] Further, obtaining the most recent time based on the set of valid electronic fences and the entry / exit data includes:
[0040] Based on the entry and exit data of the electronic fences involved in the set of valid electronic fences, obtain the entry and exit data of the electronic fences that have an entry time between the first preset time and the second preset time before the start time, and sort them in ascending order of entry time. Obtain the last entry and exit data in the sorted data. If the exit time in the entry and exit data is not empty, set the exit time as the most recent time; otherwise, set the entry time as the most recent time.
[0041] Further, the step of traversing the trajectory points in the trajectory data according to the most recent time and updating the fence entry / exit data includes:
[0042] Iterate through the GPS time of each trajectory point in the trajectory data. If the GPS time is later than the most recent time, record the trajectory point in the trajectory point set.
[0043] Iterate through the entry and exit data of each trajectory point in the set of trajectory points, extract the entry and exit data that only have the entry time and no exit time, and obtain the fence data of the electronic fence according to the fence code in the entry and exit data; obtain the location information and GPS time of the logistics vehicle corresponding to the identification information in the trajectory point, and determine whether it is still within the electronic fence. If it is, do not process this entry and exit data and continue to process the next one; if it is not within the electronic fence, assign the exit time of the entry and exit data to the GPS time.
[0044] Furthermore, the method also includes:
[0045] Traverse the electronic fences outside the set of valid electronic fences, and determine whether the trajectory point is inside the electronic fence based on its location information. If not, skip the electronic fence and continue to determine whether it is inside the next electronic fence.
[0046] If the area is within the electronic fence, then a fence entry / exit data is matched according to the fence code in the fence data. If the match is successful, the fence exit time of the fence entry / exit data is set to empty; otherwise, the fence entry time of the fence entry / exit data is set to the GPS time of the trajectory point, and the fence exit time is set to empty.
[0047] Furthermore, the method also includes:
[0048] Select a logistics vehicle and select a supplementary time period to obtain the trajectory data of the logistics vehicle within the supplementary time period.
[0049] Based on the trajectory data, query whether the entry and exit fence data exists in the supplementary time period; if it exists, delete the entry and exit fence data.
[0050] Traverse all trajectory points in the trajectory data, and determine, based on the GPS time of the trajectory point, whether the latitude and longitude in the location information of the trajectory point are within the latitude and longitude range of any of the fence data;
[0051] If two adjacent trajectory points move from outside the latitude and longitude range to within the latitude and longitude range, then an entry / exit fence data is created, and the GPS time of the trajectory points within the latitude and longitude range is set as the entry fence time of the entry / exit fence data.
[0052] If two adjacent trajectory points move from within the latitude and longitude range to outside the latitude and longitude range, then the GPS time of the trajectory point outside the latitude and longitude range is set as the exit time of the fence data.
[0053] After traversing all trajectory points in the trajectory data, the entry and exit data of the fence within the supplementary time period are obtained.
[0054] Furthermore, the process of generating fence data and storing it in a database after creating the electronic fence includes:
[0055] Set the center point of the fence, and draw an electronic fence around the center point. The electronic fence can be circular, and the radius needs to be set. Alternatively, the electronic fence can be polygonal, and each vertex of the electronic fence needs to be specified. For the electronic fence that is polygonal, the fence data is stored in a parent-child table association form to support the storage of any number of vertices.
[0056] In a second aspect, the present invention provides an electronic fence system, comprising:
[0057] The fence maintenance module is used to generate fence data and store it in the database after creating an electronic fence;
[0058] The leaderboard module is used to obtain the location information, GPS time and identification information of logistics vehicles in real time. It determines whether a logistics vehicle exists in the leaderboard based on the identification information. If it does not exist, it adds the identification information of the logistics vehicle to the leaderboard and sorts it.
[0059] The data creation module is used to obtain the entry and exit data of logistics vehicles based on the location information, GPS time, and fence data, and store it in the database. Each entry and exit data includes the entry time and exit time.
[0060] The data filling module performs missing data filling on the entry and exit fence data of the logistics vehicles according to the ranking in the leaderboard, and updates the leaderboard according to the end time of the missing data filling process.
[0061] Furthermore, the system also includes:
[0062] The data supplementation module is used to select logistics vehicles and select a supplementation time period, obtain the trajectory data of the logistics vehicles within the supplementation time period, traverse all trajectory points in the trajectory data, and update the entry and exit fence data within the supplementation time period.
[0063] Thirdly, the present invention provides an electronic device, comprising:
[0064] At least one processor; and
[0065] A memory communicatively connected to the at least one processor; wherein,
[0066] The memory stores instructions that can be executed by the at least one processor, which, when executed, enable the at least one processor to perform the above-described method for processing electronic fence data.
[0067] The present invention, by adopting the above technical solution, has at least the following beneficial effects:
[0068] In this invention, the basic data used is a single entry / exit fence data that includes both the entry and exit times. Compared to the prior art, which uses each entry or exit time as a separate entry / exit fence data, this effectively avoids data anomalies that occur when matching entry and exit times. Furthermore, by combining missing data filling processing, the entry / exit fence data generated by logistics vehicles is further improved, making the data more accurate and effectively preventing anomalies when processing the entry / exit fence data of logistics vehicles.
[0069] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0070] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art 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.
[0071] Figure 1 This is a flowchart illustrating an exemplary embodiment of the present invention of a method for processing electronic fence data;
[0072] Figure 2 This is a schematic block diagram illustrating an electronic fence system according to an exemplary embodiment of the present invention;
[0073] Figure 3 This is a schematic diagram of an electronic device shown in an exemplary embodiment of the present invention;
[0074] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. Detailed Implementation
[0075] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be described in detail below. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other implementation methods obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0076] Some third-party electronic fence services provide functions for uploading basic fence data and providing early warning services for entering and leaving the fence. The basic data often uses each entry or exit time as a single entry or exit data point, which can easily lead to anomalies when matching entry and exit times.
[0077] In this embodiment of the invention, the basic data used is a single entry / exit fence data that includes both the entry and exit fence times. This effectively avoids data anomalies that occur when the entry and exit fence times are matched. Furthermore, the entry / exit fence data is further improved by combining missing data filling processing, making the entry / exit fence data generated by the corresponding logistics vehicles more accurate and effectively avoiding anomalies when processing the entry / exit fence data of logistics vehicles.
[0078] The method for real-time message push in this invention will be described below through specific embodiments.
[0079] Please see Figure 1 , Figure 1 This is a flowchart illustrating an exemplary embodiment of the present invention for processing electronic fence data. See also: Figure 1 The method includes:
[0080] Step S11: After creating the electronic fence, generate fence data and store it in the database;
[0081] Step S12: Obtain the location information, GPS time and identification information of logistics vehicles in real time. Determine whether the logistics vehicle exists in the leaderboard based on the identification information. If it does not exist, add the identification information of the logistics vehicle to the leaderboard and sort it.
[0082] Step S13: Based on the location information, GPS time, and fence data of the logistics vehicle, obtain the entry and exit fence data of the logistics vehicle and store it in the database. Each entry and exit fence data includes the entry time and exit time.
[0083] Step S14: Perform gap filling processing on the entry and exit fence data of logistics vehicles according to the ranking in the leaderboard, and update the leaderboard according to the end time of the gap filling processing.
[0084] It should be noted that the technical solution provided in this embodiment can be used in existing projects as a mini-program or a plugin, or as a standalone application providing functional interfaces, or loaded into electronic devices for information interaction with project servers. Applicable scenarios include, but are not limited to: logistics vehicle timeliness monitoring, engineering vehicle timeliness monitoring, food delivery timeliness monitoring, and other situations requiring timeliness monitoring.
[0085] It is understood that the basic data in the technical solution provided in this embodiment uses a single entry / exit fence data that includes both the entry and exit fence times. Compared to the prior art, which uses each entry or exit fence time as a single entry / exit fence data, this effectively avoids data anomalies caused when matching entry and exit fence times. Furthermore, by combining missing data filling processing, the entry / exit fence data generated for the corresponding logistics vehicles is further improved, making the entry / exit fence data more accurate and effectively avoiding anomalies when processing the entry / exit fence data of logistics vehicles.
[0086] In practice, step S11, "after creating the electronic fence, generating fence data and storing it in the database," specifically refers to:
[0087] Set the center point of the fence, and draw an electronic fence around the center point. If the electronic fence is circular, the radius needs to be set. Alternatively, if the electronic fence is polygonal, each vertex of the electronic fence needs to be specified. For electronic fences that are polygonal, the fence data is stored in a parent-child table relationship to support the storage of any number of vertices.
[0088] It should be noted that when creating an electronic fence, a fence drawing page will appear. The default selection is a circular fence. You will need to enter the radius and other parameters. After submission, a circular electronic fence style will be automatically generated on the map in the drawing page. If you want to set a polygonal fence, you need to select the corresponding option, manually set several points around the center point of the fence on the map in the drawing page, enter other parameters, and submit to automatically generate a polygonal electronic fence style. The other parameters include: the fence point name, the electronic fence name, the actual address of the electronic fence location, the automatic check-in distance, and the manual check-in distance. After the electronic fence is successfully created, the fence data is generated and saved to the database. The fence data includes the latitude and longitude of the fence center point, basic parameters, and the automatically generated latitude and longitude range.
[0089] It is understood that in the technical solution provided in this embodiment, when creating an electronic fence, either a circular electronic fence or a polygonal electronic fence can be selected. Since the backend storage adopts a parent-child table association, the number of points in a polygonal electronic fence can be set arbitrarily. When a polygonal electronic fence is required in a special scenario, the polygon can be flexibly set to meet the requirements.
[0090] In practice, step S12, "real-time acquisition of the location information, GPS time, and identification information of logistics vehicles; determination of whether a logistics vehicle exists in the leaderboard based on the identification information; if not, addition of the logistics vehicle's identification information to the leaderboard and sorting," includes:
[0091] Real-time acquisition of logistics vehicle location information, GPS time, and identification information;
[0092] Check if the identification information of the logistics vehicle exists in the leaderboard. If it does not exist, convert the GPS time into a score for the logistics vehicle, associate the score with the identification information, store it, and add it to the leaderboard.
[0093] The leaderboard includes identification information and scores, and is sorted in descending order of scores; the closer the GPS time is to the current time, the higher the score.
[0094] It should be noted that the leaderboard is implemented using the zset function in the existing Redis caching service. This leaderboard stores the identification information and scores of logistics vehicles. The leaderboard is used to filter out vehicles that have not been updated in their entry and exit from the fence for a long time. In other words, logistics vehicles that have been stationary for a long time will be filtered out. The location information, GPS time and identification information of logistics vehicles are obtained in real time. The leaderboard is then checked to see if the identification information of the logistics vehicle can be found. If the identification information of the logistics vehicle cannot be found, it means that the logistics vehicle is not monitored by the leaderboard. Therefore, the identification information and the score converted from the GPS time are added to the leaderboard, that is, the logistics vehicle is added to the leaderboard for screening.
[0095] Furthermore, the location information includes the license plate number of the logistics vehicle.
[0096] It is understandable that in the technical solution provided in this embodiment, the ranking of logistics vehicles is used to sort them. The lower the score, the longer the data on entering and exiting the fence has not been updated. This data needs to be retrieved for missing data filling, which plays a role in monitoring the abnormal status of logistics vehicles.
[0097] In practice, step S13, "based on the location information, GPS time, and fence data of the logistics vehicle, obtains the entry and exit fence data of the logistics vehicle and stores it in the database, wherein each entry and exit fence data entry contains the entry time and exit time," includes:
[0098] Based on the latitude and longitude in the location information and the latitude and longitude range in the fence data, it is determined whether the logistics vehicle is inside the electronic fence. If it is inside the electronic fence, the identification information and GPS time of the logistics vehicle are stored in an entry-exit fence data entry. The GPS time is the entry time of the entry fence data, and the exit time of the entry-exit fence data is empty at this time. This process continues until it is determined that the logistics vehicle is not inside the electronic fence, at which point the GPS time at this time is updated to the entry-exit fence data as the exit time.
[0099] It should be noted that the time of entering and exiting the fence are key information in the fence entry and exit data, which also includes the fence data of the relevant electronic fence.
[0100] It is understood that in the technical solution provided in this embodiment, when processing the entry and exit fence data, since each entry and exit fence data contains logistics vehicle information, entry time, exit time and fence data, it can effectively avoid anomalies caused by matching entry and exit fence times.
[0101] In practice, step S14, "to perform gap-filling processing on the entry and exit fence data of logistics vehicles according to the ranking in the leaderboard, and to update the leaderboard according to the end time of the gap-filling processing," includes:
[0102] Set up a scheduled task to retrieve a preset number of identifiers from the leaderboard at preset intervals.
[0103] Determine whether the entry and exit data corresponding to the identification information meet the preset conditions. If they do not meet the preset conditions, remove the identification information and the corresponding score from the leaderboard.
[0104] After filling in the missing data of vehicles entering and leaving the fence that meet the preset conditions, the data is updated to the database. The end time of each missing data filling process is converted into a score and updated to the leaderboard, thereby changing the ranking of each logistics vehicle in the leaderboard.
[0105] It should be noted that the preset duration and preset quantity are set based on the amount of data to be calculated, and their purpose is to ensure that the amount of data to be calculated each time does not exceed the server load.
[0106] Specifically, "determining whether the entry / exit data corresponding to the identification information meets preset conditions, and removing the identification information and the corresponding score from the leaderboard if they do not meet preset conditions" includes:
[0107] Obtain the current GPS time of the logistics vehicle based on the identification information;
[0108] If the current GPS time cannot be obtained, it is determined that the preset conditions are not met, and the identification information and corresponding score are removed from the leaderboard;
[0109] If the current GPS time can be obtained, it is converted into the current score. If the current score is less than or equal to the corresponding score in the leaderboard, it is determined that the preset conditions are not met, and the identification information and the corresponding score are removed from the leaderboard.
[0110] It should be noted that if the GPS time of a logistics vehicle cannot be obtained, it can be understood that the logistics vehicle has been taken out of service. Logistics vehicles that have been taken out of service do not need to update their entry and exit fence data, so the location information and score of the logistics vehicle are removed from the leaderboard. If the current score is less than or equal to the score in the leaderboard, it can be understood that the time converted from the score in the leaderboard is more recent than the current GPS time of the logistics vehicle, indicating that the logistics vehicle has previously updated its entry and exit fence data.
[0111] Specifically, "the step of updating the database after performing the missing data filling process on the entry and exit data that meet the preset conditions, and converting the end time of each missing data filling process into a score and updating it in the leaderboard, thereby changing the ranking of each logistics vehicle in the leaderboard" includes:
[0112] Take one of the identification information that meets the preset conditions, obtain the corresponding score in the leaderboard based on the identification information, and convert the score into time as the leaderboard time of the logistics vehicle.
[0113] The start and end times are calculated based on the ranking time. The location information and GPS time of the logistics vehicle between the start and end times are obtained by combining the identification information as trajectory data. The trajectory data consists of trajectory points, which include location information, GPS time and identification information.
[0114] The electronic fences are filtered based on the trajectory data to obtain a set of effective electronic fences;
[0115] The most recent time is obtained based on the valid set of electronic fences and the data on entering and exiting the fences;
[0116] Based on the most recent time, iterate through the trajectory points in the trajectory data and update the entry and exit fence data;
[0117] The end time is converted into a score and updated in the leaderboard according to the identification information. This completes the missing information filling process.
[0118] Take one more identifier from the preset conditions and continue the above missing information filling process until all the identifiers that meet the preset conditions have been taken out, then the current timed task stops.
[0119] Furthermore, the start and end times are calculated based on the leaderboard time. If the leaderboard time is more than a first preset time away from the current time, the current time is shifted forward by the first preset time to be used as the start time. If the leaderboard time is less than the first preset time away from the current time, the leaderboard time is directly used as the start time.
[0120] If the difference between the start time and the current time exceeds the second preset duration, the start time plus the second preset duration will be used as the end time. If the difference between the start time and the current time does not exceed the second preset duration, the latest GPS time of the logistics vehicle will be directly obtained as the end time.
[0121] It should be noted that both the first and second preset durations are set based on the historical data volume of entering and exiting the fence, so that the total amount of calculations in this instance remains within the computational load range; and the first preset duration is longer than the second preset duration.
[0122] Furthermore, the electronic fences are filtered based on the trajectory data to obtain a set of effective electronic fences, including:
[0123] Traverse all location information in the trajectory data, record the maximum longitude, maximum latitude, minimum longitude, and minimum latitude, thereby obtaining the effective area of the trajectory data;
[0124] Iterate through all fence data, and determine whether the electronic fence is within the valid area based on the longitude and latitude of the electronic fence center in the fence data. If the electronic fence is within the valid area, store the electronic fence in the valid electronic fence set.
[0125] It should be noted that the valid electronic fences refer to the electronic fences that may be involved in this calculation. When this calculation ends, the data in the set of valid electronic fences will be cleared in order to prepare for the next calculation. This calculation refers to updating the entry and exit fence data of a preset number of logistics vehicles ranked lower in the leaderboard.
[0126] Furthermore, the most recent time is obtained based on the effective set of electronic fences and the data on entering and exiting the fences, including:
[0127] Based on the entry and exit data of the electronic fence involved in the valid electronic fence set, obtain the entry and exit data of the electronic fence that have an entry time between the first preset time and the second preset time before the start time, and sort them in ascending order of entry time. Obtain the last entry and exit data in the sorted data. If the exit time in the entry and exit data is not empty, set the exit time as the most recent time; otherwise, set the entry time as the most recent time.
[0128] It should be noted that if there is a record of entering or exiting the fence in the database, it means that this record must have an entry time, but the exit time may not be available. The most recent time is used to determine whether the trajectory point needs to participate in this calculation. If the GPS time of the trajectory point is before the most recent time, the trajectory point does not need to participate in the judgment. Only the GPS time of the trajectory point after the most recent time will participate in the calculation. The first preset time and the second preset time are set according to specific business needs.
[0129] Furthermore, the trajectory points in the trajectory data are traversed based on the most recent entry and exit times, and the entry and exit fence data is updated, including:
[0130] Iterate through the GPS time of each trajectory point in the trajectory data. If the GPS time is later than the most recent time, record the trajectory point in the trajectory point set.
[0131] Iterate through the entry and exit data of each trajectory point in the trajectory point set, extract the entry and exit data that only have the entry time but not the exit time, and obtain the fence data of the electronic fence according to the fence code in the entry and exit data; obtain the location information and GPS time of the logistics vehicle corresponding to the identification information in the trajectory point, and determine whether it is still within the electronic fence. If it is, do not process this entry and exit data and continue to process the next one; if it is not within the electronic fence, assign the exit time of this entry and exit data to the GPS time.
[0132] It is understandable that in this embodiment, the missing data of the entry and exit fences is found through the missing data filling operation, and the missing data in the entry and exit fence data is filled in according to reasonable logical judgment.
[0133] In practice, the method further includes: traversing the electronic fences outside the set of valid electronic fences, determining whether the trajectory point is inside the electronic fence based on its location information, and skipping the electronic fence if it is not inside, and continuing to determine whether it is inside the next electronic fence.
[0134] If the area is within the electronic fence, then match an entry / exit fence data entry with the fence code in the fence data. If the match is successful, set the exit fence time of the entry / exit fence data to empty; otherwise, set the entry fence time of the entry / exit fence data to the GPS time of the trajectory point, and set the exit fence time to empty.
[0135] It should be noted that when electronic fences are densely overlapping, some trajectory points may have abnormal entry and exit data within the valid electronic fences. In this case, it is necessary to calculate the entry and exit data of the trajectory points from electronic fences outside the set of valid electronic fences. If a match is successful, the exit time of the entry and exit data is set to empty to correct the data. The entry time of the entry and exit data is set to the GPS time of the trajectory point, and the exit time is set to empty, which means adding a new entry data point because no entry and exit data was found.
[0136] It is understood that the technical solution provided in this embodiment can more effectively handle abnormal situations when updating trajectory point entry and exit fence data.
[0137] In practice, the method further includes: selecting a logistics vehicle and selecting a supplementary time period, and obtaining the trajectory data of the logistics vehicle within the supplementary time period;
[0138] Based on the trajectory data, query whether there is entry and exit data for the fence within the supplementary time period; if it exists, delete the entry and exit data for the fence.
[0139] Traverse all trajectory points in the trajectory data, and based on the GPS time of the trajectory points, determine whether the latitude and longitude of the location information of the trajectory points are within the latitude and longitude range of any fence data;
[0140] If two adjacent trajectory points move from outside the latitude and longitude range to within the latitude and longitude range, then create an entry / exit fence data entry, and set the GPS time of the trajectory points within the latitude and longitude range to the entry / exit fence data entry time.
[0141] If two adjacent trajectory points move from within the latitude and longitude range to outside the latitude and longitude range, the GPS time of the trajectory point outside the latitude and longitude range is set to the exit time of the fence data.
[0142] Once all trajectory points in the trajectory data have been traversed, the entry and exit data of the fence within the subsequent time period are obtained.
[0143] It is understood that this embodiment provides a data supplementation function. When checking historical data, if abnormal entry and exit fence data is found, the abnormal entry and exit fence data can be effectively updated based on the selected supplementation time period, logistics vehicle trajectory data and fence data.
[0144] Please see Figure 2 , Figure 2 This is a schematic block diagram illustrating an electronic fence system according to an exemplary embodiment of the present invention. See also: Figure 2 The electronic fence system 100 includes:
[0145] The fence maintenance module 101 is used to generate fence data and store it in the database after creating an electronic fence;
[0146] The leaderboard module 102 is used to obtain the location information, GPS time and identification information of logistics vehicles in real time. It determines whether the logistics vehicle exists in the leaderboard based on the identification information. If it does not exist, it adds the identification information of the logistics vehicle to the leaderboard and sorts it.
[0147] The data creation module 103 is used to obtain the entry and exit fence data of the logistics vehicle based on the location information, GPS time, and fence data of the logistics vehicle and store it in the database. Each entry and exit fence data includes the entry time and exit time.
[0148] The data filling module 104 performs missing data filling processing on the entry and exit fence data of the logistics vehicles according to the ranking in the ranking list, and updates the ranking list according to the end time of the missing data filling processing.
[0149] The data supplementation module 105 is used to select a logistics vehicle and a supplementation time period, obtain the trajectory data of the logistics vehicle within the supplementation time period, traverse all trajectory points in the trajectory data, and update the entry and exit fence data within the supplementation time period.
[0150] It should be noted that the system provided in this embodiment can be used in existing projects as a mini-program or a plugin, or it can provide functional interfaces as a standalone application, or it can be loaded into electronic devices to interact with project servers. Applicable scenarios include, but are not limited to: logistics vehicle timeliness monitoring, engineering vehicle timeliness monitoring, food delivery timeliness monitoring, and other situations requiring timeliness monitoring.
[0151] It is understood that the basic data in the system provided in this embodiment uses a single entry / exit fence data that includes both the entry and exit fence times. Compared to the prior art, which uses each entry or exit fence time as a single entry / exit fence data, this effectively avoids data anomalies that occur when matching entry and exit fence times. Furthermore, by combining missing data filling processing, the entry / exit fence data generated for the corresponding logistics vehicles is further improved, making the entry / exit fence data more accurate and effectively avoiding anomalies when processing the entry / exit fence data of logistics vehicles.
[0152] Please see Figure 3 , Figure 3 This is a schematic diagram of an electronic device illustrating an exemplary embodiment of the present invention. See also: Figure 3 An electronic device is provided, comprising:
[0153] At least one processor; and
[0154] A memory communicatively connected to the at least one processor; wherein,
[0155] The memory stores instructions that can be executed by the at least one processor, which, when executed, enable the at least one processor to perform the above-described method for processing electronic fence data.
[0156] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0157] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for processing electronic fence data, characterized in that, include: After creating an electronic fence, fence data is generated and stored in a database; The system acquires the location, GPS time, and identification information of logistics vehicles in real time. Based on the identification information, it determines whether a logistics vehicle exists in the leaderboard. If not, it adds the vehicle's identification information to the leaderboard and sorts it. This includes: acquiring the location, GPS time, and identification information of logistics vehicles in real time; searching the leaderboard for the vehicle's identification information; if not, converting the GPS time into a score for the logistics vehicle, associating the score with the identification information, storing it, and adding it to the leaderboard; wherein the leaderboard contains identification information and a score, and is sorted in descending order of score; the closer the GPS time is to the current time, the higher the score. Based on the location information, GPS time, and fence data of the logistics vehicle, the entry and exit fence data of the logistics vehicle are obtained and stored in the database. Each entry and exit fence data includes the entry time and exit time. The system performs a gap-filling process on the entry and exit fence data of the logistics vehicles based on their ranking in the leaderboard, and updates the leaderboard based on the end time of the gap-filling process. This includes setting a timed task to retrieve a preset number of identifiers from the leaderboard at preset intervals. Determine whether the entry / exit data corresponding to the identification information meets the preset conditions. If it does not meet the preset conditions, remove the identification information and the corresponding score from the leaderboard. After performing the missing data filling process on the entry and exit data that meet the preset conditions, the data is updated to the database. The end time of each missing data filling process is converted into a score and updated to the leaderboard, thereby changing the ranking of each logistics vehicle in the leaderboard.
2. The method according to claim 1, characterized in that, The step of obtaining and storing the logistics vehicle's entry and exit fence data in the database based on the logistics vehicle's location information, GPS time, and the fence data includes: Based on the latitude and longitude in the location information and the latitude and longitude range in the fence data, it is determined whether the logistics vehicle is inside the electronic fence. If it is inside the electronic fence, the identification information and GPS time of the logistics vehicle are stored in an entry / exit fence data entry. The GPS time is the entry time of the entry fence in the entry / exit fence data entry. At this time, the exit time in the entry / exit fence data entry is empty. This process continues until it is determined that the logistics vehicle is not inside the electronic fence, at which point the GPS time at this time is updated to the entry / exit fence data entry as the exit time.
3. The method according to claim 1, characterized in that, The step of determining whether the entry / exit data corresponding to the identification information meets preset conditions, and removing the identification information and the corresponding score from the leaderboard if they do not meet the preset conditions, includes: The current GPS time of the logistics vehicle is obtained based on the identification information; If the current GPS time cannot be obtained, it is determined that the preset conditions are not met, and the identification information and the corresponding score are removed from the leaderboard. If the current GPS time can be obtained, the current GPS time is converted into a current score. If the current score is less than or equal to the corresponding score in the leaderboard, it is determined that the preset condition is not met, and the identification information and the corresponding score are removed from the leaderboard.
4. The method according to claim 1, characterized in that, The process of updating the database after performing the missing data filling process on the entry and exit fence data that meet the preset conditions, and converting the end time of each missing data filling process into a score and updating it in the leaderboard, thereby changing the ranking of each logistics vehicle in the leaderboard, includes: Take one of the identification information that meets the preset conditions, obtain the corresponding score in the leaderboard based on the identification information, and convert the score into time as the leaderboard time of the logistics vehicle. The start and end times are calculated based on the ranking time. The location information and GPS time of the logistics vehicle between the start and end times are obtained by combining the identification information as trajectory data. The trajectory data consists of trajectory points, and the trajectory points include the location information, GPS time and identification information. The electronic fence is filtered based on the trajectory data to obtain a set of valid electronic fences; The most recent time is obtained based on the set of valid electronic fences and the entry / exit data of the fences; Based on the most recent time, traverse the trajectory points in the trajectory data and update the entry and exit fence data; The end time is converted into a score, and the score is updated in the leaderboard according to the identification information. This completes the missing information filling process. Take one more identifier from the identifier information that meets the preset conditions, and continue the above missing information filling process until all the identifier information that meets the preset conditions has been taken out, then the current timed task stops.
5. The method according to claim 4, characterized in that, The calculation of the start and end times based on the leaderboard time includes: If the time in the leaderboard is more than a first preset time away from the current time, then the current time is shifted forward by the first preset time as the start time; if the time in the leaderboard is less than a first preset time away from the current time, then the time in the leaderboard is directly used as the start time. If the difference between the start time and the current time exceeds the second preset duration, the start time plus the second preset duration is used as the end time. If the difference between the start time and the current time does not exceed the second preset duration, the latest GPS time of the logistics vehicle is directly obtained as the end time.
6. The method according to claim 4, characterized in that, The step of filtering the electronic fence based on the trajectory data to obtain a set of effective electronic fences includes: Traverse all location information in the trajectory data, record the maximum longitude, maximum latitude, minimum longitude, and minimum latitude, thereby obtaining the effective area of the trajectory data; Traverse all the fence data, and determine whether the electronic fence is within the effective area based on the longitude and latitude of the center of the electronic fence in the fence data. If the electronic fence is within the effective area, store the electronic fence in the set of effective electronic fences.
7. The method according to claim 4, characterized in that, The step of obtaining the most recent time based on the set of valid electronic fences and the entry / exit data includes: Based on the entry and exit data of the electronic fences involved in the set of valid electronic fences, obtain the entry and exit data of the electronic fences that have an entry time between the first preset time and the second preset time before the start time, and sort them in ascending order of entry time. Obtain the last entry and exit data in the sorted data. If the exit time in the entry and exit data is not empty, set the exit time as the most recent time; otherwise, set the entry time as the most recent time.
8. The method according to claim 4, characterized in that, The step of traversing the trajectory points in the trajectory data based on the most recent time and updating the fence entry / exit data includes: Iterate through the GPS time of each trajectory point in the trajectory data. If the GPS time is later than the most recent time, record the trajectory point in the trajectory point set. Traverse the entry and exit fence data of each trajectory point in the set of trajectory points, extract the entry and exit fence data that only have the entry time and no exit time, and obtain the fence data of the electronic fence according to the fence code in the entry and exit fence data. Obtain the location information and GPS time of the logistics vehicle corresponding to the identification information in the trajectory point, and determine whether it is still within the electronic fence. If it is, do not process this entry / exit data and continue to process the next one; if it is not within the electronic fence, assign the exit time of the entry / exit data to the GPS time.
9. The method according to claim 8, characterized in that, The method further includes: Traverse the electronic fences outside the set of valid electronic fences, and determine whether the trajectory point is inside the electronic fence based on its location information. If not, skip the electronic fence and continue to determine whether it is inside the next electronic fence. If the area is within the electronic fence, then a fence entry / exit data is matched according to the fence code in the fence data. If the match is successful, the fence exit time of the fence entry / exit data is set to empty; otherwise, the fence entry time of the fence entry / exit data is set to the GPS time of the trajectory point, and the fence exit time is set to empty.
10. The method according to claim 4, characterized in that, The method further includes: Select a logistics vehicle and select a supplementary time period to obtain the trajectory data of the logistics vehicle within the supplementary time period. Based on the trajectory data, query whether the entry and exit data of the fence exists in the supplementary time period. If it exists, delete the entry and exit data of the fence. Traverse all trajectory points in the trajectory data, and determine, based on the GPS time of the trajectory point, whether the latitude and longitude in the location information of the trajectory point are within the latitude and longitude range of any of the fence data; If two adjacent trajectory points move from outside the latitude and longitude range to within the latitude and longitude range, then an entry / exit fence data is created, and the GPS time of the trajectory points within the latitude and longitude range is set as the entry fence time of the entry / exit fence data. If two adjacent trajectory points move from within the latitude and longitude range to outside the latitude and longitude range, then the GPS time of the trajectory point outside the latitude and longitude range is set as the exit time of the fence data. After traversing all trajectory points in the trajectory data, the entry and exit data of the fence within the supplementary time period are obtained.
11. The method according to claim 1, characterized in that, The process of creating an electronic fence, generating fence data, and storing it in a database includes: Set the center point of the fence, and draw an electronic fence around the center point. The electronic fence can be circular, and the radius needs to be set. Alternatively, the electronic fence can be polygonal, and each vertex of the electronic fence needs to be specified. For the electronic fence that is polygonal, the fence data is stored in a parent-child table association form to support the storage of any number of vertices.
12. An electronic fence system, characterized in that, include: The fence maintenance module is used to generate fence data and store it in the database after creating an electronic fence; The leaderboard module is used to acquire the location information, GPS time, and identification information of logistics vehicles in real time. It determines whether a logistics vehicle exists in the leaderboard based on the identification information. If not, it adds the vehicle's identification information to the leaderboard and sorts the vehicles accordingly. Specifically, it acquires the location information, GPS time, and identification information of logistics vehicles in real time; searches the leaderboard for the vehicle's identification information; if not, it converts the GPS time into a score for the vehicle, associates the score with the identification information, stores it, and adds it to the leaderboard. The leaderboard includes identification information and a score, and is sorted in descending order of score. The closer the GPS time is to the current time, the higher the score. The data creation module is used to obtain the entry and exit data of logistics vehicles based on the location information, GPS time, and fence data, and store it in the database. Each entry and exit data includes the entry time and exit time. The data filling module performs gap-filling processing on the entry and exit fence data of the logistics vehicles according to their ranking in the leaderboard, and updates the leaderboard according to the end time of the gap-filling processing. Specifically, it is used to set a timed task to retrieve a preset number of identifiers from the leaderboard at preset intervals; determine whether the entry and exit fence data corresponding to the identifiers meet preset conditions; if they do not meet the preset conditions, remove the identifiers and their corresponding scores from the leaderboard; update the database after performing gap-filling processing on the entry and exit fence data that meet the preset conditions, and convert the end time of each gap-filling process into a score and update it in the leaderboard, thereby changing the ranking of each logistics vehicle in the leaderboard.
13. The system according to claim 12, characterized in that, The system also includes: The data supplementation module is used to select logistics vehicles and select a supplementation time period, obtain the trajectory data of the logistics vehicles within the supplementation time period, traverse all trajectory points in the trajectory data, and update the entry and exit fence data within the supplementation time period.
14. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-11.