A method and device for positioning

The method enhances the precision and efficiency of determining target object positions within or on polygonal electronic fences by using GeoHash coding to classify and filter associated polygon objects, addressing imprecision and inefficiency in existing circular fence technologies.

CN114814802BActive Publication Date: 2025-07-15BEIJING JINGDONG QIANSHITECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210404136.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-18
Publication Date
2025-07-15
Estimated Expiration
2042-04-18

AI Technical Summary

Technical Problem

In the prior art, when locating target objects using polygonal electronic fences, there are problems of low accuracy and insufficient search efficiency, especially when multiple target objects need to be positioned and judged relative to the electronic fence.

Method used

By constructing a polygon electronic fence and finding target polygon objects matching the target object from a plurality of first polygon objects and second polygon objects, these objects are represented by GeoHash encoding, and the relative positions of the target object and the polygon electronic fence are determined.

Benefits of technology

Improves the accuracy and search efficiency of the relative position of the target object to the electronic fence, ensuring accurate positioning inside and outside the polygonal electronic fence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114814802B_ABST
    Figure CN114814802B_ABST
Patent Text Reader

Abstract

The present invention discloses a positioning method and apparatus, relating to the field of smart cities. A specific embodiment of the method includes: being able to find a target polygon object that matches a target object from a plurality of first polygon objects corresponding to a polygon electronic fence and located inside the polygon electronic fence and a plurality of second polygon objects circumscribing the edge of the polygon electronic fence; determining the relative position of the target object and the polygon electronic fence according to the search result; using the constructed polygon electronic fence and the corresponding plurality of polygon objects to determine the relative position of the target object and the polygon electronic fence, improving the accuracy of determining the relative position of the target object and the electronic fence and enhancing the efficiency of determining the relative position of the target object and the electronic fence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart cities, and particularly to a method and apparatus for processing location information. Background Art

[0002] With the wide use of positioning systems, geoelectronic fences customized based on geolocation technology are applied to various scenarios. For example, the operating range of a vehicle is determined by an electronic fence to manage the vehicle.

[0003] Currently, a geoelectronic fence of a circular area is usually constructed by setting a target center point and a radius length. However, in some application scenarios where a polygonal electronic fence is required to locate a target object (such as a vehicle, etc.), the method of using a circular electronic fence to determine the relative position between the target object and the electronic fence has problems of relatively large range granularity and low accuracy. Especially when multiple target objects need to be located and the relative positions with the electronic fence are judged, there is a problem of low search efficiency. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a method and apparatus for processing location information, which can find a target polygon object that matches a target object from multiple first polygon objects located inside the polygon electronic fence corresponding to the polygon electronic fence and multiple second polygon objects circumscribing the edge of the polygon electronic fence; determine the relative position between the target object and the polygon electronic fence according to the search result; and use the constructed polygon electronic fence and the corresponding multiple polygon objects to determine the relative position between the target object and the polygon electronic fence, improving the accuracy of determining the relative position between the target object and the electronic fence and the efficiency of determining the relative position between the target object and the electronic fence.

[0005] To achieve the above object, according to one aspect of the embodiments of the present invention, a positioning method is provided, characterized by including: determining the location information of a target object and any polygon electronic fence related to the target object, where the polygon electronic fence is constructed based on multiple location information; the polygon electronic fence corresponds to multiple first polygon objects located inside the polygon electronic fence and multiple second polygon objects circumscribing the edge of the polygon electronic fence; finding a target polygon object that matches the location information of the target object from the multiple first polygon objects or the multiple second polygon objects; and determining the relative position between the target object and the polygon electronic fence according to the search result.

[0006] Optionally, the positioning method for constructing the polygon electronic fence based on multiple location information includes: receiving a request for constructing a polygon electronic fence, where the request includes the longitude and latitude of multiple vertices; where the number of vertices is at least 3; selecting two adjacent vertices based on the order of the multiple vertices; determining whether any other vertex among the multiple vertices except the two selected adjacent vertices is outside the straight line formed by the two adjacent vertices, and if so, constructing the polygon electronic fence based on the order of the multiple vertices and the longitude and latitude of each vertex.

[0007] Optionally, the positioning method further includes:

[0008] Obtaining the longitude and latitude corresponding to each vertex of the vertices of the polygon electronic fence; determining the minimum longitude, maximum longitude, minimum latitude, and maximum latitude from the longitude and latitude of the multiple vertices; combining the minimum longitude, the maximum longitude, the minimum latitude, and the maximum latitude, and determining the longitude and latitude of multiple feature vertices according to the combination result; constructing a circumscribed polygon of the polygon electronic fence based on the longitude and latitude of the multiple feature vertices; constructing the multiple first polygon objects and the multiple second polygon objects for the polygon electronic fence based on the circumscribed polygon.

[0009] Optionally, constructing the multiple first polygon objects and the multiple second polygon objects for the polygon electronic fence includes: determining a reference number of polygon objects for the polygon electronic fence or the circumscribed polygon; calculating the ratio of the area of the circumscribed polygon to the coverage area corresponding to each preset GeoHash encoding digit; determining a target GeoHash encoding digit whose difference from the reference number of polygon objects is within a set range; constructing multiple polygon objects for the circumscribed polygon based on the accuracy corresponding to the target GeoHash encoding digit and the reference number of polygon objects; screening out the multiple first polygon objects and the multiple second polygon objects from the multiple polygon objects.

