CN106446102B - Terminal positioning method and device based on map fence - Google Patents

Terminal positioning method and device based on map fence Download PDF

Info

Publication number
CN106446102B
CN106446102B CN201610822661.1A CN201610822661A CN106446102B CN 106446102 B CN106446102 B CN 106446102B CN 201610822661 A CN201610822661 A CN 201610822661A CN 106446102 B CN106446102 B CN 106446102B
Authority
CN
China
Prior art keywords
fence
terminal
node
map
position coordinates
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610822661.1A
Other languages
Chinese (zh)
Other versions
CN106446102A (en
Inventor
蔡畅奇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Credit Co Ltd
Original Assignee
Tencent Credit Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Credit Co Ltd filed Critical Tencent Credit Co Ltd
Priority to CN201610822661.1A priority Critical patent/CN106446102B/en
Publication of CN106446102A publication Critical patent/CN106446102A/en
Application granted granted Critical
Publication of CN106446102B publication Critical patent/CN106446102B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/29Geographical information databases

Abstract

The invention relates to a terminal positioning method and device based on a map fence, wherein the method comprises the following steps: acquiring position coordinates of the terminal at each time point; determining node searching paths in a node tree according to the position coordinates, wherein fence range information and fence identifications of different map fences are stored in each node of the node tree; searching a path comprising part of nodes in the node tree; searching nodes which store fence range information containing position coordinates according to the node searching path; extracting fence identification from the searched nodes; adding the extracted fence identification to a fence list corresponding to each time point; and positioning the terminal according to the fence list. According to the terminal positioning method and device based on the map fence, all nodes in the node tree do not need to be searched, a large amount of computing resources are avoided being consumed, the consumption of the computing resources is saved, the speed of searching the fence mark is increased, and the positioning efficiency of the terminal is improved.

Description

Terminal positioning method and device based on map fence
Technical Field
The invention relates to the technical field of data processing, in particular to a terminal positioning method and device based on a map fence.
Background
At present, application software is installed in a terminal, and some application software uploads the position information of the terminal to a server. And the server determines the accurate position of the terminal according to the preset information of the map fence and the position information of the terminal. In the currently adopted positioning mode, the map fence where the terminal is located is determined by calculating the distance between the position of the terminal and each map fence, so that the accurate position of the terminal is determined.
However, a large number of map fences are often set in an electronic map, a terminal uploads a large number of location information, and if the distance between a location corresponding to the location information and each map fence is required to be calculated for each location information, the terminal is located, and thus a large amount of computing resources are required to be consumed, and the efficiency of locating the terminal is low.
Disclosure of Invention
Therefore, it is necessary to provide a method and an apparatus for positioning a terminal based on a map fence, aiming at the problem of low efficiency of positioning the terminal.
A method for positioning a terminal based on a map fence, the method comprising:
acquiring position coordinates of the terminal at each time point;
determining nodes in a node tree to search a path according to the position coordinates, wherein fence range information and fence identifications of different map fences are stored in each node of the node tree; the search path comprises part of nodes in the node tree;
searching a node which stores fence range information containing the position coordinates according to the node searching path;
extracting fence identification from the searched nodes;
adding the extracted fence identification to a fence list corresponding to each time point;
and positioning the terminal according to the fence list.
A map fence-based terminal positioning device, the device comprising:
the position coordinate acquisition module is used for acquiring the position coordinates of the terminal at each time point;
the searching path determining module is used for determining a node searching path in a node tree according to the position coordinates, and fence range information and fence identifications of different map fences are stored in each node of the node tree; the search path comprises part of nodes in the node tree;
the node searching module is used for searching the nodes which store the fence range information containing the position coordinates according to the node searching path;
the fence identifier extraction module is used for extracting fence identifiers from the searched nodes;
the fence list adding module is used for adding the extracted fence identification to a fence list corresponding to each time point;
and the terminal positioning module is used for positioning the terminal according to the fence list.
According to the method and the device for positioning the terminal based on the map fence, after the position coordinates of the terminal at each time point are obtained, the node searching path in the node tree is determined according to the position coordinates, the node corresponding to the fence range information containing the position coordinates is searched according to the node searching path, and the searching path comprises part of the searching path in the node tree. The distance between the position coordinate and all the geographic fences is not required to be searched, the calculation of the distance between the position coordinate and all the geographic fences is avoided, a large amount of calculation resources are avoided being consumed, the fence identification is extracted from the searched node, the extracted fence identification is added into the fence list corresponding to each time point, the terminal is positioned according to the fence list, the consumption of the calculation resources is reduced, the speed of searching the fence identification is increased, and the positioning efficiency of the terminal is improved.
Drawings
FIG. 1 is a diagram of an exemplary application environment of a map fence based terminal positioning system;
FIG. 2 is a diagram illustrating an internal structure of a server in the map fence based terminal positioning system according to an embodiment;
fig. 3 is a schematic flowchart of a method for positioning a terminal based on a map fence according to an embodiment;
FIG. 4 is a flowchart illustrating the steps of position coordinate queue reading in one embodiment;
FIG. 5 is a schematic flow chart diagram illustrating the steps for adding location coordinates to a plurality of location coordinate queues, in one embodiment;
FIG. 6 is a flow diagram illustrating steps for determining a location change status of a terminal in one embodiment;
FIG. 7 is a flowchart illustrating the steps of pushing data in one embodiment;
FIG. 8 is a flowchart illustrating the steps of determining an identity tag in one embodiment;
FIG. 9 is a flowchart illustrating steps for building nodes in a node tree according to a newly created map fence in an embodiment;
FIG. 10 is a diagram illustrating the structural form of a node tree in one embodiment;
FIG. 11 is a block diagram of a map fence based terminal positioning device in one embodiment;
FIG. 12 is a block diagram showing the structure of a position coordinate acquisition module in one embodiment;
FIG. 13 is a block diagram of a terminal location module in one embodiment;
fig. 14 is a block diagram of a map fence based terminal positioning device according to another embodiment;
fig. 15 is a block diagram of a map fence based terminal positioning device according to yet another embodiment;
fig. 16 is a block diagram of a map fence-based terminal positioning device according to still another embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Fig. 1 is a diagram illustrating an application environment of a map fence-based terminal positioning system in an embodiment, where the map fence-based terminal positioning system includes a server 110 and a terminal 120, and the server 110 is connected to the terminal 120 through a network. The terminal 120 may be one or more terminals, and the terminal 120 may specifically be a mobile terminal, and the mobile terminal may specifically be at least one of a mobile phone, a tablet computer, a notebook computer, a smart watch, a Personal Digital Assistant (PDA), a network-enabled electronic reader, and the like.
As shown in fig. 2, in one embodiment, a server 110 for implementing a map fence-based terminal location method is provided, which includes a processor, an internal memory, a network interface, and a non-volatile storage medium connected by a system bus. Wherein the processor has a computing function and a function of controlling the operation of the server 110, the processor being configured to perform a map fence based terminal location method. The non-volatile storage medium stores an operating system, a database, and a map fence based terminal location device. The terminal positioning device based on the map fence is used for realizing a terminal positioning method based on the map fence. The network interface is for connecting to the terminal 120.
As shown in fig. 3, in a real-time example, a method for positioning a terminal based on a map fence is provided, and this embodiment is illustrated by applying the method to the server 110 of the map fence-based terminal positioning system in fig. 1. The method specifically comprises the following steps:
s302, position coordinates of the terminal at each time point are obtained.
Specifically, the terminal 120 acquires current position coordinates according to a preset interval time, and transmits the acquired position coordinates and the acquired time to the server 110, where the position coordinates specifically include longitude and latitude, and may further include altitude. The server 110 stores the received position coordinates and the acquisition time in correspondence.
In one embodiment, the terminal 120 installs an application, a user identifier is logged in the installed application, the terminal 120 periodically obtains a position coordinate of the terminal according to a preset interval time set in the application, the user identifier and the obtained position coordinate are sent to the server 110 through the application, and the server 110 correspondingly stores the user identifier and the position coordinate.
S304, determining nodes in the node tree to search paths according to the position coordinates, wherein fence range information and fence identifications of different map fences are stored in each node of the node tree, and the searched paths comprise part of nodes in the node tree.
Specifically, the server 110 obtains fence range information and fence identifiers of map fences, and constructs a node tree according to the obtained fence range information and fence identifiers of the map fences, each map fence has a corresponding node in the node tree, the node stores fence range information and fence identifiers of the map fence, the fence range information includes a fence center coordinate and a fence radius, and the fence center coordinate includes a longitude and a latitude, and may further include an altitude. The node tree may specifically be a K-D tree (K-dimensional tree), where the K-D tree is a binary tree in which nodes can store multidimensional data, for example, x represents a fence center longitude, y represents a fence center latitude, r represents a fence radius, id represents a fence identifier, data stored in nodes of the K-D tree is (x, y, r, id) 4-dimensional data, and the K-D tree is a balanced binary tree. R stored in the nodes is used for distinguishing map fences with the same fence center coordinates but different radiuses; the id stored in the node is used for distinguishing map fences with the same fence range information.
And comparing from the root node of the node tree, comparing the position coordinate of the terminal with the fence center coordinate stored in the node of the node tree, if the position coordinate is smaller than the fence center coordinate, comparing the left sub-node of the node, and if the position coordinate is larger than or equal to the fence center coordinate, comparing the right sub-node of the node until the compared node is a leaf node, and recording the compared nodes according to the comparison sequence to generate the node searching path. The search path includes a portion of the nodes in the node tree.
And S306, searching the nodes which store the fence range information containing the position coordinates according to the node searching path.
Specifically, after the node search path is determined, the server 110 sequentially extracts fence range information stored in the node according to the node search path, where the fence range information includes a fence center coordinate and a fence radius, calculates a geographic distance between the terminal position and the fence center according to the position coordinate and the fence center coordinate, compares whether the calculated geographic distance is smaller than the fence radius, and determines that the fence range information stored in the node includes the position coordinate, that is, the position coordinate is within the map fence range if the calculated geographic distance is smaller than the fence radius.
In one embodiment, the server 110 determines whether the fence range information stored in the node includes the position coordinate according to the position coordinate and the fence range information stored in the node in an order from the node arranged at the last of the node search path to the node arranged at the first of the node search path.
And S308, extracting fence identification from the searched nodes.
Specifically, after finding the node in which the fence range information including the position coordinates is stored, the server 110 further stores a fence identifier corresponding to the fence range information, and the server 110 extracts the fence identifier from the node, where the fence identifier may specifically be at least one of a fence number and a fence name.
And S310, adding the extracted fence identification to a fence list corresponding to each time point.
Specifically, after extracting the fence identifier, the server 110 establishes a fence list corresponding to the acquisition time of the position coordinate, and adds the extracted fence identifier to the fence list. And storing the fence list corresponding to the acquisition time of the position coordinates, storing one or more fence identifications in the fence list, wherein the fence range information corresponding to the stored fence identifications comprises the position coordinates corresponding to the acquisition time of the terminal.
And S312, positioning the terminal according to the fence list.
Specifically, after the fence identifier is added to the fence list corresponding to each time point, the server 110 determines a place name corresponding to the fence identifier stored in the fence list, and displays a place name corresponding to a map fence where the terminal is located.
In this embodiment, after the position coordinates of the terminal at each time point are obtained, a node search path in the node tree is determined according to the position coordinates, and a node corresponding to the fence range information including the position coordinates is searched according to the node search path, where the search path includes part of nodes in the node tree. The distance between the position coordinate and all the geographic fences is not required to be searched, the calculation of the distance between the position coordinate and all the geographic fences is avoided, a large amount of calculation resources are avoided being consumed, the fence identification is extracted from the searched node, the extracted fence identification is added into the fence list corresponding to each time point, the terminal is positioned according to the fence list, the consumption of the calculation resources is reduced, the speed of searching the fence identification is increased, and the positioning efficiency of the terminal is improved.
As shown in fig. 4, in an embodiment, the step S302 specifically includes a step of reading the position coordinate queue, where the step specifically includes the following steps:
s402, the receiving terminal periodically transmits the position coordinates of each time point.
Specifically, each terminal 120 is installed with an application, a user identifier is logged in the application, a preset time interval is set in the application, the terminal 120 periodically obtains its own position coordinate according to the preset time interval in the application, the terminal 120 records the obtained time and the user identifier logged in the application, and the terminal 120 simultaneously sends the obtained trial statement, the user identifier and the position coordinate to the server 110. For example, the content reported by each terminal is specifically shown in table one:
table one:
user identification Longitude (G) Latitude Altitude (H) level Obtaining time
100001 113.936561 22.552127 1000 2013-09-13 09:18:20
100001 113.936562 22.552136 1050 2013-09-13 09:18:21
100002 120.484557 30.090862 500 2013-09-13 09:18:20
100002 120.484559 30.090862 500 2013-09-13 09:18:21
S404, adding the received position coordinates to a position coordinate queue according to the time sequence.
Specifically, after receiving the position coordinates, the server 110 sorts the position coordinates according to the user identifier and the acquisition time, and adds the sorted position coordinates to the position coordinate queue.
In one embodiment, referring to fig. 5, the server 110 is provided with a plurality of position coordinate queues, that is, position coordinate queues 1-5, after receiving the position coordinates of each time point sent by each terminal, the server 110 divides the received position coordinates into a plurality of copies, and the number of copies of the position coordinates is equal to the number of the position coordinate queues. The server 110 may specifically segment the position coordinates according to the user identifier, and divide the position coordinates corresponding to the same user identifier into the same position coordinates, where the same position coordinates may include position coordinates corresponding to multiple user identifiers. The position coordinates in the same position coordinate are sorted according to the acquisition time, and specifically, the position coordinates corresponding to the same user identifier can be sorted according to the acquisition time. The server 110 adds the sorted multiple position coordinates to multiple position coordinate queues, each position coordinate corresponding to one position coordinate queue.
S406, reading the position coordinates from the position coordinate queue.
Specifically, the server 110 reads the position coordinates of the reading materials from the position coordinate queue by reading the position coordinate queue; the server 110 may also read the position coordinates according to the order of the acquisition time of the position coordinates in the position coordinate queue.
In one embodiment, there are multiple position coordinate queues, and the notification unit reads the position coordinates from the multiple position coordinate queues at the same time, and performs parallel processing on the position coordinates read at the same time.
In this embodiment, when receiving the position coordinates corresponding to each time point periodically sent by each terminal, the received position coordinates are added to the position coordinate queue, and the position coordinates are read from the position coordinate queue for processing, so that a situation of data congestion is avoided when the position coordinates sent by each terminal are processed, thereby improving the reading efficiency of the position coordinates, and further improving the positioning efficiency of the terminal.
As shown in fig. 6, in an embodiment, the step S312 further includes a step of determining a location change state of the terminal, where the step includes the following steps:
s602, extracting a first fence list corresponding to the terminal at the first time point and a second fence list corresponding to the terminal at the second time point.
Specifically, each time point is an acquisition time of the position coordinate, and after the server 110 generates a fence list corresponding to each acquisition time, the server 110 extracts fence lists corresponding to different acquisition times, that is, a first fence list corresponding to the first time point and a second fence list corresponding to the second time point.
S604, comparing the first fence list with the second fence list to obtain a comparison result.
Specifically, the first time point is earlier than the second time point, the fence identifiers in the first fence list and the second fence list are compared, the fence identifiers existing in the first fence list and not existing in the second fence list are determined, the fence identifiers existing in the first fence list and the second fence list are determined, and the determined fence identifiers and the relations between the determined fence identifiers and the first fence list and the second fence list are recorded to obtain a comparison result.
And S606, determining the position change state of the terminal between the first time point and the second time point according to the comparison result.
Specifically, the server 110 extracts fence identifiers that exist in the first fence list and do not exist in the second fence list in the comparison result, and marks these fence identifiers as fence identifiers of map fences that the terminal leaves from the first time point to the second time point; extracting fence identifications existing in the first fence list and the second fence list in the comparison result, and marking the fence identifications as fence identifications of stopped map fences; and extracting fence identifications which do not exist in the first fence list and exist in the second fence list in the comparison result, and marking the fence identifications as the fence identifications of the entered map fence. And determining the position change state of the terminal from the first time point to the second time point according to the state corresponding to each fence identifier and the place name corresponding to the fence identifier.
In this embodiment, the position state of the terminal between the first time point and the second time point is accurately determined according to the comparison result by comparing the first fence list corresponding to the first time point with the second fence list corresponding to the second time point.
As shown in fig. 7, in an embodiment, after S312, a step of pushing data is specifically included, where the step specifically includes the following:
s702, a fence identifier with a preset data push function is searched in a fence list.
Specifically, the server 110 determines, according to the fence list, a fence identifier of the map fence where the terminal 120 stays or enters, extracts the fence identifier of the map fence where the terminal stays, compares the extracted fence identifier with a fence identifier in the fence list with the preset data push function, and finds whether the extracted fence identifier has a fence identifier with the preset data push function.
S704, push data corresponding to the found fence identification is obtained.
S706, pushing the pushed data to the terminal.
Specifically, the server 110 finds a fence identifier with a preset data push function from fence identifiers of map fences entered by the terminal, obtains push data corresponding to the fence identifier from a database storing the push data, and sends the obtained push data to the terminal 120 entering the map fence corresponding to the fence identifier.
For example, the server 110 determines that the terminal 120 enters a map fence of a certain mall according to the fence list, the map fence of the certain mall is preset with a data pushing function, and the server 110 obtains advertisement data corresponding to a fence identifier of the map fence of the certain mall and pushes the advertisement data to the terminal 120 entering the map fence of the certain mall.
In this embodiment, the map fence where the terminal stays or is located is determined according to the fence identifier, and whether the map fence where the terminal stays or enters is preset with a data push function is determined, and when it is determined that the map fence where the terminal stays or enters is provided with the preset data push function, push data corresponding to the map fence is obtained, and the push data is accurately pushed to the terminal where the terminal stays or enters the map fence, so that a situation that network transmission resources are consumed by data generated by unnecessary data push is avoided.
As shown in fig. 8, in an embodiment, after S312, a step of determining an identity tag is further specifically included, where the step specifically includes the following steps:
and S802, counting the staying time of the terminal in the map fence corresponding to each fence mark according to the fence list.
Specifically, the server 110 obtains a fence list corresponding to each time point, and counts the retention time of the map fence corresponding to each fence identifier according to the fence list corresponding to each time point.
For example, if the fence list corresponding to the first time point and the fence list corresponding to the second time point both have fence identifiers, the first time point is adjacent to the second time point, and the first time point is earlier than the second time point, and the staying time of the terminal in the map fence corresponding to the fence identifier is a value obtained by subtracting the first time point from the second time point.
S804, acquiring the user identification of the terminal login.
And S806, determining the identity label corresponding to the user identification according to the counted stay time.
Specifically, a user identifier is logged in the terminal, and the user identifier logged in the terminal is obtained. After counting the retention time of the terminal on the map fence corresponding to each fence identifier, if the counted retention time exceeds the time threshold corresponding to the fence identifier, acquiring the identity tag corresponding to the fence identifier, and correspondingly storing the user identifier and the identity tag.
For example, in the counted stay time, the stay time of the terminal in the map fence corresponding to the restaurant exceeds a preset threshold corresponding to the fence identifier of the map fence, an identity identifier of a restaurant service worker is generated, and the identity identifier of the restaurant service worker and the identity identifier of the user logged in by the terminal are stored correspondingly.
In the embodiment, the stay time of the terminal on the map fence corresponding to each fence identifier is counted, the identity tag corresponding to the user identifier logged in by the terminal is determined according to the counted stay time, the identity of the user corresponding to the user identifier is accurately known through the identity tag corresponding to the user identifier, and the efficiency of user identity identification is improved.
As shown in fig. 9, in an embodiment, a method for positioning a terminal based on a map fence is provided, where the method further includes a step of establishing a node in a node tree according to a newly-built map fence, where the step includes the following steps:
s902, detecting whether the newly-built map fence exists on the electronic map.
Specifically, the server 110 records the detection time when detecting whether the electronic map has a newly-built map fence. The server 110 acquires the detection time closest to the current time, and detects whether there is a map fence created after the acquired detection time, and the map fence created after the acquired detection time is a newly created map fence. The server 110 may also periodically detect map fences in the electronic map, and detect whether new map fences exist on the electronic map.
In one embodiment, the map fence is established on the electronic map through the operation terminal, and after the map fence is established, the operation terminal sends a notification of establishing the map fence to the server.
And S904, acquiring the fence range information and the fence identification of the newly-built map fence when the newly-built map fence is detected.
And S906, establishing nodes in the node tree according to the acquired fence range information and the fence identification.
Specifically, when detecting a newly-built map fence, the server 110 obtains fence range information and a fence identifier of the newly-built map fence, uses the fence range information and the fence identifier as node confidence construction nodes, and inserts the construction nodes into a node tree. The fence range information comprises fence center coordinates and fence radius, the unit of the fence radius is meter, the fence center coordinates comprise fence center longitude and fence center latitude, and the fence range information, the fence identification and the fence creation time specific information of the map fence are shown in table two:
table two:
Figure BDA0001114059660000101
in this embodiment, when a newly-built map fence is detected, fence range information and a fence identifier of the newly-built map fence are acquired, a node is established in a node tree according to the acquired fence range information and the fence identifier, and the fence range information and the fence identifier are stored in sub-nodes, so that the real-time performance and the accuracy of the fence range information and the fence identifier of the map fence stored in the node tree are ensured.
In an embodiment, before S302, a step of constructing a node tree is further included, where the step specifically includes the following steps:
the server 110 constructs a node tree according to the fence range information and the fence identifier of the map fence, where the node tree is a K-D tree (K-dimensional tree), and constructs the K-D tree according to the fence range information and the fence identifier of the map fence, where the fence range information includes a fence center longitude, a fence center latitude, and a fence radius.
For example, the server 110 constructs a K-D tree according to the information of the fence list, and part of the code is as follows:
double[]node={fenceInfo.getLongitude(),fenceInfo.getLattitude(),fenceInfo.getRadius(),fenceInfo.getId()};
and constructing nodes of the K-D tree according to the center longitude of the fence, the center latitude of the fence, the radius of the fence and the fence identification, and inserting the nodes into the K-D tree.
The format of the K-D tree constructed by the server 110 is shown in FIG. 10, where (x)1,y1,r1,id1)、(x2,y2,r2,id2)、(x3,y3,r3,id3)、(x4,y4,r4,id4)、(x5,y5,r5,id5)(x6,y6,r6,id6)(x7,y7,r7,id7)7 nodes of a K-D tree, where x1、x2、x3、x4、x5、x6And x7Fence center longitude, y, representing 7 map fences, respectively1、y2、y3、y4、y5、y6And y7Fence center latitude, r, representing 7 map fences, respectively1、r2、r3、r4、r5、r6And r7Fence radius, id, representing 7 map fences, respectively1、id2、id3、id4、id5、id6And id7Fence identifications representing 7 map fences, respectively.
If the longitude of the acquired position coordinate of the terminal is x, the server 1108Latitude of position coordinate is y8According to the position coordinates (x) of the terminal8,y80,0) determining a node search path in the K-D tree constructed in fig. 10, specifically by comparing the position coordinates of the terminal with the fence range information of the map fence stored by the node, and determining the number of dimensions of the compared data according to the number of layers where the node is located, i.e., comparing the first-dimensional data at the first layer, the second-dimensional data at the second layer, the third-dimensional data at the third layer, the fourth-dimensional data at the fourth layer, and comparing the first-dimensional data at the fifth layer in a sequential cycle.
For example, starting from the root node, the first dimension data x in the position coordinates is first determined8And root node (x)1,y1,r1,id1) First dimension data x in (1)1By comparison, if x8<x1Then node (x)2,y2,r2,id2) Adding the data into the node searching path, and then adding the second-dimensional data y in the position coordinates8And node (x)2,y2,r2,id2) Second-dimension data y in (1)2By comparison, if y8≥y2Then node (x)4,y4,r4,id4) Adding to the node search path, position coordinates (x) for the terminal8,y80,0) node lookup path is (x)1,y1,r1,id1)→(x2,y2,r2,id2)→(x4,y4,r4,id4)。
The server 110 searches the nodes storing the fence range information containing the position coordinates in the K-D tree according to the determined node search path, and part of search codes are as follows:
Figure BDA0001114059660000121
wherein double [ ] a stores fence range information of the map fence, lng1, lat1, and rad1 represent fence center longitude, fence center latitude, and fence radius of the map fence, respectively; the position coordinates of the terminal are stored in double [ ] b, the longitude and the latitude of the position coordinates of the terminal are respectively represented by long 2 and lat2, the geographical distance between the position of the terminal and the center of the fence is calculated, the fence radius is subtracted from the geographical distance, if the obtained value is less than or equal to 0, the position coordinates of the terminal are determined to be in the fence range, and if the obtained value is greater than 0, the position coordinates of the terminal are determined not to be in the fence range.
For example, the calculation formula for calculating the geographic distance between two points P (a, b), Q (m, n) is as follows:
Figure BDA0001114059660000122
where a and m are longitudes, b and n are latitudes, and R is the radius of the earth.
As shown in fig. 11, in an embodiment, a terminal positioning apparatus 1100 based on a map fence is provided, which specifically includes: a location coordinate obtaining module 1102, a search path determining module 1104, a node searching module 1106, a fence identifier extracting module 1108, a fence list adding module 1110 and a terminal positioning module 1112.
A location coordinate obtaining module 1102, configured to obtain location coordinates of the terminal at each time point.
And the search path determining module 1104 is configured to determine a node search path in a node tree according to the position coordinates, where fence range information and fence identifiers of different map fences are stored in each node of the node tree, and the search path includes part of nodes in the node tree.
The node searching module 1106 is configured to search a node storing the fence range information including the position coordinates according to the node searching path.
A fence identifier extracting module 1108, configured to extract a fence identifier from the found node;
a fence list adding module 1110, configured to add the extracted fence identifier to a fence list corresponding to each time point.
And a terminal positioning module 1112, configured to position the terminal according to the fence list.
In this embodiment, after the position coordinates of the terminal at each time point are obtained, the node search path in the node tree is determined according to the position coordinates, and the node corresponding to the fence range information including the position coordinates is searched according to the node search path. The distance between the position coordinate and all the geographic fences is not required to be searched, the calculation of the distance between the position coordinate and all the geographic fences is avoided, a large amount of calculation resources are avoided being consumed, the fence identification is extracted from the searched node, the extracted fence identification is added into the fence list corresponding to each time point, the terminal is positioned according to the fence list, the consumption of the calculation resources is reduced, the speed of searching the fence identification is increased, and the positioning efficiency of the terminal is improved.
As shown in fig. 12, in an embodiment, the position coordinate obtaining module 1102 specifically includes: a position coordinate receiving module 1102a, a position coordinate adding module 1102b, and a position coordinate reading module 1102 c.
A position coordinate receiving module 1102a, configured to receive the position coordinates of each time point periodically transmitted by each terminal.
A position coordinate adding module 1102b, configured to add the received position coordinates to the position coordinate queue in time order.
And a position coordinate reading module 1102c, configured to read the position coordinates from the position coordinate queue.
In one embodiment, the position coordinate adding module 1102b further includes: the device comprises a position coordinate dividing module and a position queue adding module.
And the position coordinate dividing module is used for dividing the received position coordinates into a plurality of parts, and the number of the parts of the position coordinates is equal to that of the position coordinate queues.
And the position queue adding module is used for respectively adding the position coordinates into the position coordinate queues according to the time sequence.
The position coordinate reading module 1102c is also configured to read position coordinates from a plurality of position coordinate queues at the same time.
In this embodiment, when receiving the position coordinates corresponding to each time point periodically sent by each terminal, the received position coordinates are added to the position coordinate queue, and the position coordinates are read from the position coordinate queue for processing, so that a situation of data congestion is avoided when the position coordinates sent by each terminal are processed, thereby improving the reading efficiency of the position coordinates, and further improving the positioning efficiency of the terminal.
As shown in fig. 13, in an embodiment, the terminal positioning module 1112 specifically includes: a fence list extraction module 1112a, a comparison result obtaining module 1112b, and a location change determination module 1112 c.
The fence list extracting module 1112a is configured to extract a first fence list corresponding to the terminal at the first time point and a second fence list corresponding to the terminal at the second time point.
A comparison result obtaining module 1112b, configured to compare the first fence list and the second fence list to obtain a comparison result.
A position change determining module 1112c, configured to determine a position change state of the terminal between the first time point and the second time point according to the comparison result.
In this embodiment, the position state of the terminal between the first time point and the second time point is accurately determined according to the comparison result by comparing the first fence list corresponding to the first time point with the second fence list corresponding to the second time point.
As shown in fig. 14, in an embodiment, a terminal positioning apparatus 1100 based on a map fence is provided, which further includes: a fence identity lookup module 1114, a push data acquisition module 1116, and a data push module 1118.
The fence identifier searching module 1114 is configured to search a fence identifier with a preset data pushing function in the fence list.
A pushed data obtaining module 1116, configured to obtain pushed data corresponding to the found fence identifier;
the data pushing module 1118 is configured to push the pushed data to the terminal.
In this embodiment, the map fence where the terminal stays or is located is determined according to the fence identifier, and whether the map fence where the terminal stays or enters is preset with a data push function is determined, and when it is determined that the map fence where the terminal stays or enters is provided with the preset data push function, push data corresponding to the map fence is obtained, and the push data is accurately pushed to the terminal where the terminal stays or enters the map fence, so that a situation that network transmission resources are consumed by data generated by unnecessary data push is avoided.
As shown in fig. 15, in an embodiment, a terminal positioning apparatus 1100 based on a map fence is provided, which further includes: a dwell time statistics module 1120, a subscriber identity acquisition module 1122, and an identity tag determination module 1124.
And the dwell time counting module 1120 is configured to count, according to the fence list, the dwell time of the terminal on the map fence corresponding to each fence identifier.
A user identifier obtaining module 1122, configured to obtain a user identifier for terminal login;
an identity tag determining module 1124 configured to determine an identity tag corresponding to the user identifier according to the counted staying time.
In the embodiment, the stay time of the terminal on the map fence corresponding to each fence identifier is counted, the identity tag corresponding to the user identifier logged in by the terminal is determined according to the counted stay time, the identity of the user corresponding to the user identifier is accurately known through the identity tag corresponding to the user identifier, and the efficiency of user identity identification is improved.
As shown in fig. 16, in an embodiment, a terminal positioning apparatus 1100 based on a map fence is provided, which further includes: a map fence detection module 1126, a fence information acquisition module 1128, and a node establishment module 1130.
The map fence detection module 1126 is configured to detect whether a newly-built map fence exists on the electronic map.
The fence information obtaining module 1128 is configured to, when detecting a new map fence, obtain fence range information and a fence identifier of the new map fence.
The node establishing module 1130 is configured to establish a node in the node tree according to the acquired fence range information and the fence identifier.
In this embodiment, when a newly-built map fence is detected, fence range information and a fence identifier of the newly-built map fence are acquired, a node is established in a node tree according to the acquired fence range information and the fence identifier, and the fence range information and the fence identifier are stored in sub-nodes, so that the real-time performance and the accuracy of the fence range information and the fence identifier of the map fence stored in the node tree are ensured.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), or the like.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (16)

