CN110769369B - Position determination method, determination device, server, and computer-readable storage medium - Google Patents

Position determination method, determination device, server, and computer-readable storage medium Download PDF

Info

Publication number
CN110769369B
CN110769369B CN201811634798.XA CN201811634798A CN110769369B CN 110769369 B CN110769369 B CN 110769369B CN 201811634798 A CN201811634798 A CN 201811634798A CN 110769369 B CN110769369 B CN 110769369B
Authority
CN
China
Prior art keywords
grid
boundary
detected
geo
fence
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
CN201811634798.XA
Other languages
Chinese (zh)
Other versions
CN110769369A (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.)
Beijing Didi Infinity Technology and Development Co Ltd
Original Assignee
Beijing Didi Infinity Technology and Development 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 Beijing Didi Infinity Technology and Development Co Ltd filed Critical Beijing Didi Infinity Technology and Development Co Ltd
Priority to CN201811634798.XA priority Critical patent/CN110769369B/en
Publication of CN110769369A publication Critical patent/CN110769369A/en
Application granted granted Critical
Publication of CN110769369B publication Critical patent/CN110769369B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/02Services making use of location information
    • H04W4/021Services related to particular areas, e.g. point of interest [POI] services, venue services or geofences

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a geo-fence based position determination method, a geo-fence based position determination device, a server and a computer readable storage medium, wherein the geo-fence based position determination method comprises the following steps: establishing a grid index specifying a geofence, the grid index including an internal grid within the geofence and a boundary grid intersecting a boundary of the geofence; judging whether the position point to be detected is in the grid index of the geo-fence or not; when the position point to be detected is judged to be in the grid index, detecting that the grid index belongs to the internal grid or the boundary grid; when the grid index is detected to belong to the boundary grid, constructing a local polygon of the boundary grid; and determining the local position relation between the position point to be detected and the local polygon so as to determine the position relation between the position point to be detected and the geo-fence according to the local position relation. According to the technical scheme, the efficiency of judging the position of the position point to be detected is effectively improved, and the accuracy of position judgment is ensured.

Description