[0010] Optionally, for each of the first polygon objects and each of the second polygon objects, they are represented by GeoHash encoding, where the GeoHash encoding is generated from the longitude and latitude of the vertices of the first polygon object or the second polygon object; the process of finding a target polygon object that matches the location information of the target object includes: finding a target GeoHash encoding that matches the GeoHash encoding included in the location information of the target object.

[0011] Optionally, the positioning method further includes: for each of the first polygon objects or each of the second polygon objects, performing: calculating the longitude and latitude of any vertex of the first polygon object or the second polygon object; obtaining the number of target GeoHash encoding digits corresponding to the polygon object; and determining the GeoHash encoding corresponding to the first polygon object or the second polygon object based on the longitude and latitude of the any vertex and the number of target GeoHash encoding digits.

[0012] Optionally, the screening of the multiple first polygon objects and the multiple second polygon objects from the multiple polygon objects includes: for each polygon object, performing: comparing the first longitude and latitude of the lower left vertex of the polygon object and the second longitude and latitude corresponding to the upper right vertex with the minimum longitude and latitude and the maximum longitude and latitude of the polygon electronic fence; determining whether the polygon object is outside the range of the polygon electronic fence; and if so, deleting the polygon object.

[0013] Optionally, after determining that at least a part of the polygon object is within the range of the polygon electronic fence, the positioning method further includes: determining whether the polygon object intersects any side of the polygon electronic fence; if so, determining the polygon object as a second polygon object; otherwise, determining the polygon object as a first polygon object.

[0014] Optionally, determining the relative position of the target object and the polygon electronic fence includes: if the search result indicates that the target polygon object is found from the multiple first polygon objects, determining that the target object is contained within the polygon electronic fence; or, if the search result indicates that the target polygon object is found from the multiple second polygon objects, determining that the target object is located at the edge of the polygon electronic fence; or, if the search result indicates that the target polygon object is not found, determining that the target object is outside the polygon electronic fence.

[0015] Optionally, determining that the target object is located at the edge of the polygon electronic fence further includes: using the longitude and latitude of the target object as a reference point, constructing a ray starting from the reference point towards the polygon formed by the polygon electronic fence, and determining whether the target object is within the polygon electronic fence or outside the polygon electronic fence based on the number of intersection points of the ray and the polygon.

[0016] Optionally, the positioning method processes the target object based on the determined relative position.

[0017] To achieve the above object, according to the second aspect of the embodiments of the present invention, there is provided a positioning device, characterized by comprising: a position acquisition module and a position determination module; wherein,

[0018] The position acquisition module is configured to determine the position information of a target object and any polygon-shaped electronic fence related to the target object, wherein the polygon-shaped electronic fence is constructed based on a plurality of position information; the polygon-shaped electronic fence corresponds to a plurality of first polygon objects located inside the polygon-shaped electronic fence and a plurality of second polygon objects circumscribing the edge of the polygon-shaped electronic fence;

[0019] The position determination module is configured to find a target polygon object that matches the position information of the target object from the plurality of first polygon objects or the plurality of second polygon objects; and determine the relative position of the target object and the polygon-shaped electronic fence according to the search result.

[0020] Optionally, the positioning device for constructing the polygon-shaped electronic fence based on a plurality of position information includes: receiving a request for constructing a polygon-shaped electronic fence, the request including the longitude and latitude of a plurality of vertices; wherein the number of vertices is at least 3; selecting two adjacent vertices based on the order of the plurality of vertices; determining whether any other vertex among the plurality of vertices except the selected two adjacent vertices is outside the straight line formed by the two adjacent vertices, and if so, constructing the polygon-shaped electronic fence based on the order of the plurality of vertices and the longitude and latitude of each vertex.

[0021] Optionally, the positioning device is further configured to: obtain the longitude and latitude corresponding to each vertex of the polygon-shaped electronic fence; determine the minimum longitude, the maximum longitude, the minimum latitude, and the maximum latitude from the longitude and latitude of the plurality of vertices; combine the minimum longitude, the maximum longitude, the minimum latitude, and the maximum latitude, and determine the longitude and latitude of a plurality of characteristic vertices according to the combination result; construct a circumscribed polygon of the polygon-shaped electronic fence based on the longitude and latitude of the plurality of characteristic vertices; and construct the plurality of first polygon objects and the plurality of second polygon objects for the polygon-shaped electronic fence based on the circumscribed polygon.

[0022] Optionally, the positioning device for constructing the plurality of first polygon objects and the plurality of second polygon objects for the polygon electronic fence includes: determining a reference number of polygon objects for the polygon electronic fence or the circumscribed polygon; calculating a ratio of the area of the circumscribed polygon to the coverage area corresponding to each preset GeoHash encoding bit number; determining a target GeoHash encoding bit number for which the difference between the ratio and the reference number of polygon objects is within a set range; constructing a plurality of polygon objects for the circumscribed polygon based on the accuracy corresponding to the target GeoHash encoding bit number and the reference number of polygon objects; and screening out the plurality of first polygon objects and the plurality of second polygon objects from the plurality of polygon objects.

[0023] Optionally, the positioning device includes that each of the first polygon objects and each of the second polygon objects are represented by a GeoHash encoding, where the GeoHash encoding is generated from the longitude and latitude of the vertices of the first polygon object or the second polygon object; the searching for a target polygon object that matches the location information of the target object includes: searching for a target GeoHash encoding that matches the GeoHash encoding included in the location information of the target object.