1. A method for positioning a terminal based on a map fence, the method comprising:
acquiring position coordinates of the terminal at each time point;
determining nodes in a node tree to search a path according to the position coordinates, wherein fence range information and fence identifications of different map fences are stored in each node of the node tree; the node searching path comprises part of nodes in the node tree; the node tree is a balanced binary tree used for storing multidimensional data in the nodes; the fence range information comprises fence center coordinates and fence radius; the fence radius is used for distinguishing map fences with the same fence center coordinates but different fence radii; the fence mark is used for distinguishing map fences with the same fence range information; the dimension of the position coordinate is the same as the dimension of the data stored in the node; the node search path is determined by comparing the position coordinates with fence range information stored by nodes in the node tree; when the position coordinates are compared with fence range information stored by nodes in the node tree, data of one dimension are compared layer by layer according to the node tree, and the dimension of the compared data is determined according to the number of layers of the compared nodes;
sequentially extracting fence range information stored in the nodes according to the node searching path;
when the geographic distance between the position coordinate and the fence center coordinate of the extracted fence range information is smaller than the fence radius of the extracted fence range information, searching for a node in which the fence range information containing the position coordinate is stored;
extracting fence identification from the searched nodes;
adding the extracted fence identification to a fence list corresponding to each time point;
and positioning the terminal according to the fence list.
2. The method of claim 1, wherein the obtaining the position coordinates of the terminal at each time point comprises:
receiving position coordinates of each time point periodically transmitted by each terminal;
adding the received position coordinates to a position coordinate queue according to a time sequence;
and reading the position coordinates from the position coordinate queue.
3. The method of claim 2, wherein adding the received position coordinates to a position coordinates queue in chronological order comprises:
dividing the received position coordinates into a plurality of parts, wherein the number of the parts of the position coordinates is equal to the number of the position coordinate queues;
adding the position coordinates into a plurality of position coordinate queues respectively according to the time sequence;
the obtaining of the position coordinates from the position coordinate queue includes:
and simultaneously reading the position coordinates from the plurality of position coordinate queues.
4. The method of claim 1, wherein the locating the terminal according to the fence list comprises:
extracting a first fence list corresponding to the terminal at a first time point and a second fence list corresponding to the terminal at a second time point;
comparing the first fence list with the second fence list to obtain a comparison result;
and determining the position change state of the terminal between the first time point and the second time point according to the comparison result.
5. The method of claim 1, wherein after locating the terminal according to the fence list, further comprising:
searching a fence identifier with a preset data push function in the fence list;
acquiring push data corresponding to the searched fence identifier;
and pushing the pushed data to the terminal.
6. The method of claim 1, wherein after locating the terminal according to the fence list, further comprising:
counting the staying time of the terminal in the map fence corresponding to each fence identification according to the fence list;
acquiring a user identifier of the terminal login;
and determining the identity label corresponding to the user identification according to the counted retention time.
7. The method of claim 1, further comprising:
detecting whether a newly-built map fence exists on the electronic map;
if so, acquiring the fence range information and the fence identification of the newly-built map fence;
and establishing nodes in the node tree according to the acquired fence range information and the fence identification.
8. A map fence-based terminal positioning device, the device comprising:
the position coordinate acquisition module is used for acquiring the position coordinates of the terminal at each time point;
the searching path determining module is used for determining a node searching path in a node tree according to the position coordinates, and fence range information and fence identifications of different map fences are stored in each node of the node tree; the node searching path comprises a part of paths in a node tree; the node tree is a balanced binary tree with nodes used for storing multidimensional data; the fence range information comprises fence center coordinates and fence radius; the fence radius is used for distinguishing map fences with the same fence center coordinates but different fence radii; the fence mark is used for distinguishing map fences with the same fence range information; the dimension of the position coordinate is the same as the dimension of the data stored in the node; the node search path is determined by comparing the position coordinates with fence range information stored by nodes in the node tree; when the position coordinates are compared with fence range information stored by nodes in the node tree, data of one dimension are compared layer by layer according to the node tree, and the dimension of the compared data is determined according to the number of layers of the compared nodes;
the node searching module is used for sequentially extracting fence range information stored in the nodes according to the node searching path; when the geographic distance between the position coordinate and the fence center coordinate of the extracted fence range information is smaller than the fence radius of the extracted fence range information, searching for a node in which the fence range information containing the position coordinate is stored;
the fence identifier extraction module is used for extracting fence identifiers from the searched nodes;
the fence list adding module is used for adding the extracted fence identification to a fence list corresponding to each time point;
and the terminal positioning module is used for positioning the terminal according to the fence list.
9. The apparatus of claim 8, wherein the position coordinate acquisition module comprises:
the position coordinate receiving module is used for receiving the position coordinates of each time point periodically transmitted by each terminal;
the position coordinate adding module is used for adding the received position coordinates into the position coordinate queue according to the time sequence;
and the position coordinate reading module is used for reading the position coordinates from the position coordinate queue.
10. The apparatus of claim 9, wherein the location coordinate adding module comprises:
the position coordinate dividing module is used for dividing the received position coordinates into a plurality of parts, and the number of the parts of the position coordinates is equal to that of the position coordinate queues;
the position queue adding module is used for respectively adding each position coordinate to a plurality of position coordinate queues according to the time sequence;
the position coordinate reading module is also used for simultaneously reading the position coordinates from the position coordinate queues.
11. The apparatus of claim 8, wherein the terminal location module comprises:
the fence list extraction module is used for extracting a first fence list corresponding to the terminal at a first time point and a second fence list corresponding to the terminal at a second time point;
a comparison result obtaining module, configured to compare the first fence list with the second fence list to obtain a comparison result;
and the position change determining module is used for determining the position change state of the terminal between the first time point and the second time point according to the comparison result.
12. The apparatus of claim 8, further comprising:
the fence identifier searching module is used for searching a fence identifier with a preset data pushing function in the fence list;
the push data acquisition module is used for acquiring push data corresponding to the searched fence identifier;
and the data pushing module is used for pushing the pushed data to the terminal.
13. The apparatus of claim 8, further comprising:
the dwell time counting module is used for counting the dwell time of the terminal on the map fence corresponding to each fence identifier according to the fence list;
the user identifier acquisition module is used for acquiring the user identifier of the terminal login;
and the identity label determining module is used for determining the identity label corresponding to the user identifier according to the counted retention time.
14. The apparatus of claim 8, further comprising:
the map fence detection module is used for detecting whether a newly-built map fence exists on the electronic map;
the fence information acquisition module is used for acquiring fence range information and fence identification of the newly-built map fence when the newly-built map fence is detected;
and the node establishing module is used for establishing nodes in the node tree according to the acquired fence range information and the fence identification.
15. A server comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any one of claims 1 to 7 when executing the computer program.
16. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN201610822661.1A 2016-09-13 2016-09-13 Terminal positioning method and device based on map fence Active CN106446102B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610822661.1A CN106446102B (en) 2016-09-13 2016-09-13 Terminal positioning method and device based on map fence

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610822661.1A CN106446102B (en) 2016-09-13 2016-09-13 Terminal positioning method and device based on map fence