Position determination method, determination device, server, and computer-readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a geo-fence based position determination method, a geo-fence based position determination apparatus, a server, and a computer-readable storage medium.
Background
The method is characterized in that the geography fences (namely a group of longitude and latitude coordinate pairs with closed heads and tails) are adopted to divide the cities or the areas, and when the network taxi appointment operation is carried out, different operation strategies can be adopted based on the geography fences of the specific cities or the areas, so that how to efficiently judge whether a certain point is in the fence or not becomes a technical problem to be solved urgently.
In the related art, the position relationship between the point and the geo-fence can be determined based on the conventional ray method, but the following defects exist:
when the boundary points of the geo-fence are increased, the efficiency is reduced by adopting ray method for judgment.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art or the related art.
To this end, it is an object of the present invention to provide a geo-fence based location determination method.
It is another object of the present invention to provide a geo-fence based location determination apparatus.
It is yet another object of the present invention to provide a server.
It is yet another object of the present invention to provide a computer-readable storage medium.
In order to achieve the above object, a first aspect of the present invention provides a location determination method based on a geo-fence, including: establishing a grid index specifying a geofence, the grid index including an internal grid within the geofence and a boundary grid intersecting a boundary of the geofence; judging whether the position point to be detected is in the grid index of the geo-fence or not; when the position point to be detected is judged to be in the grid index, detecting that the grid index belongs to the internal grid or the boundary grid; when the grid index is detected to belong to the boundary grid, constructing a local polygon of the boundary grid; and determining the local position relation between the position point to be detected and the local polygon so as to determine the position relation between the position point to be detected and the geo-fence according to the local position relation.
In the technical scheme, firstly, a grid index of a designated geo-fence is established, the grid index comprises an internal grid in the geo-fence and a boundary grid intersected with the boundary of the geo-fence, whether a position point to be detected is in the network index of the geo-fence or not is judged, when the position point to be detected is judged to be in the grid index, whether the grid index in which the position point to be detected is located belongs to the internal grid or the boundary grid is further detected, when the grid index in which the position point to be detected is located is detected to belong to the boundary grid, because the boundary grid is intersected with the geo-fence, when the position point to be detected is located in the boundary grid, the position point to be detected cannot be determined to be located in the geo-fence, a local polygon of the boundary network is constructed, and then the local position relation between the position point to be detected and the, the method and the device have the advantages that the position relation between the position point to be detected and the geo-fence is determined according to the local position relation, whether the position point to be detected in the boundary grid is located in the geo-fence or not is judged by constructing the local polygon of the boundary grid, the efficiency of position judgment of the position point to be detected is effectively improved, and the accuracy of position judgment is guaranteed.
Specifically, assuming that the fence is an n-polygon and includes m boundary grids, and the position points to be detected uniformly fall in the fence, when the position relationship between the ray method detection point and the geo-fence in the prior art is simply adopted, the detection efficiency is o (n), where o (n) represents the complexity of the detection (determination) process, and the larger the n value is, the higher the complexity is, that is, the lower the efficiency is.
When the position judgment method is adopted, the detection efficiency of the non-boundary grid with the position point to be detected falling in the geo-fence is judged to be O (1), and map [ fence ] is directly inquired][ lattice List]When the position point to be detected falls in the boundary grid, the number of the edges of the local polygon is
Figure GDA0002564353070000022
When the ray method is adopted again for detection, the detection efficiency is
Figure GDA0002564353070000021
The operation of the ray method is accelerated, and the detection efficiency of the position point to be detected is improved.
In the above technical solution, preferably, the establishing a grid index of a designated geo-fence specifically includes the following steps: performing interpolation operation on boundary points of the geo-fence to obtain a one-dimensional boundary grid list and a hub grid, wherein the hub grid is a grid with two lines inserted simultaneously in the interpolation operation; separating the one-dimensional boundary grid list by taking the pivot grid as an axis to form a boundary grid matrix; performing cross-surface segmentation operation on the boundary grid matrix by using a tangent plane formed by edges of a polyhedron to obtain mutually independent boundary grid matrixes distributed on a plurality of surfaces; and performing filling operation of the scanning matrix on the mutually independent boundary grid matrixes to respectively generate the internal grid and the boundary grid.
In the technical scheme, interpolation operation is firstly carried out on boundary points of the geo-fence to obtain a one-dimensional boundary grid list and a junction grid with two lines inserted at the same time, to further ensure coverage within the geofence, the hub grids are separated as axes through a one-dimensional list of boundary grids to form a matrix of boundary grids, in order to further refine the coverage of the geo-fence, a cross-surface segmentation operation is carried out on the boundary grid matrix by adopting a tangent plane formed by edges of the polyhedron to obtain the boundary grid matrix which is distributed on a plurality of surfaces and is independent of each other, and then performing a filling operation of the scan matrix on the mutually independent boundary grid matrices to generate an internal grid and a boundary grid respectively, according to the technical scheme, the area covered by the geo-fence is converted into the grid, so that the integrity of the coverage area of the geo-fence is ensured while the position judgment efficiency is improved.
In the above technical solution, preferably, the method further includes: marking a boundary grid, and storing the boundary points of the geo-fence in the boundary grid; and acquiring the maximum longitude, the minimum longitude, the maximum latitude and the minimum latitude of all the boundary points to construct a rectangular boundary.
In the technical scheme, the convenient grids are marked firstly, then the boundary points of the geographic fence are stored in the corresponding boundary grids, the longitudes and latitudes of all the boundary points are further acquired, the maximum longitudes, the minimum longitudes, the maximum latitudes and the minimum latitudes in the acquired precisions and latitudes are screened out, so that the rectangular boundaries are constructed according to the maximum longitudes, the minimum longitudes, the maximum latitudes and the minimum latitudes, and the constructed rectangular boundaries can be adopted to construct the local polygons of the boundary grids when the position point to be detected is located in the boundary grids, so that the efficiency and the accuracy of position judgment of the position point to be detected are ensured.
In the above technical solution, preferably, the determining whether the position point to be detected is located in the grid index of the geo-fence specifically includes the following steps: and converting the position points to be detected into a grid to be detected according to the longitude and latitude coordinates of the position points to be detected so as to judge whether the grid to be detected belongs to the grid index, and determining that the position points to be detected are not located in the geo-fence when judging that the grid to be detected does not belong to the grid index.
In the technical scheme, the longitude and latitude coordinates of the position point to be detected are firstly acquired, the position point to be detected is converted into the grid to be detected according to the longitude and latitude coordinates, and the position point to be detected which is not located in the geo-fence can be judged only by determining whether the grid to be detected belongs to the network index or not, namely when the grid to be detected is determined not to belong to the network index, the position point to be detected can be determined not to be located in the geo-fence, and the judgment efficiency of the position point to be detected which is located in the geo-fence is effectively improved.
In the foregoing technical solution, preferably, when it is detected that the mesh index belongs to the boundary mesh, constructing a local polygon of the boundary mesh specifically includes the following steps: determining the last boundary point in an adjacent grid on the grid to be detected and the foremost boundary point in the next adjacent grid; establishing a first plane rectangular coordinate system by taking the frontmost boundary point as a circular point, and determining a first vertex in a fourth quadrant of the first plane rectangular coordinate system in a rectangular boundary; establishing a second plane rectangular coordinate system by taking the last boundary point as a dot, determining a second vertex in a second quadrant of the first plane rectangular coordinate system in the rectangular boundary, and determining a vertex of the rectangular boundary longitudinally opposite to the second vertex as a third vertex; and the first vertex is used as a starting point to be connected with the third vertex, the second vertex and the last boundary point in a counterclockwise sequence, and all the boundary points and the foremost boundary point in the mesh to be detected are constructed to form a local polygon.
In the technical scheme, when the grid to be detected converted from the position point to be detected belongs to the boundary grid in the grid index, the last boundary point in the last adjacent grid of the boundary grid corresponding to the grid to be detected and the foremost boundary point in the next adjacent grid are determined, the foremost boundary point is used as an origin to establish a first plane rectangular coordinate system, a first vertex in the fourth quadrant of the first plane rectangular coordinate system in the constructed rectangular boundary is determined, a second plane rectangular coordinate system is established by using the last boundary point as the origin, a second vertex in the second quadrant of the second plane rectangular coordinate system in the constructed rectangular boundary is determined, the vertex of the rectangular boundary longitudinally opposite to the second vertex is determined as a third vertex, and the first vertex is used as a starting point to sequentially connect the third vertex, the second vertex, the third vertex, the second vertex and the second vertex in a counterclockwise direction, And constructing a local polygon by using the last boundary point, all boundary points in the to-be-detected grid and the foremost boundary point to ensure the efficiency of judging the position of the to-be-detected position point.
In the above technical solution, preferably, determining a local position relationship between the position point to be detected and the local polygon includes the following steps: emitting rays from a position point to be detected to any direction; counting the number of intersection points between the rays and the local polygon; judging whether the number of the intersection points is odd or even; when the number of the intersection points is judged to be odd, determining that the position points to be detected are located in the local polygon so as to determine that the position points to be detected are located in the geo-fence; and when the number of the intersection points is judged to be an even number, determining that the position points to be detected are positioned outside the local polygon so as to determine that the position points to be detected are positioned outside the geographic fence.
In the technical scheme, after the local polygon is constructed, rays are emitted to any direction at the position of the position point to be detected, when the intersection point of the rays and the local polygon is an odd number, the starting point of the rays is positioned in the local polygon, namely, the position point to be detected is positioned in the local polygon, and further the position point to be detected is positioned in the electronic fence, if the intersection point of the rays and the local polygon is an even number, the starting point of the rays is positioned outside the local polygon, namely, the position point to be detected is positioned outside the local polygon, and further the position point to be detected is positioned outside the electronic fence, whether the position point to be detected is positioned in the geographic fence or not is judged by judging the odd-even number condition of the intersection point of the rays emitted by the position point to be detected and the local polygon, and the efficiency of position judgment is effectively improved, and the accuracy of judgment is ensured.
In the above technical solution, preferably, the method further includes: and when the grid index is detected to belong to the internal grid, determining that the position point to be detected is located in the geo-fence.
In the technical scheme, when the grid to be detected converted from the position point to be detected belongs to the internal grid, the position point to be detected is located in the internal grid, so that the position point to be detected can be judged to be located in the geo-fence.
A second aspect of the present invention provides a geo-fence based location determination apparatus, including: an establishing unit, configured to establish a grid index specifying a geofence, where the grid index includes an internal grid within the geofence and a boundary grid intersecting a boundary of the geofence; the judging unit is used for judging whether the position point to be detected is in the grid index of the geo-fence or not; the detection unit is used for detecting that the grid index belongs to the internal grid or the boundary grid when the position point to be detected is judged to be in the grid index; the construction unit is used for constructing a local polygon of the boundary grid when the grid index is detected to belong to the boundary grid; the determining unit is used for determining the local position relationship between the position point to be detected and the local polygon so as to determine the position relationship between the position point to be detected and the geo-fence according to the local position relationship.
In the technical scheme, firstly, a grid index of a designated geo-fence is established, the grid index comprises an internal grid in the geo-fence and a boundary grid intersected with the boundary of the geo-fence, whether a position point to be detected is in the network index of the geo-fence or not is judged, when the position point to be detected is judged to be in the grid index, whether the grid index in which the position point to be detected is located belongs to the internal grid or the boundary grid is further detected, when the grid index in which the position point to be detected is located is detected to belong to the boundary grid, because the boundary grid is intersected with the geo-fence, when the position point to be detected is located in the boundary grid, the position point to be detected cannot be determined to be located in the geo-fence, a local polygon of the boundary network is constructed, and then the local position relation between the position point to be detected and the, the method and the device have the advantages that the position relation between the position point to be detected and the geo-fence is determined according to the local position relation, whether the position point to be detected in the boundary grid is located in the geo-fence or not is judged by constructing the local polygon of the boundary grid, the efficiency of position judgment of the position point to be detected is effectively improved, and the accuracy of position judgment is guaranteed.
In the above technical solution, preferably, the establishing unit includes: the interpolation operation subunit is used for performing interpolation operation on the boundary points of the geo-fence to obtain a one-dimensional boundary grid list and a junction grid, wherein the junction grid is a grid into which two lines are inserted simultaneously in the interpolation operation; the separation subunit is used for separating the one-dimensional boundary grid list by taking the pivot grid as an axis to form a boundary grid matrix; the dividing subunit is used for performing cross-surface dividing operation on the boundary grid matrix by adopting a tangent plane formed by edges of the polyhedron to obtain mutually independent boundary grid matrixes distributed on a plurality of surfaces; and the filling subunit is used for performing filling operation of the scanning matrix on the mutually independent boundary grid matrixes so as to respectively generate the internal grid and the boundary grid.
In the technical scheme, interpolation operation is firstly carried out on boundary points of the geo-fence to obtain a one-dimensional boundary grid list and a junction grid with two lines inserted at the same time, to further ensure coverage within the geofence, the hub grids are separated as axes through a one-dimensional list of boundary grids to form a matrix of boundary grids, in order to further refine the coverage of the geo-fence, a cross-surface segmentation operation is carried out on the boundary grid matrix by adopting a tangent plane formed by edges of the polyhedron to obtain the boundary grid matrix which is distributed on a plurality of surfaces and is independent of each other, and then performing a filling operation of the scan matrix on the mutually independent boundary grid matrices to generate an internal grid and a boundary grid respectively, according to the technical scheme, the area covered by the geo-fence is converted into the grid, so that the integrity of the coverage area of the geo-fence is ensured while the position judgment efficiency is improved.
In the above technical solution, preferably, the method further includes: the marking unit is used for marking the boundary grids and storing the boundary points of the geo-fence in the boundary grids; and the acquisition unit is used for acquiring the maximum longitude, the minimum longitude, the maximum latitude and the minimum latitude of all the boundary points to construct the rectangular boundary.
In the technical scheme, the convenient grids are marked firstly, then the boundary points of the geographic fence are stored in the corresponding boundary grids, the longitudes and latitudes of all the boundary points are further acquired, the maximum longitudes, the minimum longitudes, the maximum latitudes and the minimum latitudes in the acquired precisions and latitudes are screened out, so that the rectangular boundaries are constructed according to the maximum longitudes, the minimum longitudes, the maximum latitudes and the minimum latitudes, and the constructed rectangular boundaries can be adopted to construct the local polygons of the boundary grids when the position point to be detected is located in the boundary grids, so that the efficiency and the accuracy of position judgment of the position point to be detected are ensured.
In the above technical solution, preferably, the judging unit includes: and the converting subunit is used for converting the position points to be detected into the grids to be detected according to the longitude and latitude coordinates of the position points to be detected so as to judge whether the grids to be detected belong to the grid indexes or not, and determining that the position points to be detected are not located in the geo-fence when judging that the grids to be detected do not belong to the grid indexes.
In the technical scheme, the longitude and latitude coordinates of the position point to be detected are firstly acquired, the position point to be detected is converted into the grid to be detected according to the longitude and latitude coordinates, and the position point to be detected which is not located in the geo-fence can be judged only by determining whether the grid to be detected belongs to the network index or not, namely when the grid to be detected is determined not to belong to the network index, the position point to be detected can be determined not to be located in the geo-fence, and the judgment efficiency of the position point to be detected which is located in the geo-fence is effectively improved.
In the above technical solution, preferably, the construction unit includes: the first determining subunit is used for determining the last boundary point in an adjacent grid on the grid to be detected and the foremost boundary point in the next adjacent grid; the establishing subunit is used for establishing a first plane rectangular coordinate system by taking the foremost boundary point as a circular point and determining a first vertex in a fourth quadrant of the first plane rectangular coordinate system in the rectangular boundary; the establishing subunit is further configured to: establishing a second plane rectangular coordinate system by taking the last boundary point as a dot, determining a second vertex in a second quadrant of the first plane rectangular coordinate system in the rectangular boundary, and determining a vertex of the rectangular boundary longitudinally opposite to the second vertex as a third vertex; and the scanning subunit is used for taking the first vertex as a starting point to be connected with the third vertex, the second vertex and the last boundary point in a counterclockwise sequence, and constructing and forming a local polygon by all the boundary points and the foremost boundary point in the mesh to be detected.
In the technical scheme, when the grid to be detected converted from the position point to be detected belongs to the boundary grid in the grid index, the last boundary point in the last adjacent grid of the boundary grid corresponding to the grid to be detected and the foremost boundary point in the next adjacent grid are determined, the foremost boundary point is used as an origin to establish a first plane rectangular coordinate system, a first vertex in the fourth quadrant of the first plane rectangular coordinate system in the constructed rectangular boundary is determined, a second plane rectangular coordinate system is established by using the last boundary point as the origin, a second vertex in the second quadrant of the second plane rectangular coordinate system in the constructed rectangular boundary is determined, the vertex of the rectangular boundary longitudinally opposite to the second vertex is determined as a third vertex, and the first vertex is used as a starting point to sequentially connect the third vertex, the second vertex, the third vertex, the second vertex and the second vertex in a counterclockwise direction, And constructing a local polygon by using the last boundary point, all boundary points in the to-be-detected grid and the foremost boundary point to ensure the efficiency of judging the position of the to-be-detected position point.
In the above technical solution, preferably, the determining unit includes: the emission subunit is used for emitting rays from the position point to be detected to any direction; the statistic subunit is used for counting the number of intersection points between the ray and the local polygon; the judging subunit is used for judging whether the number of the intersection points is an odd number or an even number; the second determining subunit is used for determining that the position point to be detected is located in the local polygon when the number of the intersection points is judged to be odd, so as to determine that the position point to be detected is located in the geo-fence; and the third determining subunit is used for determining that the position point to be detected is positioned outside the local polygon when the number of the intersection points is judged to be an even number, so as to determine that the position point to be detected is positioned outside the geo-fence.
In the technical scheme, after the local polygon is constructed, rays are emitted to any direction at the position of the position point to be detected, when the intersection point of the rays and the local polygon is an odd number, the starting point of the rays is positioned in the local polygon, namely, the position point to be detected is positioned in the local polygon, and further the position point to be detected is positioned in the electronic fence, if the intersection point of the rays and the local polygon is an even number, the starting point of the rays is positioned outside the local polygon, namely, the position point to be detected is positioned outside the local polygon, and further the position point to be detected is positioned outside the electronic fence, whether the position point to be detected is positioned in the geographic fence or not is judged by judging the odd-even number condition of the intersection point of the rays emitted by the position point to be detected and the local polygon, and the efficiency of position judgment is effectively improved, and the accuracy of judgment is ensured.
In the foregoing technical solution, preferably, the determining unit is further configured to: and when the grid index is detected to belong to the internal grid, determining that the position point to be detected is located in the geo-fence.
In the technical scheme, when the grid to be detected converted from the position point to be detected belongs to the internal grid, the position point to be detected is located in the internal grid, so that the position point to be detected can be judged to be located in the geo-fence.
A technical solution of a third aspect of the present invention provides a server, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor when executing the computer program implementing the steps defined by any of the above geo-fence based location determination methods, and/or a geo-fence based location determination apparatus comprising any of the above.
An aspect of the fourth aspect of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps defined in any one of the above geo-fence based location determination methods.
Advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 shows a schematic flow diagram of a geofence-based location determination method, in accordance with a first embodiment of the present invention;
FIG. 2 shows a schematic block diagram of a geo-fence based location determination apparatus according to an embodiment of the present invention;
FIG. 3 shows a schematic block diagram of the setup unit shown in FIG. 2;
FIG. 4 shows a schematic block diagram of the determination unit shown in FIG. 2;
FIG. 5 shows a schematic block diagram of the building unit shown in FIG. 2;
FIG. 6 shows a schematic block diagram of the determination unit shown in FIG. 2;
FIG. 7 shows a schematic block diagram of a server according to an embodiment of the invention;
FIG. 8 shows a schematic flow chart of a geofence-based location determination method in accordance with a second embodiment of the present invention;
FIG. 9 shows a schematic diagram of constructing rectangular boundaries in accordance with an embodiment of the invention;
FIG. 10 shows a schematic diagram of building a partial polygon according to an embodiment of the invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited by the specific embodiments disclosed below.
The geofence-based location determination method according to the first embodiment of the present invention will be specifically described below with reference to fig. 1.
As shown in fig. 1, the method for determining a location based on a geo-fence according to an embodiment of the present invention specifically includes the following steps:
step S102, a grid index specifying a geo-fence is established, where the grid index includes an internal grid within the geo-fence and a boundary grid intersecting a boundary of the geo-fence.
And step S104, judging whether the position point to be detected is in the grid index of the geo-fence or not.
And step S106, when the position point to be detected is judged to be in the grid index, detecting that the grid index belongs to the internal grid or the boundary grid.
And step S108, when the grid index is detected to belong to the boundary grid, constructing a local polygon of the boundary grid.
Step S110, determining a local position relationship between the position point to be detected and the local polygon, so as to determine a position relationship between the position point to be detected and the geo-fence according to the local position relationship.
In this embodiment, a grid index specifying a geo-fence is first established, where the grid index includes an internal grid located in the geo-fence and a boundary grid intersecting with a boundary of the geo-fence, and then it is determined whether a position point to be detected is located in the grid index of the geo-fence, and when it is determined that the position point to be detected is located in the grid index, it is further detected whether the grid index where the position point to be detected is located belongs to the internal grid or the boundary grid, and when it is detected that the grid index where the position point to be detected is located belongs to the boundary grid, because the boundary grid is intersected with the geo-fence, when the position point to be detected is located in the boundary grid, it cannot be determined that the position point to be detected is located in the geo-fence, so that a local polygon of the boundary network is constructed, and then a local position, the method and the device have the advantages that the position relation between the position point to be detected and the geo-fence is determined according to the local position relation, whether the position point to be detected in the boundary grid is located in the geo-fence or not is judged by constructing the local polygon of the boundary grid, the efficiency of position judgment of the position point to be detected is effectively improved, and the accuracy of position judgment is guaranteed.
Further, step S102 in the above embodiment specifically includes: performing interpolation operation on boundary points of the geo-fence to obtain a one-dimensional boundary grid list and a hub grid, wherein the hub grid is a grid with two lines inserted simultaneously in the interpolation operation; separating the one-dimensional boundary grid list by taking the pivot grid as an axis to form a boundary grid matrix; performing cross-surface segmentation operation on the boundary grid matrix by using a tangent plane formed by edges of a polyhedron to obtain mutually independent boundary grid matrixes distributed on a plurality of surfaces; and performing filling operation of the scanning matrix on the mutually independent boundary grid matrixes to respectively generate the internal grid and the boundary grid.
In this embodiment, the boundary points of the geofence are first interpolated to obtain a one-dimensional boundary grid list and a hub grid with two lines inserted at the same time, to further ensure coverage within the geofence, the hub grids are separated as axes through a one-dimensional list of boundary grids to form a matrix of boundary grids, in order to further refine the coverage of the geo-fence, a cross-surface segmentation operation is carried out on the boundary grid matrix by adopting a tangent plane formed by edges of the polyhedron to obtain the boundary grid matrix which is distributed on a plurality of surfaces and is independent of each other, and then performing a filling operation of the scan matrix on the mutually independent boundary grid matrices to generate an internal grid and a boundary grid respectively, according to the technical scheme, the area covered by the geo-fence is converted into the grid, so that the integrity of the coverage area of the geo-fence is ensured while the position judgment efficiency is improved.
Further, in the foregoing embodiment, the method for determining a location based on a geo-fence further includes: marking a boundary grid, and storing the boundary points of the geo-fence in the boundary grid; and acquiring the maximum longitude, the minimum longitude, the maximum latitude and the minimum latitude of all the boundary points to construct a rectangular boundary.
In the embodiment, the convenient grids are marked first, so that the boundary points of the geo-fence are stored in the corresponding boundary grids, the longitudes and latitudes of all the boundary points are further acquired, the maximum longitudes, the minimum longitudes, the maximum latitudes and the minimum latitudes in the acquired precisions and latitudes are screened out, and the rectangular boundary is constructed according to the maximum longitudes, the minimum longitudes, the maximum latitudes and the minimum latitudes, so that when the position point to be detected is located in the boundary grids, the constructed rectangular boundary can be adopted to construct the local polygon of the boundary grids, and the efficiency and the accuracy of position judgment of the position point to be detected are ensured.
Further, step S104 in the above embodiment specifically includes: and converting the position points to be detected into a grid to be detected according to the longitude and latitude coordinates of the position points to be detected so as to judge whether the grid to be detected belongs to the grid index, and determining that the position points to be detected are not located in the geo-fence when judging that the grid to be detected does not belong to the grid index.
In the embodiment, the longitude and latitude coordinates of the position point to be detected are firstly acquired, the position point to be detected is converted into the grid to be detected according to the longitude and latitude coordinates, and the position point to be detected which is not located in the geo-fence can be judged only by determining whether the grid to be detected belongs to the network index, namely when the grid to be detected is determined not to belong to the network index, the position point to be detected can be determined not to be located in the geo-fence, and the judgment efficiency of the position point to be detected which is located in the geo-fence is effectively improved.
Further, in the above embodiment, when it is detected that the mesh index belongs to the boundary mesh, constructing a local polygon of the boundary mesh specifically includes the following steps: determining the last boundary point in an adjacent grid on the grid to be detected and the foremost boundary point in the next adjacent grid; establishing a first plane rectangular coordinate system by taking the frontmost boundary point as a circular point, and determining a first vertex in a fourth quadrant of the first plane rectangular coordinate system in a rectangular boundary; establishing a second plane rectangular coordinate system by taking the last boundary point as a dot, determining a second vertex in a second quadrant of the first plane rectangular coordinate system in the rectangular boundary, and determining a vertex of the rectangular boundary longitudinally opposite to the second vertex as a third vertex; and the first vertex is used as a starting point to be connected with the third vertex, the second vertex and the last boundary point in a counterclockwise sequence, and all the boundary points and the foremost boundary point in the mesh to be detected are constructed to form a local polygon.
In this embodiment, when it is determined that the mesh to be detected converted from the position point to be detected belongs to the boundary mesh in the mesh index, the last boundary point in the last adjacent mesh and the foremost boundary point in the next belief mesh of the boundary mesh corresponding to the mesh to be detected are determined, the first planar rectangular coordinate system is established with the foremost boundary point as the origin, the first vertex in the fourth quadrant of the first planar rectangular coordinate system in the constructed rectangular boundary is determined, the second planar rectangular coordinate system is established with the last boundary point as the origin, the second vertex in the second quadrant of the second planar rectangular coordinate system in the constructed rectangular boundary is determined, the vertex of the rectangular boundary longitudinally opposite to the second vertex is determined as the third vertex, and the third vertex, the second vertex, and constructing a local polygon by using the last boundary point, all boundary points in the to-be-detected grid and the foremost boundary point to ensure the efficiency of judging the position of the to-be-detected position point.
Further, step S110 in the above embodiment specifically includes: emitting rays from a position point to be detected to any direction; counting the number of intersection points between the rays and the local polygon; judging whether the number of the intersection points is odd or even; when the number of the intersection points is judged to be odd, determining that the position points to be detected are located in the local polygon so as to determine that the position points to be detected are located in the geo-fence; and when the number of the intersection points is judged to be an even number, determining that the position points to be detected are positioned outside the local polygon so as to determine that the position points to be detected are positioned outside the geographic fence.
In the technical scheme, after the local polygon is constructed, rays are emitted to any direction at the position of the position point to be detected, when the intersection point of the rays and the local polygon is an odd number, the starting point of the rays is positioned in the local polygon, namely, the position point to be detected is positioned in the local polygon, and further the position point to be detected is positioned in the electronic fence, if the intersection point of the rays and the local polygon is an even number, the starting point of the rays is positioned outside the local polygon, namely, the position point to be detected is positioned outside the local polygon, and further the position point to be detected is positioned outside the electronic fence, whether the position point to be detected is positioned in the geographic fence or not is judged by judging the odd-even number condition of the intersection point of the rays emitted by the position point to be detected and the local polygon, and the efficiency of position judgment is effectively improved, and the accuracy of judgment is ensured.
Further, in the foregoing embodiment, the method for determining a location based on a geo-fence further includes: and when the grid index is detected to belong to the internal grid, determining that the position point to be detected is located in the geo-fence.
In this embodiment, when it is detected that the to-be-detected grid converted from the to-be-detected position point belongs to the internal grid, it is indicated that the to-be-detected position point is located in the internal grid, and therefore it can be determined that the to-be-detected position point is located in the geo-fence.
A geo-fence based location determination apparatus according to a first embodiment of the present invention is described in detail with reference to fig. 2 to 6.
As shown in fig. 2, the geo-fence based position determination apparatus according to an embodiment of the present invention includes: the device comprises a building unit, a judging unit, a detecting unit, a building unit and a determining unit.
The establishing unit is used for establishing a grid index of the designated geo-fence, wherein the grid index comprises an internal grid in the geo-fence and a boundary grid intersected with the boundary of the geo-fence; the judging unit is used for judging whether the position point to be detected is in the grid index of the geo-fence or not; the detection unit is used for detecting that the grid index belongs to the internal grid or the boundary grid when the position point to be detected is judged to be in the grid index; the construction unit is used for constructing a local polygon of the boundary grid when the grid index is detected to belong to the boundary grid; the determining unit is used for determining the local position relationship between the position point to be detected and the local polygon so as to determine the position relationship between the position point to be detected and the geo-fence according to the local position relationship.
In this embodiment, a grid index specifying a geo-fence is first established, where the grid index includes an internal grid located in the geo-fence and a boundary grid intersecting with a boundary of the geo-fence, and then it is determined whether a position point to be detected is located in the grid index of the geo-fence, and when it is determined that the position point to be detected is located in the grid index, it is further detected whether the grid index where the position point to be detected is located belongs to the internal grid or the boundary grid, and when it is detected that the grid index where the position point to be detected is located belongs to the boundary grid, because the boundary grid is intersected with the geo-fence, when the position point to be detected is located in the boundary grid, it cannot be determined that the position point to be detected is located in the geo-fence, so that a local polygon of the boundary network is constructed, and then a local position, the method and the device have the advantages that the position relation between the position point to be detected and the geo-fence is determined according to the local position relation, whether the position point to be detected in the boundary grid is located in the geo-fence or not is judged by constructing the local polygon of the boundary grid, the efficiency of position judgment of the position point to be detected is effectively improved, and the accuracy of position judgment is guaranteed.
Further, in the above-described embodiment, as shown in fig. 3, the establishing unit includes: an interpolation operation subunit, a separation subunit, a segmentation subunit, and a padding subunit.
The interpolation operation subunit is configured to perform interpolation operation on boundary points of the geofence to obtain a one-dimensional boundary grid list and a hub grid, where the hub grid is a grid into which two lines are inserted simultaneously during the interpolation operation; the separation subunit is used for separating the one-dimensional boundary grid list by taking the pivot grid as an axis to form a boundary grid matrix; the dividing subunit is used for performing cross-surface dividing operation on the boundary grid matrix by adopting a tangent plane formed by edges of the polyhedron to obtain mutually independent boundary grid matrixes distributed on a plurality of surfaces; the filling subunit is used for performing filling operation of the scanning matrix on the mutually independent boundary grid matrixes to respectively generate the internal grid and the boundary grid.
In this embodiment, the boundary points of the geofence are first interpolated to obtain a one-dimensional boundary grid list and a hub grid with two lines inserted at the same time, to further ensure coverage within the geofence, the hub grids are separated as axes through a one-dimensional list of boundary grids to form a matrix of boundary grids, in order to further refine the coverage of the geo-fence, a cross-surface segmentation operation is carried out on the boundary grid matrix by adopting a tangent plane formed by edges of the polyhedron to obtain the boundary grid matrix which is distributed on a plurality of surfaces and is independent of each other, and then performing a filling operation of the scan matrix on the mutually independent boundary grid matrices to generate an internal grid and a boundary grid respectively, according to the technical scheme, the area covered by the geo-fence is converted into the grid, so that the integrity of the coverage area of the geo-fence is ensured while the position judgment efficiency is improved.
Further, in the above embodiment, as shown in fig. 2, the device for determining a location based on a geo-fence further includes: a marking unit and an acquisition unit.
The marking unit is used for marking a boundary grid and storing the boundary points of the geo-fence in the boundary grid; the acquisition unit is used for acquiring the maximum longitude, the minimum longitude, the maximum latitude and the minimum latitude of all the boundary points to construct the rectangular boundary.
In the embodiment, the convenient grids are marked first, so that the boundary points of the geo-fence are stored in the corresponding boundary grids, the longitudes and latitudes of all the boundary points are further acquired, the maximum longitudes, the minimum longitudes, the maximum latitudes and the minimum latitudes in the acquired precisions and latitudes are screened out, and the rectangular boundary is constructed according to the maximum longitudes, the minimum longitudes, the maximum latitudes and the minimum latitudes, so that when the position point to be detected is located in the boundary grids, the constructed rectangular boundary can be adopted to construct the local polygon of the boundary grids, and the efficiency and the accuracy of position judgment of the position point to be detected are ensured.
Further, in the above-described embodiment, as shown in fig. 4, the judgment unit includes: and the converting subunit is used for converting the position points to be detected into the grids to be detected according to the longitude and latitude coordinates of the position points to be detected so as to judge whether the grids to be detected belong to the grid indexes or not, and determining that the position points to be detected are not located in the geo-fence when judging that the grids to be detected do not belong to the grid indexes.
In the embodiment, the longitude and latitude coordinates of the position point to be detected are firstly acquired, the position point to be detected is converted into the grid to be detected according to the longitude and latitude coordinates, and the position point to be detected which is not located in the geo-fence can be judged only by determining whether the grid to be detected belongs to the network index, namely when the grid to be detected is determined not to belong to the network index, the position point to be detected can be determined not to be located in the geo-fence, and the judgment efficiency of the position point to be detected which is located in the geo-fence is effectively improved.
Further, in the above-described embodiment, as shown in fig. 5, the construction unit includes: the method comprises a first determining subunit, a building subunit and a scanning subunit.
The first determining subunit is used for determining a last boundary point in an adjacent grid on the grid to be detected and a foremost boundary point in a next adjacent grid; the establishing subunit is used for establishing a first plane rectangular coordinate system by taking the foremost boundary point as a circular point and determining a first vertex in a fourth quadrant of the first plane rectangular coordinate system in the rectangular boundary; the establishing subunit is further configured to: establishing a second plane rectangular coordinate system by taking the last boundary point as a dot, determining a second vertex in a second quadrant of the first plane rectangular coordinate system in the rectangular boundary, and determining a vertex of the rectangular boundary longitudinally opposite to the second vertex as a third vertex; the scanning subunit is used for connecting a third vertex, a second vertex and a last boundary point in turn counterclockwise by taking the first vertex as a starting point, and constructing and forming a local polygon by all the boundary points and the foremost boundary point in the mesh to be detected.
In this embodiment, when it is determined that the mesh to be detected converted from the position point to be detected belongs to the boundary mesh in the mesh index, the last boundary point in the last adjacent mesh and the foremost boundary point in the next belief mesh of the boundary mesh corresponding to the mesh to be detected are determined, the first planar rectangular coordinate system is established with the foremost boundary point as the origin, the first vertex in the fourth quadrant of the first planar rectangular coordinate system in the constructed rectangular boundary is determined, the second planar rectangular coordinate system is established with the last boundary point as the origin, the second vertex in the second quadrant of the second planar rectangular coordinate system in the constructed rectangular boundary is determined, the vertex of the rectangular boundary longitudinally opposite to the second vertex is determined as the third vertex, and the third vertex, the second vertex, and constructing a local polygon by using the last boundary point, all boundary points in the to-be-detected grid and the foremost boundary point to ensure the efficiency of judging the position of the to-be-detected position point.
The response records comprise the viewing frequency, the editing frequency, the feedback frequency and the like of the user.
Further, in the above-described embodiment, as shown in fig. 6, the determination unit includes: the device comprises an emission subunit, a statistics subunit, a judgment subunit, a second determination subunit and a third determination subunit.
The emission subunit is used for emitting rays from the position point to be detected to any direction; the counting subunit is used for counting the number of intersection points between the ray and the local polygon; the judgment subunit is used for judging whether the number of the intersection points is an odd number or an even number; the second determining subunit is configured to determine that the position point to be detected is located within the local polygon when the number of the intersection points is determined to be odd, so as to determine that the position point to be detected is located within the geofence; and the third determining subunit is used for determining that the position point to be detected is positioned outside the local polygon when the number of the intersection points is judged to be an even number, so as to determine that the position point to be detected is positioned outside the geo-fence.
In this embodiment, after the local polygon is constructed, rays are emitted in arbitrary directions at the positions of the points to be detected, when the intersection point of the ray and the local polygon is odd, the starting point of the ray is positioned in the local polygon, namely, the position point to be detected can be determined to be in the local polygon, and then the position point to be detected is determined to be in the electronic fence, if the intersection point of the ray and the local polygon is even, the starting point of the ray is located outside the local polygon, namely, the position point to be detected is determined to be positioned outside the local polygon, and then the position point to be detected is determined to be positioned outside the electronic fence, whether the position point to be detected is located inside the geo-fence is judged by judging the odd-even number condition of the intersection point of the ray emitted by the position point to be detected and the local polygon, so that the position judgment efficiency is effectively improved, and the judgment accuracy is ensured.
Further, in the above embodiment, the determining unit is further configured to: and when the grid index is detected to belong to the internal grid, determining that the position point to be detected is located in the geo-fence.
In this embodiment, when it is detected that the to-be-detected grid converted from the to-be-detected position point belongs to the internal grid, it is indicated that the to-be-detected position point is located in the internal grid, and therefore it can be determined that the to-be-detected position point is located in the geo-fence.
Fig. 7 shows a schematic block diagram of a server according to an embodiment of the invention.
As shown in fig. 7, a server 300 according to an embodiment of the present invention includes: a memory 302, a processor 304, and a computer program stored on the memory 302 and executable on the processor, the processor when executing the computer program implementing the steps defined by any of the above geo-fence based location determination methods, and/or the geo-fence based location determination apparatus 200 comprising any of the above.
According to an embodiment of the present invention, there is also provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the position determination method as in the above embodiments.
The geofence-based location determination method of the second embodiment will be specifically described below with reference to fig. 8-10.
As shown in fig. 8, the method for determining a location based on a geo-fence according to the present invention specifically includes the following steps:
step S802, establishing a grid index in the fence.
Specifically, traversing points forming a fence, namely longitude and latitude coordinate pairs, recursively interpolating between two adjacent points until the two adjacent points are positioned in the same grid, stopping, converting all the points after interpolation into grids to form a one-dimensional boundary grid list, during interpolation, grids in which points on an upper line and a lower line are inserted are pivot grids, separating the one-dimensional boundary grid list by taking the pivot grids as axes to obtain a grid matrix, each line represents an independent grid and is not connected with other boundaries to construct two stacks, simultaneously sequentially pressing the boundary grids and fissures of the boundary grids into the two stacks respectively, constructing the boundary grid list, inquiring whether the grids are contained in the list before stacking, continuously pushing the grids in the stacks if the grids are not directly pushed, continuously pushing the grids in the stacks until the grids at the tops of the stacks are the same as the grids, deleting the grids from the list, adding the grids which are taken out of the stack in the same round as a row into a two-dimensional grid matrix, cutting the dissolution result of the two-dimensional matrix by using three sections formed by 12 edges of an octahedron to form independent boundary grid matrixes on eight surfaces respectively, filling the broken boundary on each surface with the grids positioned on the edges, and removing the duplicate, constructing a grid scanning matrix, wherein the size of the matrix is the span of all grid coordinates of the group on a coordinate system respectively, setting the value of the grid scanning matrix corresponding to the group to be 1, setting the rest values as 0, traversing all grids in the scanning matrix, detecting whether the center of the grid is in the polygon formed by the fences, if so, setting the value of the corresponding position of the scanning matrix to be 2, traversing the scanning matrix, adding all grids with the value larger than 0 into the result list, and calculating the two-dimensional grid matrix on each surface to obtain the grid index.
Step S804, determining that the position points to be detected are all in the grid index, if not, performing step S806, and if yes, performing step S808.
Specifically, the position points to be detected are converted into corresponding grids to be detected according to the longitude and latitude of the position points to be detected, and whether the grids to be detected are in the grid index is judged.
Step 806, determining that the position point to be detected is not in the fence.
Step S808, determining whether the cell to be detected is a boundary cell, if not, performing step S810, and if so, performing step S812.
Specifically, when it is determined that the lattice to be detected is in the lattice index, it is further determined whether the lattice to be detected is in the boundary lattice list.
Step S810, the position point to be detected is in the fence.
Specifically, when it is determined that the grid to be detected is in the grid index and not in the boundary grid list, it is determined that the grid to be detected is in the grid list, and it is determined that the position point to be detected corresponding to the grid to be detected is in the fence.
In step S812, a local polygon is constructed.
Specifically, the maximum longitude and latitude, the minimum longitude and latitude of all fence coordinate points are obtained, a rectangular boundary (shown by a dotted line in fig. 9) is constructed according to the obtained longitude and latitude, as shown in fig. 10, a first point B of a next adjacent grid of a grid where a position point a to be detected is located is determined, a last point C of a previous adjacent grid of the grid where the position point to be detected is located is determined, the point B is used as an origin to serve as a planar rectangular coordinate system, a point D of the rectangular boundary in a fourth quadrant of the planar rectangular coordinate system is obtained, and the point C is used as the origin to serve as the planar rectangular coordinate system. The point E of the rectangular boundary in the second quadrant is found, D, F, E is added to the path counterclockwise from point D, and finally all the fence points between C, B and C and B are connected to form a local polygon.
And step S814, judging the position relation between the position point to be detected and the local polygon by adopting a ray method.
Specifically, after the local polygon is constructed, rays are emitted to any direction at the position of the position point to be detected, when the intersection point of the rays and the local polygon is an odd number, it is described that the starting point of the rays is located inside the local polygon, that is, it can be determined that the position point to be detected is located inside the local polygon, and then it is determined that the position point to be detected is located inside the fence, and if the intersection point of the rays and the local polygon is an even number, it is described that the starting point of the rays is located outside the local polygon, that is, it can be determined that the position point to be detected is located outside the local polygon, and then it is determined that the position point to be.
When the position judgment method is adopted, the detection efficiency of the non-boundary grid with the position point to be detected falling in the geo-fence is judged to be O (1), and map [ fence ] is directly inquired][ lattice List]When the position point to be detected falls in the boundary grid, the number of the edges of the local polygon is
Figure GDA0002564353070000191
When the ray method is adopted again for detection, the detection efficiency is O: (
Figure GDA0002564353070000192
) The operation of the ray method is accelerated, and the detection efficiency of the position point to be detected is improved.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs.
The unit modules of the geo-fence based position determination device of the embodiment of the invention can be merged, divided and deleted according to actual needs.
Further, it will be understood that any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and that the scope of the preferred embodiments of the present invention includes additional implementations in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a separate product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description of the present invention, the terms "first", "second", and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance, and specific meanings of the above terms in embodiments of the present invention may be understood according to specific situations by those of ordinary skill in the art.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes will occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (15)