[0024] Optionally, the positioning device is further configured to: for each of the first polygon objects or each of the second polygon objects, perform: calculating the longitude and latitude of any vertex of the first polygon object or the second polygon object; obtaining the target GeoHash encoding bit number corresponding to the polygon object; and determining the GeoHash encoding corresponding to the first polygon object or the second polygon object based on the longitude and latitude of the any vertex and the target GeoHash encoding bit number.

[0025] Optionally, the positioning device for screening out the plurality of first polygon objects and the plurality of second polygon objects from the plurality of polygon objects includes:

[0026] For each polygon object, perform: comparing the first longitude and latitude of the lower left vertex and the second longitude and latitude of the upper right vertex of the polygon object with the minimum longitude and latitude and the maximum longitude and latitude of the polygon electronic fence; determining whether the polygon object is outside the range of the polygon electronic fence; and if so, deleting the polygon object.

[0027] Optionally, after determining that at least a part of the polygon object is within the range of the polygon electronic fence, the positioning device further includes: determining whether the polygon object intersects any side of the polygon electronic fence; if so, determining the polygon object as a second polygon object; otherwise, determining the polygon object as a first polygon object.

[0028] Optionally, the positioning device for determining the relative position of the target object and the polygon electronic fence includes: if the search result indicates that the target polygon object is found from the plurality of first polygon objects, determining that the target object is included in the polygon electronic fence; or, if the search result indicates that the target polygon object is found from the plurality of second polygon objects, determining that the target object is located at the edge of the polygon electronic fence; or, if the search result indicates that the target polygon object is not found, determining that the target object is outside the polygon electronic fence.

[0029] Optionally, determining that the target object is located at the edge of the polygon electronic fence further includes: using the longitude and latitude of the target object as a reference point, constructing a ray from the reference point to the polygon formed by the polygon electronic fence, and determining whether the target object is inside or outside the polygon electronic fence according to the number of intersection points of the ray and the polygon.

[0030] Optionally, the positioning device is used to process the target object based on the determined relative position.

[0031] To achieve the above object, according to the third aspect of the embodiments of the present invention, a positioning electronic device is provided, which is characterized by including: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods in the above positioning method.

[0032] To achieve the above object, according to the fourth aspect of the embodiments of the present invention, a computer-readable medium is provided, on which a computer program is stored, and the program is characterized in that when executed by a processor, it implements any of the methods in the above positioning method.

[0033] One embodiment of the above invention has the following advantages or beneficial effects: It can find a target polygon object that matches a target object from multiple first polygon objects located inside the polygon electronic fence corresponding to the polygon electronic fence and multiple second polygon objects circumscribing the edge of the polygon electronic fence; according to the search result, determine the relative position of the target object and the polygon electronic fence; use the constructed polygon electronic fence and the corresponding multiple polygon objects to determine the relative position of the target object and the polygon electronic fence, improving the accuracy of determining the relative position of the target object and the electronic fence and enhancing the efficiency of determining the relative position of the target object and the electronic fence.

[0034] The further effects of the above non-conventional optional methods will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:

[0036] Figure 1 is a schematic flowchart of a positioning method provided by an embodiment of the present invention;

[0037] Figure 2 is a schematic flowchart of a process for constructing polygon objects corresponding to a polygon electronic fence provided by an embodiment of the present invention;

[0038] Figure 3 is a schematic diagram of a method for determining the relative position of a target object provided by an embodiment of the present invention;

[0039] Figure 4 is a schematic diagram of constructing polygon objects for a polygon electronic fence provided by an embodiment of the present invention;

[0040] Figure 5 is a schematic structural diagram of a positioning device provided by an embodiment of the present invention;

[0041] Figure 6 is an exemplary system architecture diagram to which the embodiments of the present invention can be applied;

[0042] Figure 7 is a schematic structural diagram of a computer system of a terminal device or a server suitable for implementing the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0043] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, descriptions of well-known functions and structures are omitted in the following description for clarity and conciseness.

[0044] As Figure 1 shown, an embodiment of the present invention provides a positioning method, which may include the following steps:

[0045] Step S101: Determine the position information of the target object and any polygon electronic fence related to the target object, where the polygon electronic fence is constructed based on multiple position information; the polygon electronic fence corresponds to a plurality of first polygon objects located inside the polygon electronic fence and a plurality of second polygon objects circumscribing the edge of the polygon electronic fence.

[0046] Specifically, the target object is the object to be processed. The target object can be associated with multiple polygon electronic fences. Therefore, before determining the relative position between the target object and the polygon electronic fence, any polygon electronic fence related to the target object is determined; among them, the polygon electronic fence can be constructed according to different application scenarios. For example, if the polygon electronic fence indicates the scope related to logistics, the target object can be a transportation device for logistics; if the polygon electronic fence indicates the scope of shared transportation devices, the target object can be a shared transportation device.

[0047] Among them, the electronic fence refers to a virtual electronic fence, which is a virtual fence that defines an area (such as the parking and no-parking areas of Internet rental bicycles) through information means. For example, when an Internet rental bicycle enters or leaves the virtual fence, the enterprise operation platform can automatically perceive it. The polygon electronic fence is constructed based on multiple position information; the position information can be the longitude and latitude information of multiple points; the positions of multiple points can be set according to the application scenario.

[0048] Furthermore, the polygon electronic fence corresponds to a plurality of first polygon objects located inside the polygon electronic fence and a plurality of second polygon objects circumscribing the edge of the polygon electronic fence. Among them, the plurality of first polygon objects can form a first polygon object set; similarly, the plurality of second polygon objects can form a second polygon object set; so that when searching for data of the plurality of first polygon objects and the plurality of second polygon objects, set search can be performed to improve the positioning efficiency.