Publications (2)

Publication Number Publication Date
CN106446102A CN106446102A (en) 2017-02-22
CN106446102B true CN106446102B (en) 2020-11-03

Family

ID=58168036

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610822661.1A Active CN106446102B (en) 2016-09-13 2016-09-13 Terminal positioning method and device based on map fence

Country Status (1)

Country Link
CN (1) CN106446102B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10397395B2 (en) * 2017-05-17 2019-08-27 Microsoft Technology Licensing, Llc Departure or entry intent-based reminders
CN113829353B (en) * 2021-06-07 2023-06-13 深圳市普渡科技有限公司 Robot, map construction method, apparatus and storage medium
CN115544188A (en) * 2021-06-30 2022-12-30 格步计程车控股私人有限公司 Method for labeling map data for vehicle navigation
CN114415492B (en) * 2021-12-08 2023-12-08 深圳优美创新科技有限公司 Method, terminal and storage medium for acquiring time in offline state

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104077416A (en) * 2014-07-17 2014-10-01 中国科学院微电子研究所 Data processing method and data searching method and system
CN105191361A (en) * 2013-02-22 2015-12-23 英特尔公司 Geo-fence notification management
CN105338492A (en) * 2015-11-18 2016-02-17 南京大学 Intelligent electronic tourist guide system based on geographic fencing technology

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9986375B2 (en) * 2014-02-12 2018-05-29 Google Llc Energy-efficient location determination

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105191361A (en) * 2013-02-22 2015-12-23 英特尔公司 Geo-fence notification management
CN104077416A (en) * 2014-07-17 2014-10-01 中国科学院微电子研究所 Data processing method and data searching method and system
CN105338492A (en) * 2015-11-18 2016-02-17 南京大学 Intelligent electronic tourist guide system based on geographic fencing technology

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于用户行为模型的客流量分析与预测;程求江 等;《计算机系统应用》;20150315;第24卷(第3期);第275-279页 *