1. A geo-fence based location determination method, comprising:
establishing a grid index specifying a geofence, the grid index comprising an internal grid within the geofence, and a boundary grid intersecting a boundary of the geofence;
judging whether the position point to be detected is in the grid index of the geo-fence or not;
when the position point to be detected is judged to be in the grid index, detecting that the grid index belongs to an internal grid or a boundary grid;
when the grid index is detected to belong to the boundary grid, constructing a local polygon of the boundary grid;
determining a local position relation between the position point to be detected and the local polygon so as to determine a position relation between the position point to be detected and the geo-fence according to the local position relation;
the establishing of the grid index of the designated geo-fence specifically includes the following steps:
performing interpolation operation on the boundary points of the geo-fence to obtain a one-dimensional boundary grid list and a hub grid, wherein the hub grid is a grid into which two lines are inserted simultaneously in the interpolation operation;
separating the one-dimensional boundary grid list by taking the pivot grid as an axis to form a boundary grid matrix;
performing cross-surface segmentation operation on the boundary grid matrix by using a tangent plane formed by edges of a polyhedron to obtain the boundary grid matrix which is distributed on a plurality of surfaces and is independent of each other;
and performing a filling operation of a scanning matrix on the boundary grid matrixes which are independent from each other to generate the internal grid and the boundary grid respectively.
2. The geo-fence based location determination method of claim 1, further comprising:
marking the boundary grid, and storing the boundary points of the geo-fence in the boundary grid;
and acquiring the maximum longitude, the minimum longitude, the maximum latitude and the minimum latitude of all the boundary points to construct a rectangular boundary.
3. The geo-fence based location determination method according to claim 2, wherein determining whether the location point to be detected is within the grid index of the geo-fence comprises:
and converting the position points to be detected into a grid to be detected according to the longitude and latitude coordinates of the position points to be detected so as to judge whether the grid to be detected belongs to the grid index, and determining that the position points to be detected are not in the geo-fence when judging that the grid to be detected does not belong to the grid index.
4. The geo-fence based location determination method according to claim 3, wherein the constructing the local polygon of the boundary mesh when the mesh index is detected to belong to the boundary mesh specifically comprises the following steps:
determining the last boundary point in an adjacent grid on the grid to be detected and the foremost boundary point in the next adjacent grid;
establishing a first plane rectangular coordinate system by taking the foremost boundary point as a circular point, and determining a first vertex in a fourth quadrant of the first plane rectangular coordinate system in the rectangular boundary;
establishing a second plane rectangular coordinate system by taking the last boundary point as a circular point, determining a second vertex in a second quadrant of the first plane rectangular coordinate system in the rectangular boundary, and determining a vertex of the rectangular boundary longitudinally opposite to the second vertex as a third vertex;
and connecting the third vertex, the second vertex and the last boundary point in turn in a counterclockwise direction by taking the first vertex as a starting point, and constructing and forming the local polygon by all the boundary points and the frontmost boundary point in the mesh to be detected.
5. The geo-fence based location determination method according to any one of claims 1 to 4, wherein the determining a local location relationship between the location point to be detected and the local polygon specifically includes the following steps:
emitting rays from the position point to be detected to any direction;
counting the number of intersection points between the rays and the local polygon;
judging whether the number of the intersection points is an odd number or an even number;
when the number of the intersection points is determined to be odd, determining that the position point to be detected is located in the local polygon, so as to determine that the position point to be detected is located in the geo-fence;
and when the number of the intersection points is judged to be an even number, determining that the position point to be detected is positioned outside the local polygon so as to determine that the position point to be detected is positioned outside the geographic fence.
6. The geo-fence based location determination method of any of claims 1 to 4, further comprising:
and when the grid index is detected to belong to the internal grid, determining that the position point to be detected is located in the geo-fence.
7. A geo-fence based location determination apparatus, comprising:
an establishing unit configured to establish a grid index specifying a geofence, the grid index including an internal grid within the geofence and a boundary grid intersecting a boundary of the geofence;
the judging unit is used for judging whether the position point to be detected is in the grid index of the geo-fence or not;
the detection unit is used for detecting that the grid index belongs to an internal grid or a boundary grid when the position point to be detected is judged to be in the grid index;
a construction unit, configured to construct a local polygon of the boundary mesh when it is detected that the mesh index belongs to the boundary mesh;
the determining unit is used for determining the local position relationship between the position point to be detected and the local polygon so as to determine the position relationship between the position point to be detected and the geo-fence according to the local position relationship;
the establishing unit includes:
an interpolation operation subunit, configured to perform an interpolation operation on the boundary points of the geofence to obtain a one-dimensional boundary grid list and a hub grid, where the hub grid is a grid into which two lines are inserted simultaneously during the interpolation operation;
a separation subunit, configured to separate the one-dimensional boundary grid list with the pivot grid as an axis to form a boundary grid matrix;
a dividing subunit, configured to perform a cross-plane dividing operation on the boundary grid matrix by using a tangent plane formed by edges of a polyhedron to obtain the mutually independent boundary grid matrices distributed on multiple planes;
and the filling subunit is used for performing filling operation of the scanning matrix on the boundary grid matrixes which are independent from each other so as to respectively generate the internal grid and the boundary grid.
8. The geo-fence based location determination device of claim 7, further comprising:
the marking unit is used for marking the boundary grids and storing the boundary points of the geo-fence into the boundary grids;
and the acquisition unit is used for acquiring the maximum longitude, the minimum longitude, the maximum latitude and the minimum latitude of all the boundary points to construct a rectangular boundary.
9. The geo-fence based location determination device of claim 8, wherein the determination unit comprises:
and the converting subunit is used for converting the position point to be detected into a grid to be detected according to the longitude and latitude coordinates of the position point to be detected so as to judge whether the grid to be detected belongs to the grid index or not, and determining that the position point to be detected is not in the geo-fence when judging that the grid to be detected does not belong to the grid index.
10. The geo-fence based location determination apparatus of claim 9, wherein the construction unit comprises:
the first determining subunit is used for determining a last boundary point in an adjacent grid on the grid to be detected and a foremost boundary point in a next adjacent grid;
the establishing subunit is used for establishing a first plane rectangular coordinate system by taking the foremost boundary point as a circular point and determining a first vertex in a fourth quadrant of the first plane rectangular coordinate system in the rectangular boundary;
the establishing subunit is further configured to: establishing a second plane rectangular coordinate system by taking the last boundary point as a circular point, determining a second vertex in a second quadrant of the first plane rectangular coordinate system in the rectangular boundary, and determining a vertex of the rectangular boundary longitudinally opposite to the second vertex as a third vertex;
and the scanning subunit is used for connecting the third vertex, the second vertex and the last boundary point in turn in a counterclockwise direction by taking the first vertex as a starting point, and constructing and forming the local polygon by using all the boundary points and the frontmost boundary point in the mesh to be detected.
11. The geo-fence based location determination apparatus according to any one of claims 7 to 10, wherein the determination unit comprises:
the emission subunit is used for emitting rays from the position point to be detected to any direction;
the statistic subunit is used for counting the number of intersection points between the ray and the local polygon;
the judging subunit is used for judging whether the number of the intersection points is an odd number or an even number;
a second determining subunit, configured to determine that the position point to be detected is located within the local polygon when it is determined that the number of intersection points is odd, so as to determine that the position point to be detected is located within the geofence;
and the third determining subunit is configured to determine that the position point to be detected is located outside the local polygon when it is determined that the number of the intersection points is an even number, so as to determine that the position point to be detected is located outside the geo-fence.
12. The geo-fence based location determination apparatus of any of claims 7 to 10, further comprising:
the determination unit is further configured to: and when the grid index is detected to belong to the internal grid, determining that the position point to be detected is located in the geo-fence.
13. A server comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the computer program implements the steps defined by the geofence-based location determination method of any of claims 1-6.
14. A server, characterized in that it comprises a geo-fence based location determination apparatus as claimed in any one of claims 7 to 12.
15. A computer-readable storage medium, having stored thereon a computer program, wherein the computer program, when being executed by a processor, is adapted to carry out the steps defined in the geofence-based location determination method of any of claims 1-6.
CN201811634798.XA 2018-12-29 2018-12-29 Position determination method, determination device, server, and computer-readable storage medium Active CN110769369B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811634798.XA CN110769369B (en) 2018-12-29 2018-12-29 Position determination method, determination device, server, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811634798.XA CN110769369B (en) 2018-12-29 2018-12-29 Position determination method, determination device, server, and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN110769369A CN110769369A (en) 2020-02-07
CN110769369B true CN110769369B (en) 2020-09-22