[0049] Constructing multiple first polygon objects and multiple second polygon objects for the polygon electronic fence improves the efficiency of finding the relative position relationship between the target object and the polygon electronic fence. The specific steps of constructing the polygon electronic fence and constructing multiple first polygon objects and multiple second polygon objects for the polygon electronic fence are the same as those of steps S201 - S204, which will not be elaborated here.

[0050] Step S102: Search for a target polygon object that matches the position information of the target object from the multiple first polygon objects or the multiple second polygon objects.

[0051] Specifically, each of the first polygon objects and each of the second polygon objects can be represented by a GeoHash code, where the GeoHash code is generated from the longitude and latitude of the vertices corresponding to the first polygon object or the second polygon object. In the present invention, the polygons in the first polygon object and the second polygon object are exemplified by rectangles. Among them, GeoHash is an address coding method. Using this method, two-dimensional spatial longitude and latitude data can be encoded into a string, and this string is used to indicate a region. Using the Geohash method to obtain the GeoHash code for positioning can greatly improve the positioning efficiency compared with directly using longitude and latitude for positioning.

[0052] Furthermore, the GeoHash code corresponding to the polygon object is generated based on the longitude and latitude corresponding to the vertices of the polygon object. Specifically, the longitude and latitude coordinates are converted into binary, and encoded using the base32 algorithm to form a string corresponding to the GeoHash code (for example: wx4g0ec1).

[0053] Furthermore, generate a GeoHash code for each first polygon object or second polygon object. Specifically, for each of the first polygon objects or each of the second polygon objects, perform: calculate the longitude and latitude of any vertex of the first polygon object or the second polygon object; obtain the number of digits of the target GeoHash code corresponding to the polygon object; based on the longitude and latitude of the any vertex and the number of digits of the target GeoHash code, determine the GeoHash code corresponding to the first polygon object or the second polygon object. It can be understood that in the schematic diagram shown in Figure 4 , when traversing each polygon object, taking the rectangular object as an example, the lower left vertex of the circumscribed rectangle can be used as the starting point. Therefore, any vertex of the polygon object can be the lower left vertex of each polygon object. Furthermore, the description of determining the number of digits of the target GeoHash code is the same as that of step S203, which will not be elaborated here.

[0054] Further, finding a target polygon object that matches the position information of the target object from the multiple first polygon objects or the multiple second polygon objects includes: finding a target GeoHash code that matches the GeoHash code included in the position information of the target object. The position information of the target object may include the longitude and latitude of the target object, and the GeoHash code generated based on the longitude and latitude. When finding the target GeoHash code that matches the GeoHash code, it may be a complete match or a partial match of the string corresponding to the GeoHash code. The number of digits of the GeoHash code is associated with the size of the range. The longer the number of digits of the GeoHash code, the smaller the range and the higher the precision.

[0055] Step S103: Determine the relative position of the target object and the polygon electronic fence according to the search result.

[0056] Specifically, the relative position of the target object and the polygon electronic fence may include: the target object is contained within the polygon electronic fence or is located outside the polygon electronic fence. Specifically, the relative position of the target object and the polygon electronic fence is determined by multiple first polygon objects located inside the polygon electronic fence and multiple second polygon objects circumscribing the edge of the polygon electronic fence.

[0057] That is, determining the relative position of the target object and the polygon electronic fence includes:

[0058] 1) If the search result indicates that the target polygon object is found from the multiple first polygon objects, determine that the target object is contained within the polygon electronic fence;

[0059] 2) If the search result indicates that the target polygon object is found from the multiple second polygon objects, determine that the target object is located at the edge of the polygon electronic fence. Specifically, according to the precision required by the scenario, it can be further calculated based on the longitude and latitude of the target object located at the edge of the polygon electronic fence, and according to the calculation result, it is determined whether the target object is contained within the polygon electronic fence or is located outside the polygon electronic fence. Specifically, the calculation method may be: using the longitude and latitude of the target object as a reference point, starting from the reference point, constructing a ray towards the polygon formed by the polygon electronic fence, and determining whether the target object is located within the polygon electronic fence or outside the polygon electronic fence according to the number of intersection points of the ray and the polygon. For example, if Figure 3As shown in the schematic diagram, if the reference point is outside the edge of the polygon, the number of intersection points between the ray constructed based on the reference point and the polygon is 2; if the reference point is inside the edge of the polygon, the number of intersection points between the ray constructed based on the reference point and the polygon is 1; that is, this method can be used to further determine whether the target object is inside or outside the polygon electronic fence.

[0060] 3) If the search result indicates that the target polygon object has not been searched, it is determined that the target object is outside the polygon electronic fence. That is, if the target polygon object matching the target object cannot be found in any of the multiple first polygon objects or multiple second polygon objects, it is determined that the target object is outside the polygon electronic fence.

[0061] Furthermore, based on the determined relative position, the target object is processed; specifically, according to the application scenario, the target object is processed based on the relative position; for example: when it is determined that the target object (logistics vehicle) is inside the polygon electronic fence within a set time range, it is determined that the logistics vehicle has successfully signed in; and a message indicating successful sign-in is sent to the client corresponding to the logistics vehicle; or: obtain each target object (such as a vehicle) located inside and / or on the edge of the polygon electronic fence, and send push messages (including: notification messages, warning messages, etc.) related to the range of the polygon electronic fence to the clients corresponding to each vehicle (i.e., the target object); or count the number of target objects inside the polygon electronic fence within a set time range, etc. The present invention does not limit the specific application scenario and the specific method for processing the target object.

[0062] As Figure 2 shown, an embodiment of the present invention provides a process for constructing a polygon object based on a polygon electronic fence, and this process may include the following steps:

[0063] Step S201: Construct the polygon electronic fence based on multiple position information, including: receiving a request for constructing a polygon electronic fence, where the request includes the longitude and latitude of multiple vertices; where the number of vertices is at least 3; based on the order of the multiple vertices, select two adjacent vertices; determine whether any other vertex among the multiple vertices except the selected two adjacent vertices is outside the straight line formed by the two adjacent vertices, and if so, construct the polygon electronic fence based on the order of the multiple vertices and the longitude and latitude of each vertex.

[0064] Specifically, the user determines the longitude and latitude of the vertices of the polygon electronic fence according to the application scenario and the range size of the electronic fence.

[0065] Further, a request for constructing a polygonal electronic fence is received, and the request includes the longitude and latitude of multiple vertices; wherein, the number of the vertices is at least 3; it can be understood that the number of the fixed points forming the polygon is at least 3; if it is determined that the number of the fixed points included in the request is less than 3, an exception message can be returned to the requester for constructing the electronic fence.

[0066] Further, after it is determined that the number of the fixed points included in the request is at least 3, the step of constructing a polygonal electronic fence is executed, that is, the polygonal electronic fence is constructed based on multiple position information; the specific steps are as follows: two vertices are sequentially selected based on the vertex order (that is, two adjacent vertices are selected based on the order of the multiple vertices), and it is determined whether other vertices are located on the straight line formed by the two vertices (that is, it is determined whether any other vertex except the two selected adjacent vertices among the multiple vertices is outside the straight line formed by the two adjacent vertices). If not, it is determined that a polygon can be formed based on the multiple vertices included in the request. Further, a polygonal electronic fence is sequentially formed based on each vertex; that is, the polygonal electronic fence is constructed based on the order of the multiple vertices and the longitude and latitude of each vertex. For example: As Figure 3 The shown polygon 300 is a schematic diagram of a polygon constructed based on 5 vertices, indicating the corresponding polygonal electronic fence. It can be understood that the number of vertices of the polygon and the longitude and latitude of the vertices are determined by the requester for creating the electronic fence, and the present invention does not limit the specific values of the number of vertices of the polygonal electronic fence and the longitude and latitude of the vertices.

[0067] Step S202: Obtain the longitude and latitude corresponding to each vertex of the vertices of the polygonal electronic fence; determine the minimum longitude, the maximum longitude, the minimum latitude, and the maximum latitude from the longitude and latitude of the multiple vertices; combine the minimum longitude, the maximum longitude, the minimum latitude, and the maximum latitude, and determine the longitude and latitude of multiple characteristic vertices according to the combination result; based on the longitude and latitude of the multiple characteristic vertices, construct a circumscribed polygon of the polygonal electronic fence; based on the circumscribed polygon, construct the multiple first polygon objects and the multiple second polygon objects for the polygonal electronic fence.

[0068] Specifically, after a polygon corresponding to the polygonal electronic fence is determined based on each vertex, a circumscribed polygon is constructed for the polygon; the method for constructing the circumscribed polygon is:

[0069] Obtain the longitude and latitude corresponding to each vertex, and determine the minimum longitude (e.g., denoted as minLon), the maximum longitude (e.g., denoted as maxLon), the minimum latitude (e.g., denoted as minLat), and the maximum latitude (e.g., denoted as maxLat) from the longitudes and latitudes of the multiple vertices. Further, combine the minimum longitude, the maximum longitude, the minimum latitude, and the maximum latitude. Taking the construction of a rectangle as an example, the result of the combination is that the longitude and latitude of the lower left vertex (i.e., the feature vertex) are (minLon, minLat). Similarly, the longitudes and latitudes of the other three vertices (i.e., the feature vertices) are (minLon, maxLat), (maxLon, maxLat), and (maxLon, minLat) respectively. Further, generate a multi-connected polygon, i.e., the circumscribed rectangle (e.g., the minimum circumscribed rectangle) based on these four vertices, that is, construct the circumscribed polygon of the polygon electronic fence based on the longitudes and latitudes of the multiple feature vertices. It can be understood that according to the result of the combination, the feature vertices can be outside the polygon corresponding to the electronic fence. Figure 4 The schematic diagram showing the polygon 401 and the corresponding minimum circumscribed rectangle 402 is shown.

[0070] Further, based on the circumscribed polygon, construct the multiple first polygon objects and the multiple second polygon objects for the polygon electronic fence. The method and steps for constructing the multiple first polygon objects and the multiple second polygon objects are the same as those described in step S203, and will not be elaborated here.

[0071] Step S203: Construct the multiple first polygon objects and the multiple second polygon objects for the polygon electronic fence, including: determining the reference number of polygon objects for the polygon electronic fence or the circumscribed polygon; calculating the ratio of the area of the circumscribed polygon to the coverage area corresponding to each preset GeoHash coding bit number; determining the target GeoHash coding bit number whose difference from the ratio and the reference number of polygon objects is within a set range; constructing multiple polygon objects for the circumscribed polygon based on the accuracy corresponding to the target GeoHash coding bit number and the reference number of polygon objects; and screening out the multiple first polygon objects and the multiple second polygon objects from the multiple polygon objects.

[0072] Specifically, the method for constructing the multiple first polygon objects and the multiple second polygon objects for the polygon electronic fence is as follows:

[0073] First, determine the reference number of polygon objects for the polygon electronic fence or the circumscribed polygon. Here, the reference number of polygon objects can be provided by the requester who constructs the electronic fence according to the geographical range of the polygon electronic fence, or determined based on the area of the circumscribed polygon and the performance of the computer running the construction of the electronic fence or positioning (it can be understood that the more the number of polygon objects, the higher the accuracy, the smaller the range, and the higher the requirements for the computing power and performance of the computer).

[0074] Secondly, calculate the ratio of the area of the circumscribed polygon to the coverage area corresponding to each preset GeoHash encoding digit; determine the target GeoHash encoding digit whose difference between the ratio and the reference number of polygon objects is within a set range; taking the polygon as a rectangle for example, where the coverage area corresponding to the GeoHash encoding digit is shown in Table 1. According to the information in Table 1, the higher the GeoHash encoding digit, the smaller the covered area, that is, the higher the accuracy.

[0075] Table 1

[0076] Number of coding bits 1 2 3 4 5 6 7 8 9 10 11 12 Width 5009.4 km 1252.3 km 156.5 km 39.1 km 4.9 km 1.2 km 152.9m 38.2m 4.8m 1.2m 14.9 cm 3.7 cm Length 4992.6 km 624.1 km 156 km 19.5 km 4.9 km 609.4m 152.4m 19m 4.8m 59.5 cm 14.9 cm 1.9 cm

[0077] Specifically, calculate the area S of the circumscribed polygon (such as a rectangle); obtain the coverage area GS corresponding to the GeoHash encoding digit as described in Table 1 i (i represents the number of digits of the GeoHash encoding, for example, from 1 digit to 12 digits in sequence, as shown in Table 1. Each encoding digit has a corresponding coverage area value, that is, the product of the width and length shown in Table 1, that is, GS i ); further calculate S / GS i value, that is, calculate the ratio of the area of the circumscribed polygon (such as a rectangle) to the coverage area corresponding to each preset GeoHash encoding digit; when the difference between the calculated ratio and the reference number is within a set range (such as: x square meters, etc.), the GeoHash encoding digit corresponding to this ratio is the target GeoHash encoding digit. For example: after calculation, when the encoding digit is 9, the ratio of S / GS i and the difference between the parameter number (such as 1000) is within the set range. Finally, based on the accuracy corresponding to the target GeoHash encoding digit and the reference number of polygon objects, construct multiple polygon objects for the circumscribed polygon; screen out the multiple first polygon objects and the multiple second polygon objects from the multiple polygon objects. Specifically, the accuracy corresponding to the target GeoHash encoding digit indicates the geographical range. Therefore, based on the accuracy combined with the reference number, construct multiple polygon objects (i.e., unit polygon objects associated with the circumscribed polygon) for the circumscribed polygon, such as Figure 4As shown in 403. It can be understood that the number of polygon objects constructed for the circumscribed polygon may not be consistent with the reference number of polygon objects.

[0078] Step S204: Screen out the plurality of first polygon objects and the plurality of second polygon objects from the plurality of polygon objects.

[0079] Specifically, Figure 4 The figure shows a schematic diagram of a plurality of polygon objects (taking rectangular objects as an example), as Figure 4 shown. The plurality of polygon objects constructed based on the circumscribed polygon (such as a circumscribed rectangle) can be located inside, on the edge, or outside the polygon electronic fence; therefore, for each polygon object, it is determined whether the polygon object belongs to the first polygon object set (located inside the polygon electronic fence) or the second polygon object set (located on the edge of the polygon electronic fence); the specific screening method is:

[0080] For each polygon object (such as a rectangular object), perform steps 1)-2):

[0081] 1) Compare the first longitude and latitude of the lower left vertex of the rectangular object, the second longitude and latitude corresponding to the upper right vertex, with the minimum longitude and latitude and the maximum longitude and latitude of the polygon electronic fence; determine whether the rectangular object is outside the range of the polygon electronic fence; if so, delete the rectangular object. Specifically, after determining that the rectangular object is outside the range of the polygon electronic fence, delete the rectangular object to further screen the first polygon object or the second polygon object.

[0082] 2) After determining that the rectangular object is at least partially within the range of the polygon electronic fence, it further includes: determining whether the rectangular object intersects any side of the polygon electronic fence; if so, determine the rectangular object as the second polygon object (i.e., circumscribing the edge of the polygon electronic fence); otherwise, determine the rectangular object as the first polygon object (i.e., located inside the polygon electronic fence).

[0083] That is, for each polygon object, perform: compare the first longitude and latitude of the lower left vertex of the polygon object, the second longitude and latitude corresponding to the upper right vertex, with the minimum longitude and latitude and the maximum longitude and latitude of the polygon electronic fence; determine whether the polygon object is outside the range of the polygon electronic fence; if so, delete the polygon object. After determining that the polygon object is at least partially within the range of the polygon electronic fence, it further includes: determining whether the polygon object intersects any side of the polygon electronic fence; if so, determine the polygon object as the second polygon object; otherwise, determine the polygon object as the first polygon object.

[0084] As Figure 4 shown, select the lower left rectangular object included in the circumscribed rectangle 402 as the screening starting point, and execute the steps of 1)-2) for each rectangular object.

[0085] As Figure 5 shown, an embodiment of the present invention provides a positioning device 500, including: an obtaining position module 501 and a determining position module 502; wherein,

