Electronic fence loading method, device, equipment and storage medium
Through the combination of geohash encoding and triangle segmentation algorithm, drag-and-drop loading of electronic fences is realized, solving the problems of slow loading speed and high server performance in the existing technology, improving loading speed and user experience, and reducing costs.
Patent Information
- Application Number
- CN202010999786.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-21
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2040-09-21
AI Technical Summary
The existing electronic fence loading method causes data to be loaded repeatedly, which is slow to load and has high requirements for server performance, affecting delivery efficiency and user experience.
The drag-and-drop loading method is adopted, and the latitude and longitude data of the preset position points of the electronic fence are encoded and filtered through geohash encoding. Only the electronic fences in the drag-and-drop area are loaded, and the number of electronic fences within the loading range is increased by using the triangle segmentation algorithm.
It improves the loading speed of electronic fences, reduces the high-performance configuration requirements for servers, improves the user experience, and reduces costs.
Smart Images

Figure CN112333635B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic fences, and in particular to an electronic fence loading method, device, equipment and storage medium. Background Art
[0002] In recent years, with the rapid development of the Internet and e-commerce, countless companies have opened online service platforms. Therefore, online shopping has become a part of most people's lives. Among them, the delivery and receipt of commodity orders, as an important part of modern logistics, directly affects the delivery efficiency and the recipient's delivery experience. At present, electronic fence order splitting has greatly improved the efficiency and effectiveness of delivery. However, the current industry mainly relies on local Figure 1 The method of loading the electronic fence in full at one time causes repeated loading of data, slow loading speed and high requirements on server performance. Therefore, the slow loading speed of the electronic fence is a common problem in the express delivery industry. Summary of the invention
[0003] In order to solve the problem of slow loading speed of electronic fence, the present application provides an electronic fence loading method, device, equipment and storage medium, which improves the loading speed of electronic fence by dragging and loading the electronic fence.
[0004] The technical solution provided by the present invention is as follows:
[0005] The present invention provides an electronic fence loading method, comprising the steps of:
[0006] The longitude and latitude data of each preset location point of the electronic fence are geohash encoded and stored;
[0007] Perform geohash encoding on the latitude and longitude data of the center point of the dragged area;
[0008] Filter the geohash code located in the drag area by geohash;
[0009] Load the electronic fence corresponding to the filtered geohash code.
[0010] Further preferably, the dragging area is a circular dragging area formed with the query position point as the center point and the query distance as the radius, and the geohash encoding of the longitude and latitude data of the center point of the dragging area specifically includes the steps of:
[0011] Selecting a corresponding geohash encoding length for the query distance range according to the geohash accuracy table;
[0012] The query location point is geohash encoded according to the selected geohash encoding length.
[0013] Further preferably, the geohash codes located in the drag area are filtered by geohash, specifically comprising the steps of searching for the geohash codes of the longitude and latitude of the preset location points of the electronic fence that match the geohash code of the query location point, and filtering out the geohash codes that meet the preset matching conditions.
[0014] Further preferably, the preset location point of the electronic fence includes the longitude and latitude of the center point of the electronic fence.
[0015] Further preferably, the method further includes the step of segmenting each electronic fence, wherein the preset position points of the electronic fence also include the longitude and latitude of the center point of the segmented part.
[0016] Further preferably, a triangle segmentation algorithm is used to segment each electronic fence into a plurality of triangles, and the preset position points of the electronic fence also include the longitude and latitude of the center point of each triangle.
[0017] Further preferably, the geohash encoding and storage of the latitude and longitude data of each preset location point of the electronic fence specifically includes:
[0018] The latitude and longitude data of each preset location point of the electronic fence are encoded into a string of preset length through the geohash algorithm;
[0019] The longitude, latitude and corresponding coded character string of each preset location point of the electronic fence are formed into a record;
[0020] The records are sorted and stored in lexicographical order according to the character strings.
[0021] The present invention also provides an electronic fence loading device, comprising:
[0022] The data preprocessing module is used to perform geohash encoding on the longitude and latitude data of each preset location point of the electronic fence and store it; it is also used to perform geohash encoding on the longitude and latitude data of the center point of the dragged area;
[0023] A screening module, used for screening geohash codes located in the drag area through geohash;
[0024] The loading module is used to load the electronic fence corresponding to the filtered geohash code.
[0025] The present invention also provides an electronic fence loading terminal device, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the above-mentioned electronic fence loading method.
[0026] The present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned electronic fence loading method is implemented.
[0027] The electronic fence loading method, device, equipment and storage medium according to the above embodiments have at least the following effects:
[0028] 1. The technical solution provided in this application only loads within the dragged area, which can increase the loading speed of the electronic fence and enhance the user experience.
[0029] 2. It can reduce the high-performance configuration requirements for the server and reduce costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 Loading method flow chart for electronic fence;
[0031] Figure 2 This is a schematic diagram of base32 encoding rules;
[0032] Figure 3 Intent for geohash precision;
[0033] Figure 4 This is a schematic diagram of the geohash encoding process for latitude 39.928167;
[0034] Figure 5 A schematic diagram for combining latitude code and longitude code to generate a new string;
[0035] Figure 6 This is a schematic diagram of loading an electronic fence based on a dragged area;
[0036] Figure 7 Loading device schematic for electronic fence;
[0037] Figure 8 Load the terminal device schematic for the electric fence. DETAILED DESCRIPTION
[0038] The present invention will be further described in detail below through specific implementation modes in conjunction with the accompanying drawings.
[0039] An electronic fence refers to the coverage area of a site circled on a map. An electronic fence is a closed irregular polygon. In the prior art, electronic fences are applied to the field of express delivery order splitting. Specifically, electronic maps and electronic fence technologies are applied to order splitting and delivery. First, the longitude and latitude of the recipient address are obtained through the electronic map, and then the network point code and salesperson code corresponding to the longitude and latitude are obtained through the electronic fence. This involves the process of loading the electronic fence on the electronic map. The existing electronic fence loading method is: a one-time full load of the electronic fence. This rendering method causes repeated loading of data, slow loading speed and high requirements on server performance.
[0040] In view of the above defects, in the embodiment of the present invention, only the electronic fences in the dragging area are loaded and rendered, so as to change the traditional one-time full loading of electronic fences, thereby improving the loading speed of electronic fences. The technical solution of the present invention is described below through specific embodiments.
[0041] Embodiment 1:
[0042] This embodiment provides an electronic fence loading method, and its flow chart is as follows: Figure 1 As shown, the specific steps include the following steps.
[0043] S100: geohash-encode the longitude and latitude data of each preset location point of the electronic fence and store them.
[0044] S200: Perform geohash encoding on the longitude and latitude data of the center point of the dragged area.
[0045] S300: Filtering the geohash code located in the drag area through the geohash.
[0046] S400: Loading the electronic fence corresponding to the screened geohash code.
[0047] The above steps are described below.
[0048] In step S100, the latitude and longitude data of each preset location point of the electronic fence are geohash encoded and stored. Specifically, the following steps are included:
[0049] S101: encoding the latitude and longitude data of each preset location point of the electronic fence into a character string of a preset length through a geohash algorithm.
[0050] S102: The longitude, latitude and corresponding coded character string of each preset location point of the electronic fence are formed into a record.
[0051] S103: Sort and store the records in lexicographical order according to the character string.
[0052] First, the geohash algorithm is explained: geohash uses a string to represent the two coordinates of longitude and latitude, that is, geohash can convert a longitude and latitude information into a string code that can be sorted and compared. The prefix of the code can represent a larger area. For example, wx4g0ec1, its prefix wx4g0e represents a larger range including the code wx4g0ec1. This application also uses this feature to search for electronic fences within the drag area. The encoding rule involved in this embodiment is the base32 encoding rule. The base32 encoding rule is shown in the figure. Figure 2 shown.
[0053] In step S101, the character string of the preset length is also the geohash code of the preset length, that is, the length of the geohash code, which is the geohash code length selected according to the actual application requirements and the geohash accuracy table. The geohash accuracy table is as follows: Figure 3 As shown, geohashlength represents the geohash code length, lat bits represent the number of latitude bits, lng bits represent the number of longitude bits, lat error represents the latitude error, lng error represents the longitude error, and km error represents the distance error.
[0054] Depend on Figure 3 It can be seen that the larger the geohash code length, the higher the error accuracy. For example, when the geohash code length is 1, the distance error is 2500km; when the geohash code length is 2, the distance error is 630km; when the precise geohash code length is 3, the distance error is 78km; when the geohash code length is 4, the distance error is 20km; when the geohash code length is 5, the distance error is 2.4km; when the geohash code length is 6, the distance error is 610m; when the geohash code length is 7, the distance error is 76m; when the geohash code length is 8, the distance error is 19m.
[0055] The basic principle of geohash encoding is: first convert the longitude and latitude into binary, then merge the binary longitude and latitude, and finally encode them according to base32. The following is an illustration of the geohash algorithm using the longitude and latitude values: (116.389550, 39.928167).
[0056] The process of approximating the latitude 39.928167 with the earth's latitude interval being [-90, 90] includes steps a to h.
[0057] Step a, divide the interval [-90, 90] into [-90, 0) and [0, 90], which are called the left and right intervals. It can be determined that 39.928167 belongs to the right interval [0, 90] and is marked as 1;
[0058] Step b, then divide the interval [0, 90] into [0, 45) and [45, 90], and it can be determined that 39.928167 belongs to the left interval [0, 45) and is marked as 0;
[0059] Step c, recursively repeat the above process. 39.928167 always belongs to a certain interval [a, b]. With each iteration, the interval [a, b] is always shrinking and getting closer and closer to 39.928167.
[0060] Step d: If the given latitude 39.928167 belongs to the left interval, record 0; if it belongs to the right interval, record 1. The length of the sequence is related to the number of times the given interval is divided, such as Figure 4 As shown;
[0061] Step e, similarly, the longitude interval of the earth is [-180, 180], and the longitude 116.389550 can be encoded. Through the above calculation, the code generated by the longitude is 1 1 0 1 0 0 1 0 1 1 0 0 0 1 0, and the code generated by the latitude is 1 0 11 1 0 0 0 1 1 0 0 0 1 1;
[0062] Step f, merge: put longitude in even digits and latitude in odd digits, and combine the two strings to generate a new string such as Figure 5 As shown;
[0063] Step g, follow Figure 2 First, convert 11100 11101 00100 01111 0000 01101 into decimal, which corresponds to 28, 29, 4, 15, 0, 13. The base32 code corresponding to the decimal is wx4g0e. This code is used as the geohash code of the above longitude and latitude.
[0064] Will<wx4g0e,(116.389550,39.928167)> As a record, and sort by lexicographic order according to wx4gOe<wx4g0e,(116.389550,39.928167)> Sort and store.
[0065] The geohash encoding and storage of the latitude and longitude data of each preset location point of the electronic fence are completed through the above steps S101 to S103.
[0066] In step S200, geohash encoding is performed on the longitude and latitude data of the center point of the drag area; wherein the drag area is a circular drag area formed with the query position point as the center point and the query distance as the radius, and the geohash encoding of the longitude and latitude data of the center point of the drag area specifically includes the steps of:
[0067] According to the geohash accuracy table, select the corresponding geohash encoding length for the query distance range;
[0068] The query location point is geohash encoded according to the selected geohash encoding length.
[0069] For the specific process of geohash encoding the latitude and longitude data of the center point of the dragged area, please refer to the above steps a to g, which will not be repeated here.
[0070] In step S300, the geohash codes located in the drag area are filtered by geohash, specifically including the steps of searching for the geohash codes of the longitude and latitude of the preset location points of the electronic fence that match the geohash code of the query location point, and filtering out the geohash codes that meet the preset matching conditions.
[0071] Specifically, the geohash-encoded string is matched, and the prefix of the same string is used as the preset matching condition. The geohash code in the same string prefix is selected as the screening result. For example, wx4g0ec1, its prefix wx4g0e represents a larger range including the code wx4g0ec1, so all geohash codes with the same prefix wx4g0e can be used as the screening result.
[0072] In one embodiment, the preset location point of the electronic fence includes the longitude and latitude of the center point of the electronic fence. In this case, the above steps S100 to S400 are only loaded for the electronic fence whose center point longitude and latitude are within the dragging area.
[0073] In special cases, for example, when the area of the electronic fence is large, and the electronic fence intersects with the drag area, but the longitude and latitude of the center point of the electronic fence does not exist in the drag area, the electronic fence cannot be loaded. In view of this situation, this embodiment further optimizes the electronic fence loading method, through which the loading of the electronic fence in the drag area and the electronic fence intersecting with the drag area can be realized. The optimization process is as follows:
[0074] Before the above step S100, the step of segmenting each electronic fence is also included. Furthermore, the preset position points of the electronic fence also include the longitude and latitude of the center point of the segmented part.
[0075] Preferably, a triangle segmentation algorithm is used to segment each electronic fence into a plurality of triangles, and the preset position points of the electronic fence also include the longitude and latitude of the center point of each triangle. Compared with geohash encoding the longitude and latitude of the center point of each electronic fence alone, the optimization process increases the number of geohash coded position points in the electronic fence area, so that the number of electronic fences loaded can be increased as much as possible within a certain dragging area.
[0076] For example, Figure 6 As shown, label A is the drag area, and labels B and C are different electronic fences, wherein A1 is the center point of the drag area, point B1 is the center point of electronic fence B, point C1 is the center point of electronic fence C, and points D1, D2, D3, etc. are the center points of the triangular areas divided by the partial area of electronic fence C. If only the longitude and latitude of the center point of the electronic fence are geohash encoded, only the electronic fence B can be loaded, and the electronic fence C cannot be loaded; if based on the extension, the electronic fence is divided into triangles, and the center point of the divided triangle is geohash encoded while the center point of the electronic fence is geohash encoded, then the electronic fence C intersecting with the drag area A can be loaded through any point among the matched points D1, D2, and D3, so as to achieve the effect of maximizing the loading of the electronic fence within a certain drag area.
[0077] Compared with the traditional one-time full loading, the electronic fence loading method provided by this embodiment only loads the electronic fence within the dragging area. For example, the electronic fence within the dragging area is loaded, and the electronic fence outside the dragging area is not loaded, thereby increasing the loading speed of the electronic fence, improving the user experience, reducing the high-performance configuration requirements for the server, and reducing costs.
[0078] In the field of express delivery services, each branch across the country maintains the electronic fence for the pickup / delivery of its salesmen. For example, when a delivery is required, a match is dragged on the electronic map, and the electronic fence of the dragged area is loaded. Then, the ray method and R-tree index are used to determine which branch's salesman's electronic fence the longitude and latitude of the delivery falls within, thereby improving the efficiency of delivery.
[0079] Embodiment 2:
[0080] Based on the first embodiment, this embodiment provides an electronic fence loading device, and its principle diagram is as follows: Figure 7 As shown, it includes a data preprocessing module 100, a screening module 200 and a loading module 300.
[0081] The data preprocessing module 100 is used to perform geohash encoding on the longitude and latitude data of each preset position point of the electronic fence and store the data; and is also used to perform geohash encoding on the longitude and latitude data of the center point of the dragging area.
[0082] Furthermore, the data preprocessing module 100 includes:
[0083] The segmentation unit 101 is used to perform pre-segmentation processing on each electronic fence, specifically using a triangle segmentation algorithm to segment each electronic fence into a plurality of triangles.
[0084] The geohash encoding unit 102 is used to perform geohash encoding on the longitude and latitude of the center point of each electronic fence and the longitude and latitude of the center point of each triangle. At the same time, it is also used to perform geohash encoding on the longitude and latitude data of the center point of the drag area formed by dynamic dragging on the electronic map. For the specific application and encoding rules of the geohash algorithm, please refer to the description of step S100 in Example 1, which will not be repeated in this embodiment.
[0085] The storage unit 103 encodes the longitude and latitude data of each preset position point of the electronic fence into a character string of a preset length through the geohash encoding unit 102, and forms a record with the longitude, latitude and corresponding encoded character string of each preset position point of the electronic fence; sorts the records in lexicographic order according to the character string and stores them in the storage unit 103.
[0086] The screening module 200 is used to screen the geohash codes in the drag area by geohash. In this embodiment, the screening module 200 searches for the geohash codes of the latitude and longitude of the preset location points of the electronic fence that match the geohash code of the query location point, and screens out the geohash codes that meet the preset matching conditions.
[0087] Specifically, the geohash-encoded string is matched, and the prefix of the same string is used as the preset matching condition. The geohash code in the same string prefix is selected as the screening result. For example, wx4g0ec1, its prefix wx4g0e represents a larger range including the code wx4g0ec1, so all geohash codes with the same prefix wx4g0e can be used as the screening result.
[0088] The loading module 300 is used to load the electronic fence corresponding to the screened geohash code.
[0089] Compared with the traditional one-time full loading, the technical solution provided by the electronic fence loading device provided in this embodiment only loads the loading range within the dragging area. For example, the electronic fence within the dragging area is loaded, and the electronic fence outside the dragging area is not loaded, thereby increasing the loading speed of the electronic fence, improving the user experience, reducing the high-performance configuration requirements for the server, and reducing costs.
[0090] Embodiment three:
[0091] Based on the first embodiment and the second embodiment, this embodiment provides an electronic fence loading terminal device, the schematic diagram of which is as follows: Figure 8 As shown, the terminal device 800 may be a tablet computer, a smart phone, a notebook computer or a desktop computer. The terminal device 800 may also be called a portable terminal, a laptop terminal, a desktop terminal or other names.
[0092] Typically, the terminal device 800 includes a processor 8001 and a memory 8002. The processor 8001 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 8001 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 8001 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state.
[0093] In some embodiments, the processor 8001 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 8001 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0094] The memory 8002 may include one or more computer-readable storage media, which may be non-transitory. The memory 8002 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 8002 is used to store at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is used to be executed by the processor 8001 to implement the electronic fence loading method provided in Example 1 of the present application.
[0095] Therefore, the device 800 of the present application executes the electronic fence loading method provided in the first embodiment through at least one instruction, at least one program, code set or instruction set, which has the following advantages:
[0096] Compared with the traditional one-time full loading, the technical solution provided by the present application only loads the loading range within the dragged area. For example, the electronic fence within the dragged area is loaded, and the electronic fence outside the dragged area is not loaded, thereby increasing the loading speed of the electronic fence, improving the user experience, reducing the high-performance configuration requirements for the server, and reducing costs.
[0097] In some embodiments, the terminal device 800 may further optionally include: a peripheral device interface 8003 and at least one peripheral device. The processor 8001, the memory 8002 and the peripheral device interface 8003 may be connected via a bus or a signal line.
[0098] Specifically in this embodiment, in order to realize electronic fence loading, the corresponding peripheral device includes a background management platform 8004, and the background management platform 8004 provides electronic maps and electronic fence information. Further, the processor 8001 obtains the required electronic maps and electronic fence information through the background management platform 8004.
[0099] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions, which, when executed on a computer, cause the computer to execute the electronic fence loading method in the first embodiment.
[0100] If the module in the second embodiment is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0101] The above specific examples are used to illustrate the present invention, which is only used to help understand the present invention and is not intended to limit the present invention. For those skilled in the art, according to the concept of the present invention, some simple deductions, modifications or substitutions can be made.
Claims
1. An electronic fence loading method, characterized in that: Includes steps: The longitude and latitude data of each preset location point of the electronic fence are geohash encoded and stored; Perform geohash encoding on the latitude and longitude data of the center point of the dragged area; Filter the geohash code located in the drag area by geohash; Load the electronic fence corresponding to the filtered geohash code; The dragging area is a circular dragging area formed by taking the query position point as the center point and the query distance as the radius, and the geohash encoding of the longitude and latitude data of the center point of the dragging area specifically includes the steps of: Selecting a corresponding geohash encoding length for the query distance range according to the geohash accuracy table; Performing geohash encoding on the query location point according to the selected geohash encoding length; The method of filtering the geohash codes located in the drag area by using geohash specifically includes the steps of: searching for the geohash codes of the longitude and latitude of the preset location points of the electronic fence that match the geohash code of the query location point, and filtering out the geohash codes that meet the preset matching conditions; The preset location point of the electronic fence includes the longitude and latitude of the center point of the electronic fence; Using a triangle segmentation algorithm to segment each electronic fence into a plurality of triangles, the electronic fence preset position point also includes the longitude and latitude of the center point of each triangle; The geohash encoding and storage of the latitude and longitude data of each preset location point of the electronic fence specifically includes: The latitude and longitude data of each preset location point of the electronic fence are encoded into a string of preset length through the geohash algorithm; The longitude, latitude and corresponding coded character string of each preset location point of the electronic fence are formed into a record; The records are sorted and stored in lexicographical order according to the character strings.
2. An electronic fence loading device, characterized in that: include: The data preprocessing module is used to perform geohash encoding on the longitude and latitude data of each preset location point of the electronic fence and store them; It is also used to perform geohash encoding on the latitude and longitude data of the center point of the dragged area; A screening module, used for screening geohash codes located in the drag area through geohash; The loading module is used to load the electronic fence corresponding to the filtered geohash code; The dragging area is a circular dragging area formed by taking the query position point as the center point and the query distance as the radius, and the geohash encoding of the longitude and latitude data of the center point of the dragging area specifically includes the steps of: Selecting a corresponding geohash encoding length for the query distance range according to the geohash accuracy table; Performing geohash encoding on the query location point according to the selected geohash encoding length; The method of filtering the geohash codes located in the drag area by using geohash specifically includes the steps of: searching for the geohash codes of the longitude and latitude of the preset location points of the electronic fence that match the geohash code of the query location point, and filtering out the geohash codes that meet the preset matching conditions; The preset location point of the electronic fence includes the longitude and latitude of the center point of the electronic fence; Using a triangle segmentation algorithm to segment each electronic fence into a plurality of triangles, the electronic fence preset position point also includes the longitude and latitude of the center point of each triangle; The geohash encoding and storage of the latitude and longitude data of each preset location point of the electronic fence specifically includes: The latitude and longitude data of each preset location point of the electronic fence are encoded into a string of preset length through the geohash algorithm; The longitude, latitude and corresponding coded character string of each preset location point of the electronic fence are formed into a record; The records are sorted and stored in lexicographical order according to the character strings.
3. An electronic fence loading terminal device, characterized in that: It includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the electronic fence loading method as described in claim 1.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the electronic fence loading method as claimed in claim 1 is implemented.