Family

ID=69328893

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811634798.XA Active CN110769369B (en) 2018-12-29 2018-12-29 Position determination method, determination device, server, and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN110769369B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113449052A (en) * 2020-03-26 2021-09-28 丰图科技(深圳)有限公司 Method for establishing spatial index, method and device for querying spatial region
CN111951089A (en) * 2020-08-05 2020-11-17 中国工商银行股份有限公司 House checking method and device
CN112926123B (en) * 2021-03-17 2022-09-02 杭州品茗安控信息技术股份有限公司 Method, device, equipment and storage medium for determining position relation of building member

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893384B (en) * 2014-12-30 2019-04-12 泰瑞数创科技(北京)有限公司 A method of establishing fence in three dimensions
US9916326B2 (en) * 2015-01-27 2018-03-13 Splunk, Inc. Efficient point-in-polygon indexing technique for facilitating geofencing operations
CN105828292A (en) * 2016-05-09 2016-08-03 青岛海信移动通信技术股份有限公司 Position detecting method and device based on geo-fencing
CN107402955B (en) * 2017-06-02 2020-04-14 阿里巴巴集团控股有限公司 Method and apparatus for determining index grid of geo-fence
CN110633344B (en) * 2018-06-25 2021-08-24 北京嘀嘀无限科技发展有限公司 Method and device for determining point-to-fence relationship and electronic equipment

Also Published As

Publication number Publication date
CN110769369A (en) 2020-02-07

Similar Documents

Publication Publication Date Title
CN110769369B (en) Position determination method, determination device, server, and computer-readable storage medium
CN107070961B (en) Hot spot area determination method and device based on geographic position data
CN106845324B (en) Method and device for processing guideboard information
US9305241B2 (en) Systems and methods for reducing a data set
US20110246073A1 (en) System and method for analyzing trees in lidar data using views
CN114419085A (en) Automatic building contour line extraction method and device, terminal device and storage medium
US11443452B2 (en) Using spatial filter to reduce bundle adjustment block size
CN112950622A (en) Target detection method and device, computer equipment and storage medium
CN113835078B (en) Signal level joint detection method and device based on local three-dimensional grid
CN108573510B (en) Grid map vectorization method and device
CN112102316B (en) Method and device for acquiring distribution of product defect positions
CN115661852B (en) Map segmentation method, map segmentation device, computer readable storage medium and processor
CN112749894A (en) Defect detection model evaluation method and device
CN113628286B (en) Video color gamut detection method, device, computing equipment and computer storage medium
CN114741616A (en) Method and device for measuring spatial position relationship and electronic equipment
CN112860828B (en) Positioning method and device, electronic equipment and storage medium
CN114359204A (en) Point cloud hole detection method and device and electronic equipment
US9030915B2 (en) System and method for swath overlap detection
CN108876885A (en) The Processing Method of Point-clouds and device of power equipment
CN114779225B (en) Iterative grid-based distributed radar target detection method and device
CN116261101A (en) Method and device for determining position of monitoring equipment, storage medium and electronic device
CN110730502B (en) Positioning method and device
CN112923916B (en) Map simplifying method and device, electronic equipment and machine-readable storage medium
CN111220173A (en) POI (Point of interest) identification method and device
CN115412928B (en) Flower arrangement base station identification method and device based on space technology

Legal Events

Date Code Title Description
PB01 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