[0086] The obtaining position module 501 is configured to determine the position information of a target object and any polygon electronic fence related to the target object, wherein the polygon electronic fence is constructed based on a plurality of position information; the polygon electronic fence corresponds to a plurality of first polygon objects located inside the polygon electronic fence and a plurality of second polygon objects circumscribing the edge of the polygon electronic fence;

[0087] The determining position module 502 is configured to find a target polygon object that matches the position information of the target object from the plurality of first polygon objects or the plurality of second polygon objects; and determine the relative position between the target object and the polygon electronic fence according to the search result.

[0088] An embodiment of the present invention also provides a positioning electronic device, including: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.

[0089] An embodiment of the present invention also provides a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the method provided in any of the above embodiments is implemented.

[0090] Figure 6 Illustrates an exemplary system architecture 600 to which the positioning method or positioning device of the embodiments of the present invention can be applied.

[0091] As Figure 6 shown, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 is used to provide a medium for a communication link between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0092] Users can use terminal devices 601, 602, and 603 to interact with server 605 via network 604 to receive or send messages, etc. Various client applications can be installed on terminal devices 601, 602, and 603, such as e-commerce client applications, logistics management applications, instant messaging tools, etc.

[0093] Terminal devices 601, 602, and 603 can be various electronic devices with a display screen and supporting various client applications, including but not limited to smartphones, tablets, laptop computers, and desktop computers, etc.

[0094] Server 605 can be a server providing various services, such as a background management server that supports the client applications used by users with terminal devices 601, 602, and 603. The background management server can process the received requests for positioning and managing target objects and feedback the relative positions of the target objects and the polygon electronic fence to the terminal devices.

[0095] It should be noted that the positioning method provided by the embodiments of the present invention is generally executed by server 605. Correspondingly, the positioning device is generally arranged in server 605.

[0096] It should be understood that Figure 6 the numbers of terminal devices, networks, and servers in

[0097] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. Figure 7 Shown below is a schematic structural diagram of a computer system 700 of a terminal device suitable for implementing the embodiments of the present invention with reference to Figure 7 The shown terminal device is merely an example and should not impose any limitation on the functions and usage scope of the embodiments of the present invention.

[0098] As Figure 7 shown, computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to the programs stored in the read-only memory (ROM) 702 or the programs loaded from the storage section 708 into the random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of system 700 are also stored. The CPU 701, ROM 702, and RAM 703 are connected to each other via a bus 704. The input / output (I / O) interface 705 is also connected to the bus 704.

[0099] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. as well as a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read out therefrom is installed into the storage section 708 as needed.

[0100] Specifically, according to the embodiments disclosed by the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed by the present invention include a computer program product which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network via the communication section 709, and / or installed from the removable medium 711. When the computer program is executed by a central processing unit (CPU) 701, the above functions defined in the system of the present invention are executed.

[0101] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present invention, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries the computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0102] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0103] The modules and / or units involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules and / or units can also be provided in a processor. For example, it can be described as: a processor includes a location acquisition module and a location determination module. Among them, the names of these modules do not constitute a limitation to the module itself in some cases. For example, the location determination module can also be described as "a module for determining the relative position of a target object and a polygon electronic fence".

[0104] As another aspect, the present invention also provides a computer-readable medium, which can be included in the device described in the above embodiments; or can exist alone without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by the device, the device includes: determining the location information of a target object and any polygon electronic fence related to the target object, where the polygon electronic fence is constructed based on a plurality of location information; the polygon electronic fence corresponds to a plurality of first polygon objects located inside the polygon electronic fence and a plurality of second polygon objects circumscribing the edge of the polygon electronic fence; searching for a target polygon object that matches the location information of the target object from the plurality of first polygon objects or the plurality of second polygon objects; and determining the relative position of the target object and the polygon electronic fence according to the search result.

[0105] The embodiments of the present invention can search for a target polygon object that matches a target object from a plurality of first polygon objects located inside the polygon electronic fence corresponding to the polygon electronic fence and a plurality of second polygon objects circumscribing the edge of the polygon electronic fence; determine the relative position of the target object and the polygon electronic fence according to the search result; and use the constructed polygon electronic fence and the corresponding plurality of polygon objects to determine the relative position of the target object and the polygon electronic fence, improving the accuracy of determining the relative position of the target object and the electronic fence and enhancing the efficiency of determining the relative position of the target object and the electronic fence.

[0106] The above specific embodiments do not constitute a limitation to the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A positioning method, characterized in that, Including: Determine the location information of a target object and any polygon electronic fence related to the target object, where the polygon electronic fence is constructed based on multiple location information; The polygon electronic fence corresponds to a plurality of first polygon objects located inside the polygon electronic fence and a plurality of second polygon objects circumscribing the edge of the polygon electronic fence; From the plurality of first polygon objects or the plurality of second polygon objects, find a target polygon object that matches the location information of the target object; Based on the search result, determine the relative position of the target object and the polygon electronic fence; The method further includes: After determining the polygon corresponding to the polygon electronic fence based on the vertices of the polygon electronic fence, construct a circumscribed polygon for the polygon; based on the circumscribed polygon, construct the plurality of first polygon objects and the plurality of second polygon objects for the polygon electronic fence, including: determining the reference number of polygon objects for the polygon electronic fence or the circumscribed polygon; calculating the ratio of the area of the circumscribed polygon to the coverage area corresponding to each preset GeoHash coding bit number; determining the target GeoHash coding bit number whose difference from the ratio and the reference number of polygon objects is within a set range; based on the accuracy corresponding to the target GeoHash coding bit number and the reference number of polygon objects, construct a plurality of polygon objects for the circumscribed polygon; and screening out the plurality of first polygon objects and the plurality of second polygon objects from the plurality of polygon objects.