Also Published As

Publication number Publication date
CN106446102A (en) 2017-02-22

Similar Documents

Publication Publication Date Title
CN107798557B (en) Electronic device, service place recommendation method based on LBS data and storage medium
CN106446102B (en) Terminal positioning method and device based on map fence
CN108304423B (en) Information identification method and device
CN106778876B (en) User classification method and system based on mobile user track similarity
Ma et al. Transit smart card data mining for passenger origin information extraction
CN104080054B (en) A kind of acquisition methods and device of exception point of interest
CN104050196A (en) Point of interest (POI) data redundancy detection method and device
CN109885643B (en) Position prediction method based on semantic track and storage medium
CN111967387A (en) Form recognition method, device, equipment and computer readable storage medium
CN108376141B (en) Indoor fingerprint database construction method, device, equipment and storage medium
CN111382212B (en) Associated address acquisition method and device, electronic equipment and storage medium
CN112069276A (en) Address coding method and device, computer equipment and computer readable storage medium
CN110263840B (en) Line analysis method, device, program product and storage medium
CN111209317A (en) Knowledge graph abnormal community detection method and device
WO2018010693A1 (en) Method and apparatus for identifying information from rogue base station
CN107133689B (en) Position marking method
CN106301979B (en) Method and system for detecting abnormal channel
WO2018033052A1 (en) Method and system for evaluating user portrait data
WO2017000817A1 (en) Method and device for acquiring matching relationship between data
CN111132027B (en) Scene recognition network graph drawing method, scene recognition method and device
CN116127337B (en) Risk mining method, device, storage medium and equipment based on position and image
CN115185939B (en) Data processing method of multi-source data
KR101680983B1 (en) Method for detecting boundary line of point-of-interest and apparatus for performing the method
US11821748B2 (en) Processing apparatus and method for determining road names
JP6169471B2 (en) Residence position estimation device and residence position estimation method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant