Alarm method, device, computer and storage medium based on electronic fence
The boundary of the electronic fence is quickly determined through the GEO hash algorithm and the driving distance is calculated, which solves the problem of low computing efficiency in traditional methods and realizes efficient alarm processing.
Patent Information
- Application Number
- CN202211300888.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-24
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2042-10-24
AI Technical Summary
During the traditional electronic fence positioning detection and alarm process, it is necessary to traverse the coordinate points of the two electronic fences inside and outside, with large amount of calculation data, low processing efficiency, and occupies a lot of server resources.
The GEO hash algorithm is used to convert the target coordinates into a hash value, compare them with the fence hash value, determine the closest fence boundary, calculate the exit distance, and trigger an alarm if it exceeds the preset distance.
Improve computing efficiency, reduce server resource usage, and achieve rapid alarm processing.
Smart Images

Figure CN115691091B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic fences, and in particular to an electronic fence-based alarm method, device, computer and storage medium. Background Art
[0002] The emergence of shared electric vehicles has greatly facilitated people's travel. It not only solves the problem of the "last mile" of public transportation, but is also faster and more convenient than shared bicycles.
[0003] In order to reasonably manage shared electric vehicles, shared electric vehicles in different regions need to be used by region to avoid management confusion caused by cross-regional use of shared electric vehicles and disadvantages caused by long riding distances. Therefore, it is necessary to use electronic fences to limit the scope of use of shared electric vehicles.
[0004] In the traditional electric vehicle positioning detection and alarm process, two inner and outer electronic fences are used for positioning. When the electric vehicle moves to the outside of the inner electronic fence and is located inside the outer electronic fence, an alarm is triggered, and the power is cut off after the electric vehicle moves to the outside of the outer electronic fence. This positioning detection method requires traversing the coordinate points of the inner and outer electronic fences, which requires a large amount of data to be calculated, has a relatively low processing efficiency, and occupies more server resources. Summary of the invention
[0005] Based on this, it is necessary to provide an electronic fence-based alarm method, device, computer and storage medium to address the above technical problems.
[0006] An electronic fence-based alarm method, the method comprising:
[0007] Get the target coordinates of the current position of the target object;
[0008] Detecting whether the current position of the target object is outside the electronic fence;
[0009] When the current position of the target object is outside the electronic fence, converting the target coordinates into a target hash value based on a GEO hash algorithm;
[0010] Obtain fence hash values of each fence coordinate of the electronic fence;
[0011] Comparing the target hash value with each of the fence hash values, and determining two fence hash values closest to the target hash value as close hash values;
[0012] Determining a proximity boundary of the electronic fence based on the two proximity hash values;
[0013] Calculate the distance between the target coordinates and the approach boundary to obtain the exit distance;
[0014] Detecting whether the travel distance is greater than a preset distance;
[0015] When the travel distance is greater than the preset distance, an alarm is triggered.
[0016] In one embodiment, the step of detecting whether the current position of the target object is outside the electronic fence includes:
[0017] Using the target coordinates as the starting coordinates of the ray, a reference ray intersecting with the electronic fence is generated on the map;
[0018] Detecting whether the number of intersection points between the reference ray and the electronic fence is an even number;
[0019] When the number of intersection points between the reference ray and the electronic fence is an even number, it is determined that the current position of the target object is outside the electronic fence;
[0020] When the number of intersection points between the reference ray and the electronic fence is an odd number, it is determined that the current position of the target object is within the electronic fence.
[0021] In one embodiment, the step of using the target coordinates as the ray starting point coordinates to generate a reference ray on a map that intersects the electronic fence includes:
[0022] Taking the target coordinates as the ray starting point coordinates, a plurality of reference rays are generated in any direction on the map, wherein at least one of the reference rays intersects with the electronic fence.
[0023] In one embodiment, the step of comparing the target hash value with each fence hash value includes:
[0024] The target hash value is compared with each fence hash value through a sorting algorithm.
[0025] In one embodiment, the step of determining the proximity boundary of the electronic fence based on the two proximity hash values includes:
[0026] The fence coordinates corresponding to the two proximity hash values are used as line segment endpoints, and the proximity boundary of the electronic fence is determined by connecting the two line segment endpoints.
[0027] In one embodiment, the step of obtaining the target coordinates of the current position of the target object includes:
[0028] Obtaining the coordinates of each fence of the electronic fence;
[0029] Convert each of the fence coordinates into a fence hash value based on the GEO hash algorithm;
[0030] Sorting the fence hash values, and generating a hash value set based on the sorted fence hash values;
[0031] The step of comparing the target hash value with each fence hash value to determine two fence hash values closest to the target hash value as close hash values comprises:
[0032] The target hash value is compared with each fence hash value of the hash value set by a sorting algorithm, and two fence hash values closest to the target hash value are determined as close hash values.
[0033] In one embodiment, when the travel distance is greater than the preset distance, the step of triggering an alarm includes:
[0034] When the travel distance is greater than a first preset distance, sending a warning message to the target object;
[0035] When the travel distance is greater than a second preset distance, sending a power-off control instruction to the target object;
[0036] Wherein, the second preset distance is greater than the first preset distance.
[0037] An alarm device based on an electronic fence, comprising:
[0038] A target coordinate acquisition module is used to acquire the target coordinates of the current position of the target object;
[0039] A position detection module, used to detect whether the current position of the target object is outside the electronic fence;
[0040] A hash calculation module, used for converting the target coordinates into a target hash value based on a GEO hash algorithm when the current position of the target object is outside the electronic fence;
[0041] A fence hash value acquisition module, used to acquire the fence hash value of each fence coordinate of the electronic fence;
[0042] A close hash value determination module, configured to compare the target hash value with each fence hash value, and determine two fence hash values closest to the target hash value as close hash values;
[0043] A proximity boundary determination module, configured to determine a proximity boundary of the electronic fence based on the two proximity hash values;
[0044] An exit distance calculation module is used to calculate the distance between the target coordinates and the approach boundary to obtain an exit distance;
[0045] A distance detection module, used to detect whether the driving distance is greater than a preset distance;
[0046] The alarm triggering module is used to trigger an alarm when the travel distance is greater than the preset distance.
[0047] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the following method are implemented:
[0048] Get the target coordinates of the current position of the target object;
[0049] Detecting whether the current position of the target object is outside the electronic fence;
[0050] When the current position of the target object is outside the electronic fence, converting the target coordinates into a target hash value based on a GEO hash algorithm;
[0051] Obtain fence hash values of each fence coordinate of the electronic fence;
[0052] Comparing the target hash value with each of the fence hash values, and determining two fence hash values closest to the target hash value as close hash values;
[0053] Determining a proximity boundary of the electronic fence based on the two proximity hash values;
[0054] Calculate the distance between the target coordinates and the approach boundary to obtain the exit distance;
[0055] Detecting whether the travel distance is greater than a preset distance;
[0056] When the travel distance is greater than the preset distance, an alarm is triggered.
[0057] A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the following method are implemented:
[0058] Get the target coordinates of the current position of the target object;
[0059] Detecting whether the current position of the target object is outside the electronic fence;
[0060] When the current position of the target object is outside the electronic fence, converting the target coordinates into a target hash value based on a GEO hash algorithm;
[0061] Obtain fence hash values of each fence coordinate of the electronic fence;
[0062] Comparing the target hash value with each of the fence hash values, and determining two fence hash values closest to the target hash value as close hash values;
[0063] Determining a proximity boundary of the electronic fence based on the two proximity hash values;
[0064] Calculate the distance between the target coordinates and the approach boundary to obtain the exit distance;
[0065] Detecting whether the travel distance is greater than a preset distance;
[0066] When the travel distance is greater than the preset distance, an alarm is triggered.
[0067] The above-mentioned electronic fence-based alarm method, device, computer and storage medium can quickly determine the two fence coordinates closest to the target coordinates by converting the target coordinates into target hash values and comparing the target hash values with the fence hash values, thereby determining the boundary of a section of the electronic fence closest to the target coordinates, thereby quickly calculating the exit distance of the target object and then issuing an alarm. Compared with the traditional calculation method of the inner and outer electronic fences, it can effectively improve the calculation efficiency, improve the processing efficiency, and save server resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 FIG. 1 is an application environment diagram of an electronic fence-based alarm method in an embodiment;
[0069] Figure 2 A schematic diagram of a flow chart of an alarm method based on an electronic fence in an embodiment;
[0070] Figure 3 is a structural block diagram of an alarm device based on an electronic fence in one embodiment;
[0071] Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0073] The electronic fence-based alarm method provided in this application can be applied to Figure 1In the application environment shown. In this embodiment, the target object is a vehicle, for example, the target object is a shared electric vehicle, wherein the shared electric vehicle 102 communicates with the server 104 through the network. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers. The shared electric vehicle 102 is provided with a communication module and a positioning module for connecting to a mobile communication network. The positioning module can be a GPS (Global Positioning System) module or a Beidou module. The shared electric vehicle 102 obtains the coordinates of the current position through the positioning module, and uploads the target coordinates to the server 104 through the communication module. The server obtains the target coordinates of the current position of the target object; detects whether the current position of the target object is outside the electronic fence; when the current position of the target object is outside the electronic fence, converts the target coordinates into a target hash value based on the GEO hash algorithm; obtains the fence hash value of each fence coordinate of the electronic fence; compares the target hash value with each fence hash value, and determines the two fence hash values closest to the target hash value as the proximity hash values; determines the proximity boundary of the electronic fence based on the two proximity hash values; calculates the distance between the target coordinates and the proximity boundary to obtain the exit distance; detects whether the exit distance is greater than a preset distance; when the exit distance is greater than the preset distance, triggers an alarm.
[0074] In one embodiment, Figure 2 As shown, an alarm method based on an electronic fence is provided, and the method is applied to Figure 1 The server in the example is used to illustrate the following steps:
[0075] Step 210, obtaining the target coordinates of the current position of the target object.
[0076] It should be understood that the target object can be an electronic device, mobile terminal, vehicle, etc. with network communication function and positioning function. The vehicle can include a four-wheeled vehicle, a three-wheeled vehicle and a two-wheeled vehicle, or a gasoline vehicle, an electric vehicle or a bicycle. In this embodiment, the target object is further described as a shared electric vehicle. In this embodiment, the coordinates of the target object at the current position are obtained in real time, and the coordinates are the target coordinates.
[0077] Step 220: Detect whether the current location of the target object is outside the electronic fence.
[0078] In this embodiment, the electronic fence is a fence pre-set on an electronic map, and the electronic fence is used to limit the range of operation of the powered electric vehicle. It should be understood that, generally speaking, the area of the electronic fence corresponds to the administrative division, or may not correspond to the administrative division. For example, the area enclosed by the electronic fence is an industrial area, for example, the area enclosed by the electronic fence is a university town, and the area enclosed by the electronic fence is an urban area. By setting up an electronic fence, it is possible to prevent shared electric vehicles from leaving the designated area. On the one hand, it can make shared electric vehicles easier to manage, and on the other hand, it can prevent shared electric vehicles from being unable to return the vehicle due to lack of power due to driving too far out of the urban area.
[0079] In this step, it is detected whether the shared electric vehicle has driven out of the electronic fence and whether the target coordinates of the target object are outside the area defined by the electronic fence.
[0080] Step 230: When the current position of the target object is outside the electronic fence, the target coordinates are converted into a target hash value based on the GEO hash algorithm.
[0081] In this embodiment, the GEO hash algorithm is also called the GEO Hash algorithm, which is an ordered hash algorithm based on geographic location. Each coordinate on the map includes longitude and latitude, and the GEO hash algorithm can convert the longitude and latitude of the coordinate into a hash value. Specifically, the target coordinates include the longitude and latitude of the target object. In the GEO hash algorithm, the longitude and latitude of the target object are binary compared, and then encoded to obtain a hash value, which is the target hash value.
[0082] Step 240: Obtain fence hash values of each fence coordinate of the electronic fence.
[0083] In this embodiment, the electronic fence includes a plurality of continuous or discontinuous coordinates, which are fence coordinates. By connecting the fence coordinates, an electronic fence is formed. In this embodiment, each fence coordinate corresponds to a fence hash value.
[0084] Step 250 : Compare the target hash value with each fence hash value, and determine two fence hash values closest to the target hash value as close hash values.
[0085] In this embodiment, the two fence hash values closest to the target hash value may be searched in a polling manner, or the target hash value may be compared with each fence hash value one by one to determine the two fence hash values closest to the target hash value.
[0086] In one embodiment, the target hash value is compared with each of the fence hash values through a sorting algorithm.
[0087] It should be understood that one of the two closest fence hash values is greater than the target hash value, and the other of the two closest fence hash values is less than the target hash value. Therefore, in this embodiment, determining the two closest fence hash values refers to the two closest fence hash values adjacent to the target hash value. Therefore, the target hash value is between the two closest fence hash values. Therefore, by finding two fence hash values adjacent to the target hash value, the two fence coordinates closest to the target coordinates can be determined.
[0088] Step 260: Determine the proximity boundary of the electronic fence based on the two proximity hash values.
[0089] In this embodiment, the boundary closest to the target coordinates is determined based on the two proximity hash values, and the boundary is used as the proximity boundary.
[0090] In one embodiment, the fence coordinates corresponding to the two proximity hash values are used as line segment endpoints, and the proximity boundary of the electronic fence is determined by connecting the two line segment endpoints.
[0091] It should be understood that two different fence coordinates can determine different line segments, and each line segment has a different distance from the target object. Therefore, by first determining the two closest proximity hash values, a boundary section closest to the target object can be determined. The proximity boundary is the boundary section in the electronic fence that is closest to the object target.
[0092] Step 270, calculating the distance between the target coordinates and the approach boundary to obtain the exit distance.
[0093] It should be understood that the proximity boundary is a boundary in the electronic fence that is closest to the target coordinates. By calculating the distance between the target coordinates and the proximity boundary, the distance of the target object out of the electronic fence can be obtained, and this distance is the exit distance.
[0094] In one embodiment, the step of calculating the distance between the target coordinates and the approaching boundary includes: taking the target coordinates as a starting point, generating a distance measuring line perpendicular to the approaching boundary, taking the point where the distance measuring line intersects the approaching boundary as an end point of the distance measuring line, and calculating the length of the distance measuring line to obtain the exit distance. In this embodiment, the distance measuring line is generated perpendicular to the approaching boundary, and the length of the distance measuring line is the distance between the target coordinates and the approaching boundary.
[0095] Step 280, detecting whether the driving distance is greater than a preset distance.
[0096] Step 290: When the travel distance is greater than the preset distance, an alarm is triggered.
[0097] In this embodiment, when the driving distance is greater than the preset distance, it indicates that the shared electric vehicle has driven a long distance outside the electronic fence and needs to be restricted in time. Therefore, an alarm is triggered to remind the user or the shared electric vehicle is powered off to prevent the shared electric vehicle from continuing to drive out of the electronic fence.
[0098] In the above embodiment, by converting the target coordinates into a target hash value and comparing the target hash value with the fence hash value, the two fence coordinates closest to the target coordinates can be quickly determined, thereby determining the boundary of a section of the electronic fence closest to the target coordinates, thereby quickly calculating the exit distance of the target object and then issuing an alarm. Compared with the traditional calculation method of the inner and outer electronic fences, it can effectively improve the computing efficiency, improve the processing efficiency, and save server resources.
[0099] In one embodiment, the step of detecting whether the current position of the target object is outside the electronic fence includes: using the target coordinates as the starting coordinates of the ray, generating a reference ray that intersects the electronic fence on a map; detecting whether the number of intersection points between the reference ray and the electronic fence is an even number; when the number of intersection points between the reference ray and the electronic fence is an even number, determining that the current position of the target object is outside the electronic fence; when the number of intersection points between the reference ray and the electronic fence is an odd number, determining that the current position of the target object is inside the electronic fence.
[0100] It is worth mentioning that the area enclosed by the electronic fence can be a regular shape, such as a circle, a regular polygon, a triangle, a rectangle, a square, a trapezoid, etc., or it can be an irregular shape.
[0101] In one embodiment, the target coordinates are used as the ray starting point coordinates, and a plurality of reference rays are generated in any direction on the map, wherein at least one of the reference rays intersects with the electronic fence.
[0102] In this embodiment, when generating a reference ray, the target coordinates are used as the starting point and extended in any multiple directions on the map to generate a reference ray, so that the reference ray passes through the electronic fence and intersects with the electronic fence. When the number of intersection points between the reference ray and the electronic fence is an even number, it indicates that the target object is located outside the electronic fence at this time. When the number of intersection points between the reference ray and the electronic fence is an odd number, it indicates that the target object is located inside the electronic fence at this time. Through this process, it is possible to quickly and efficiently determine whether the target object is located inside the electronic fence at this time, and it can be applicable to various electronic fences of regular or irregular shapes.
[0103] In one embodiment, the step of obtaining the target coordinates of the current position of the target object includes: obtaining the fence coordinates of each of the electronic fences; converting each of the fence coordinates into a fence hash value one by one based on the GEO hash algorithm; sorting each of the fence hash values, and generating a hash value set based on the sorted fence hash values; the step of comparing the target hash value with each of the fence hash values, and determining the two fence hash values closest to the target hash value as the close hash value includes: comparing the target hash value with each of the fence hash values in the hash value set through a sorting algorithm, and determining the two fence hash values closest to the target hash value as the close hash value.
[0104] In this embodiment, the fence hash values corresponding to the fence coordinates of each electronic fence are pre-calculated, and the fence hash values are sorted to obtain an ordered set of hash values. In this way, when comparing with the target hash value, the two fence hash values closest to the target hash value can be quickly determined through the sorting algorithm, thereby effectively improving the efficiency of determining the close hash value.
[0105] In one embodiment, the step of triggering an alarm when the driving distance is greater than the preset distance includes: when the driving distance is greater than a first preset distance, sending an alarm message to the target object; when the driving distance is greater than a second preset distance, sending a power-off control instruction to the target object; wherein the second preset distance is greater than the first preset distance.
[0106] In this embodiment, when the travel distance is greater than the first preset distance and less than the second preset distance, it indicates that the target object has just stepped out of the electronic fence. Therefore, only an alarm message is sent to the target object. For example, the server sends a voice alarm prompt message to the shared electric vehicle to remind the user that the shared electric vehicle has stepped out of the electronic fence through voice broadcast. When the travel distance is greater than the second preset distance, it indicates that the target object has stepped out of the electronic fence by a large distance. Therefore, the server sends a power-off control instruction to the shared electric vehicle to control the shared electric vehicle to forcibly power off the shared electric vehicle to prevent the shared electric vehicle from continuing to drive.
[0107] In one embodiment, the step of calculating the distance between the target coordinates and the approaching boundary to obtain the exit distance includes: taking the target coordinates as a starting point, generating a distance measuring line perpendicular to the approaching boundary, taking the point where the distance measuring line intersects with the approaching boundary as the end point of the distance measuring line, detecting whether the end point of the distance measuring line coincides with the midpoint of the approaching boundary, and when the end point of the distance measuring line coincides with the midpoint of the approaching boundary, calculating the length of the distance measuring line to obtain a first exit distance; when the end point of the distance measuring line does not coincide with the midpoint of the approaching boundary, calculating the distance between the target coordinates and the midpoint of the approaching boundary to obtain a second exit distance;
[0108] When the first exit distance is calculated, it is detected whether the first exit distance is greater than the preset distance. When the first exit distance is greater than the preset distance, an alarm is triggered; when the second exit distance is calculated, it is detected whether the second exit distance is greater than the preset distance. When the second exit distance is greater than the preset distance, a new temporary boundary is generated with the midpoint of the approaching boundary and the end point of the distance measuring line; it is detected whether the target coordinates change. When it is detected that the target coordinates change, the distance between the target coordinates and the new adjacent boundary is detected. When the distance between the target coordinates and the new adjacent boundary is greater than a third exit distance, an alarm is triggered; wherein the third exit distance is less than or equal to the first exit distance.
[0109] In this embodiment, when the distance measuring line coincides with the midpoint of the proximity boundary, it indicates that the target coordinates are at the same distance from the fence coordinates corresponding to the two proximity hash values, so the distance between the target coordinates and the proximity boundary can be accurately calculated. When the distance measuring line does not coincide with the midpoint of the proximity boundary, it indicates that the distances between the target coordinates and the fence coordinates corresponding to the two proximity hash values are not equal. Therefore, the length of the distance measuring line cannot accurately reflect the distance between the target coordinates and the electronic fence. Therefore, no alarm is temporarily issued for the position of the target coordinates. In this embodiment, a temporary boundary is generated with the focus of the proximity boundary and the end point of the distance measuring line. The temporary boundary is used to detect the next action of the target coordinates. When the distance between the target coordinates and the temporary boundary is greater than the third exit distance, it indicates that the electric vehicle stays outside the temporary boundary. Compared with the use of proximity boundary to detect the distance of the target coordinates, on the one hand, it can reduce the amount of calculation and improve the detection efficiency. On the other hand, it can respond to slight changes in the target coordinates in a timely manner and detect slight changes in the position of the electric vehicle, thereby improving the inspection sensitivity of the electric vehicle that has crossed the boundary and issuing an alarm in time.
[0110] It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0111] In one embodiment, Figure 3As shown, an alarm device based on an electronic fence is provided, comprising:
[0112] A target coordinate acquisition module 310 is used to acquire the target coordinates of the current position of the target object;
[0113] A position detection module 320 is used to detect whether the current position of the target object is outside the electronic fence;
[0114] A hash calculation module 330, configured to convert the target coordinates into a target hash value based on a GEO hash algorithm when the current location of the target object is outside the electronic fence;
[0115] A fence hash value acquisition module 340 is used to acquire a fence hash value of each fence coordinate of the electronic fence;
[0116] A close hash value determination module 350 is used to compare the target hash value with each fence hash value, and determine two fence hash values closest to the target hash value as close hash values;
[0117] A proximity boundary determination module 360, configured to determine a proximity boundary of the electronic fence based on the two proximity hash values;
[0118] The exit distance calculation module 370 is used to calculate the distance between the target coordinates and the approach boundary to obtain the exit distance;
[0119] A distance detection module 380 is used to detect whether the driving distance is greater than a preset distance;
[0120] The alarm triggering module 390 is used to trigger an alarm when the travel distance is greater than the preset distance.
[0121] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store a numbering resource library of numbering resources. The network interface of the computer device is used to access the network and connect and communicate with the shared electric vehicle. When the computer program is executed by the processor, an alarm method based on an electronic fence is implemented.
[0122] Those skilled in the art will understand that Figure 4The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0123] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the electronic fence-based alarm method in any of the above embodiments are implemented.
[0124] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the electronic fence-based alarm method in any of the above embodiments are implemented.
[0125] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0126] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0127] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. An alarm method based on electronic fence, characterized in that: The method comprises: Get the target coordinates of the current position of the target object; Detecting whether the current position of the target object is outside the electronic fence; When the current position of the target object is outside the electronic fence, converting the target coordinates into a target hash value based on a GEO hash algorithm; Obtain fence hash values of each fence coordinate of the electronic fence; Comparing the target hash value with each of the fence hash values, and determining two fence hash values closest to the target hash value as close hash values; Determining a proximity boundary of the electronic fence based on the two proximity hash values; Calculate the distance between the target coordinates and the approach boundary to obtain the exit distance; Detecting whether the travel distance is greater than a preset distance; When the travel distance is greater than the preset distance, an alarm is triggered.
2. The method according to claim 1, characterized in that: The step of detecting whether the current position of the target object is outside the electronic fence comprises: Using the target coordinates as the starting coordinates of the ray, a reference ray intersecting with the electronic fence is generated on the map; Detecting whether the number of intersection points between the reference ray and the electronic fence is an even number; When the number of intersection points between the reference ray and the electronic fence is an even number, it is determined that the current position of the target object is outside the electronic fence; When the number of intersection points between the reference ray and the electronic fence is an odd number, it is determined that the current position of the target object is within the electronic fence.
3. The method according to claim 2, characterized in that The step of using the target coordinates as the ray starting point coordinates to generate a reference ray intersecting the electronic fence on the map comprises: Taking the target coordinates as the ray starting point coordinates, a plurality of reference rays are generated in any direction on the map, wherein at least one of the reference rays intersects with the electronic fence.
4. The method according to claim 1, characterized in that: The step of comparing the target hash value with each fence hash value comprises: The target hash value is compared with each fence hash value through a sorting algorithm.
5. The method according to claim 1, characterized in that The step of determining the proximity boundary of the electronic fence based on the two proximity hash values comprises: The fence coordinates corresponding to the two proximity hash values are used as line segment endpoints, and the proximity boundary of the electronic fence is determined by connecting the two line segment endpoints.
6. The method according to claim 1, characterized in that The step of obtaining the target coordinates of the current position of the target object includes: Obtaining the coordinates of each fence of the electronic fence; Convert each of the fence coordinates into a fence hash value based on the GEO hash algorithm; Sorting the fence hash values, and generating a hash value set based on the sorted fence hash values; The step of comparing the target hash value with each fence hash value to determine two fence hash values closest to the target hash value as close hash values comprises: The target hash value is compared with each fence hash value of the hash value set by a sorting algorithm, and two fence hash values closest to the target hash value are determined as close hash values.
7. The method according to any one of claims 1 to 6, characterized in that When the travel distance is greater than the preset distance, the step of triggering an alarm includes: When the travel distance is greater than a first preset distance, sending a warning message to the target object; When the travel distance is greater than a second preset distance, sending a power-off control instruction to the target object; Wherein, the second preset distance is greater than the first preset distance.
8. An alarm device based on an electronic fence, characterized in that: include: A target coordinate acquisition module is used to acquire the target coordinates of the current position of the target object; A position detection module, used to detect whether the current position of the target object is outside the electronic fence; A hash calculation module, used for converting the target coordinates into a target hash value based on a GEO hash algorithm when the current position of the target object is outside the electronic fence; A fence hash value acquisition module, used to acquire the fence hash value of each fence coordinate of the electronic fence; A close hash value determination module, configured to compare the target hash value with each fence hash value, and determine two fence hash values closest to the target hash value as close hash values; A proximity boundary determination module, configured to determine a proximity boundary of the electronic fence based on the two proximity hash values; An exit distance calculation module is used to calculate the distance between the target coordinates and the approach boundary to obtain an exit distance; A distance detection module, used to detect whether the driving distance is greater than a preset distance; The alarm triggering module is used to trigger an alarm when the travel distance is greater than the preset distance.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.