2. The method according to claim 1, wherein: Constructing the polygon electronic fence based on multiple location information includes: Receive a request to construct a polygon electronic fence, the request including the longitude and latitude of the locations of multiple vertices; where the number of vertices is at least 3; Based on the order of the multiple vertices, select two adjacent vertices; Determine whether any other vertex among the multiple vertices except the two selected adjacent vertices is outside the straight line formed by the two adjacent vertices. If so, construct the polygon electronic fence based on the order of the multiple vertices and the longitude and latitude of each vertex.

3. The method according to claim 2, wherein Further including: Obtain the longitude and latitude corresponding to each vertex of the polygon electronic fence vertices; Determine the minimum longitude, maximum longitude, minimum latitude, and maximum latitude from the longitudes and latitudes of the multiple vertices; Combine the minimum longitude, the maximum longitude, the minimum latitude, and the maximum latitude, and based on the combined result, determine the longitude and latitude of multiple characteristic vertices; Based on the longitude and latitude of the multiple characteristic vertices, construct a circumscribed polygon of the polygon electronic fence; Based on the circumscribed polygon, construct the plurality of first polygon objects and the plurality of second polygon objects for the polygon electronic fence.

4. The method according to claim 1, wherein: Each of the first polygon objects and each of the second polygon objects is represented by a GeoHash code, where the GeoHash code is generated from the longitude and latitude of the vertices of the first polygon object or the second polygon object; The finding of the target polygon object that matches the location information of the target object includes: Finding a target GeoHash code that matches the GeoHash code included in the location information of the target object.

5. The method according to claim 4, characterized in that Further includes: For each of the first polygon objects or each of the second polygon objects, perform: Calculate the longitude and latitude of any vertex of the first polygon object or the second polygon object; Obtain the number of digits of the target GeoHash code corresponding to the polygon object; Based on the longitude and latitude of the any vertex and the number of digits of the target GeoHash code, generate the GeoHash code corresponding to the first polygon object or the second polygon object.

6. The method according to claim 1, characterized in that, The screening out of the multiple first polygon objects and the multiple second polygon objects from the multiple polygon objects includes: For each polygon object, perform: Compare the first longitude and latitude of the lower left vertex of the polygon object and the second longitude and latitude corresponding to the upper right vertex with the minimum longitude and latitude and the maximum longitude and latitude of the polygon electronic fence; determine whether the polygon object is outside the range of the polygon electronic fence; if so, delete the polygon object.

7. The method according to claim 6, wherein After determining that at least part of the polygon object is within the range of the polygon electronic fence, further includes: Determine whether the polygon object intersects any side of the polygon electronic fence; If so, determine the polygon object as a second polygon object; Otherwise, determine the polygon object as a first polygon object.

8. The method according to claim 1, wherein The determining of the relative position of the target object and the polygon electronic fence includes: If the search result indicates that the target polygon object is found from the multiple first polygon objects, determine that the target object is included in the polygon electronic fence; Or, If the search result indicates that the target polygon object is found from the multiple second polygon objects, determine that the target object is located on the edge of the polygon electronic fence; Or, If the search result indicates that the target polygon object is not found, determine that the target object is outside the polygon electronic fence.

9. The method according to claim 8, wherein The determining that the target object is located on the edge of the polygon electronic fence further includes: Using the longitude and latitude of the target object as a reference point, starting from the reference point, constructing a ray towards the polygon formed by the polygon electronic fence, and determining whether the target object is inside or outside the polygon electronic fence according to the number of intersection points of the ray and the polygon.

10. The method according to any one of claims 1-9, wherein Process the target object based on the determined relative position.

11. A positioning device, characterized in that, Includes: A location acquisition module and a location determination module; wherein, The location acquisition module is configured to determine the location information of a target object and any polygon electronic fence related to the target object, wherein the polygon electronic fence is constructed based on a plurality of location information; the polygon electronic fence corresponds to a plurality of first polygon objects located inside the polygon electronic fence and a plurality of second polygon objects circumscribing the edge of the polygon electronic fence; The location determination module is configured to find a target polygon object that matches the location information of the target object from the plurality of first polygon objects or the plurality of second polygon objects; and determine the relative position of the target object and the polygon electronic fence according to the search result; The device is further configured to, after determining the polygon corresponding to the polygon electronic fence based on each vertex of the polygon electronic fence, construct a circumscribed polygon for the polygon; and construct the plurality of first polygon objects and the plurality of second polygon objects for the polygon electronic fence based on the circumscribed polygon, including: determining a reference number of polygon objects for the polygon electronic fence or the circumscribed polygon; calculating a ratio of the area of the circumscribed polygon to the coverage area corresponding to each preset GeoHash coding bit number; determining a target GeoHash coding bit number for which the difference between the ratio and the reference number of polygon objects is within a set range; constructing a plurality of polygon objects for the circumscribed polygon based on the accuracy corresponding to the target GeoHash coding bit number and the reference number of polygon objects; and screening out the plurality of first polygon objects and the plurality of second polygon objects from the plurality of polygon objects.

12. An electronic device, characterized in that, Comprising: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-10.

13. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, the method according to any one of claims 1-10 is implemented.

Citation Information

Patent Citations

  • Parking lot vehicle monitoring method, device and terminal

    CN110189536A

  • Geofence event real-time monitoring method based on GeoHash

    CN111010666A

  • Positioning method and device for to-be-detected point

    CN113852914A