CN113076719B - Geo-fence address code determining method, location determining method and device - Google Patents

Geo-fence address code determining method, location determining method and device Download PDF

Info

Publication number
CN113076719B
CN113076719B CN202110309554.XA CN202110309554A CN113076719B CN 113076719 B CN113076719 B CN 113076719B CN 202110309554 A CN202110309554 A CN 202110309554A CN 113076719 B CN113076719 B CN 113076719B
Authority
CN
China
Prior art keywords
address
address code
length
code
codes
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
CN202110309554.XA
Other languages
Chinese (zh)
Other versions
CN113076719A (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.)
Mashang Xiaofei Finance Co Ltd
Original Assignee
Mashang Xiaofei Finance 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 Mashang Xiaofei Finance Co Ltd filed Critical Mashang Xiaofei Finance Co Ltd
Priority to CN202110309554.XA priority Critical patent/CN113076719B/en
Publication of CN113076719A publication Critical patent/CN113076719A/en
Application granted granted Critical
Publication of CN113076719B publication Critical patent/CN113076719B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Remote Sensing (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Instructional Devices (AREA)

Abstract

The application provides a method and a device for determining address codes of geo-fences, wherein the method for determining the address codes of the geo-fences comprises the following steps: determining a plurality of address codes covering a first area to obtain a first address code set; the first area is an area enclosed by the outer boundary of a geographic fence, and the lengths of the address codes in the first address code set are at least partially different; determining a plurality of address codes covering holes included in the geo-fence to obtain a second address code set; and deleting the first target address code from the first address code set to obtain the address code set of the geo-fence. By the method for determining the address codes of the geo-fences, the number of the address codes covering the geo-fences can be reduced to reduce storage space, and meanwhile, the accuracy of the judgment result of the fence to which the position coordinates belong is improved.

Description

Geo-fence address code determining method, location determining method and device
Technical Field
The present application relates to the field of information processing technologies, and in particular, to a method and an apparatus for determining address codes and a method and an apparatus for determining locations of geo-fences.
Background
The address code may encode a geographic coordinate into a string. For example, the GeoHash can encode two-dimensional longitude and latitude coordinates into a character string, that is, the GeoHash code identifies a rectangular area on a map, all the longitude and latitude coordinates in the rectangular area correspond to the same GeoHash code, and in addition, the larger the length of the GeoHash code is, the smaller the rectangular area is identified.
Currently, whether a position coordinate is located in a certain geo-fence is often determined by determining whether an address code corresponding to the position coordinate is included in an address code set corresponding to the geo-fence, so as to improve the determination efficiency. However, in practical applications, if address codes with a larger length are used to cover a geo-fence, a large number of address codes are generated, which consumes a storage space, and if address codes with a smaller length are used to cover a geo-fence, the accuracy of determining the geo-fence to which a certain position coordinate belongs is low, especially when the geo-fence includes a hole, the accuracy of determining is low.
Disclosure of Invention
In order to solve the above technical problem, an embodiment of the present application provides a method for determining an address code of a geo-fence, a method for determining a location, and an apparatus for determining a location.
In a first aspect, an embodiment of the present application provides a method for determining an address code of a geo-fence, including:
determining a plurality of address codes covering a first area to obtain a first address code set; the first area is an area enclosed by the outer boundary of a geographic fence, the lengths of address codes in the first address code set are at least partially different, the first code length is greater than the second code length, the first code length is the length of an address code corresponding to the boundary area of the first area, and the second code length is the length of an address code corresponding to the central area of the first area;
determining a plurality of address codes covering holes included in the geo-fence to obtain a second address code set; the lengths of the address codes in the second address code set are all third code lengths, and the third code lengths are greater than or equal to the maximum code lengths of the address codes in the first address code set;
deleting a first target address code from the first address code set to obtain an address code set of the geo-fence, wherein the first target address code is an address code in the first address code set corresponding to an address code in the second address code set.
In a second aspect, an embodiment of the present application provides a position determining method, including:
c1: acquiring a geographic coordinate of a target point;
c2: calculating an eleventh address code corresponding to the target point according to the geographic coordinates of the target point; the length of the eleventh address code is a target length, an initial value of the target length is a sixth code length, the sixth code length is a minimum code length of address codes in an address code set of a geo-fence, and the address code set of the geo-fence is determined according to the method of any one of claims 1 to 9;
c3: determining that the target point is located within the geofence if the set of address codes for the geofence includes the first address code;
c4: if the address code set of the geo-fence does not include the first address code, adding a preset step length to the value of the target length, and returning to execute step C2 until the value of the target length is greater than a seventh code length, where the seventh code length is the maximum code length of the address codes in the address code set of the geo-fence;
c5: determining that the target point is outside the geo-fence.
In a third aspect, an embodiment of the present application further provides an address code determining apparatus for a geo-fence, including:
the first determining module is used for determining a plurality of address codes covering the first area to obtain a first address code set; the first area is an area enclosed by the outer boundary of a geographic fence, the lengths of address codes in the first address code set are at least partially different, the first code length is greater than the second code length, the first code length is the length of an address code corresponding to the boundary area of the first area, and the second code length is the length of an address code corresponding to the central area of the first area;
a second determining module, configured to determine a plurality of address codes covering holes included in the geofence, to obtain a second address code set; the lengths of the address codes in the second address code set are all third code lengths, and the third code lengths are greater than or equal to the maximum code lengths of the address codes in the first address code set;
a deleting module, configured to delete a first target address code from the first address code set to obtain an address code set of the geofence, where the first target address code is an address code in the first address code set that corresponds to an address code in the second address code set.
In a fourth aspect, an embodiment of the present application further provides a position determining apparatus, including:
the acquisition module is used for acquiring the geographic coordinates of the target point;
the calculation module is used for calculating an eleventh address code corresponding to the target point according to the geographic coordinates of the target point; the length of the eleventh address code is a target length, an initial value of the target length is a sixth code length, the sixth code length is a minimum code length of address codes in an address code set of a geo-fence, and the address code set of the geo-fence is determined according to the method of any one of claims 1 to 9;
a third determining module, configured to determine that the target point is located within the geofence if the set of address codes for the geofence includes the first address code;
a processing module, configured to add a preset step length to a value of the target length if the address code set of the geofence does not include the first address code, and return to the step of executing the eleventh address code corresponding to the target point calculated according to the geographic coordinates of the target point until the value of the target length is greater than a seventh code length, where the seventh code length is a maximum code length of the address codes in the address code set of the geofence;
a fourth determination module to determine that the target point is outside the geo-fence.
In a fifth aspect, the present application further provides an electronic device, including a processor, a memory, and a computer program stored on the memory and executable on the processor, where the computer program, when executed by the processor, implements the steps of the above-mentioned address code determination method for geo-fences, or implements the steps of the above-mentioned location determination method.
In a sixth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the above-mentioned address code determination method for geo-fences, or implements the steps of the above-mentioned location determination method.
In the embodiment of the application, the length of the address code covering the boundary area of the first area is greater than that of the address code covering the central area of the first area, so that the number of the address codes covering the first area can be reduced, the edge part of the geo-fence can be refined, and the accuracy of judging the geo-fence to which the position coordinate belongs can be improved; in addition, the length of the address code covering the hole is greater than or equal to the maximum code length of the address code covering the first area, so as to refine the hole area of the geo-fence.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a flowchart of an address code determination method for a geo-fence according to an embodiment of the present application;
fig. 2 is a schematic diagram of a perforated geofence provided by embodiments of the present application;
fig. 3a to 3i are schematic diagrams illustrating the determination of an address code covering an area enclosed by an outer boundary of a geo-fence according to an embodiment of the present application;
FIGS. 4 a-4 b are schematic diagrams of address codes for determining covered holes according to embodiments of the present disclosure;
fig. 5 is a schematic diagram of address codes corresponding to geo-fences supporting holes according to an embodiment of the present disclosure;
fig. 6 is a flowchart of a position determination method provided in an embodiment of the present application;
fig. 7 is a block diagram of an address code determination device for a geo-fence according to an embodiment of the present application;
fig. 8 is a block diagram of a position determination apparatus provided in an embodiment of the present application;
fig. 9 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The electronic device may be a portable electronic device, such as a cell phone, a tablet computer, a wearable electronic device with wireless communication capabilities (e.g., a smart watch), etc., that also contains other functionality, such as personal digital assistant and/or music player functionality. Exemplary embodiments of the portable electronic device include, but are not limited to, portable electronic devices that carry an IOS system, an Android system, a Microsoft system, or other operating system. The portable electronic device may also be other portable electronic devices such as a Laptop computer (Laptop) or the like. It should also be understood that in other embodiments, the electronic device may not be a portable electronic device, but may be a desktop computer.
Referring to fig. 1, fig. 1 is a flowchart of an address code determination method for a geo-fence according to an embodiment of the present application, where the method is applied to an electronic device, and as shown in fig. 1, the method includes the following steps:
step 101, determining a plurality of address codes covering a first area to obtain a first address code set; the first area is an area enclosed by the outer boundary of a geo-fence, the lengths of address codes in the first address code set are at least partially different, the first code length is greater than the second code length, the first code length is the length of an address code corresponding to the boundary area of the first area, and the second code length is the length of an address code corresponding to the central area of the first area.
In the present embodiment, the geo-fence is a geo-fence including a hole, for example, as shown in fig. 2, the geo-fence 10 includes a hole 11. It should be noted that the number of the holes may be one or more, which is not limited herein. The first area, which is the area enclosed by the outer boundary of the geo-fence, includes the area of the geo-fence and the area of the hole, for example, as shown in fig. 2, the white filled area (i.e., the area of the geo-fence 10) plus the cross-line filled area (i.e., the area of the hole 11) is the area enclosed by the outer boundary of the geo-fence 10.
The address coding in the embodiment of the present application may be, for example, GeoHash coding.
The plurality of address codes covering the first area may refer to a plurality of address codes corresponding to a plurality of rectangular areas covering the first area, that is, a plurality of rectangular areas corresponding to the plurality of address codes cover the first area. In addition, the plurality of address codes covering the first area comprise address codes positioned in the first area and address codes intersected with the first area. It is to be understood that the address code being located within the first region may refer to the rectangular region corresponding to the address code being located within the first region, and the address code intersecting the first region may refer to the rectangular region corresponding to the address code intersecting the first region.
The border area and the central area of the first area may be understood as two opposite concepts, e.g. the border area of the first area may be understood as an area closer to the outer border of the geofence and the central area of the first area may be understood as an area closer to the central position of the first area.
In this embodiment, the length of the address code corresponding to the boundary area of the first area is greater than the length of the address code corresponding to the central area of the first area, that is, the length of the address code covering the boundary area of the first area is greater than the length of the address code covering the central area of the first area, so that the number of the address codes covering the first area can be reduced, and meanwhile, the edge portion of the geofence can be refined, thereby improving the accuracy of the geofence determination to which the position coordinate belongs.
Step 102, determining a plurality of address codes covering holes included in the geo-fence to obtain a second address code set; the lengths of the address codes in the second address code set are all third code lengths, and the third code lengths are greater than or equal to the maximum code lengths of the address codes in the first address code set.
In this embodiment, the third encoding length is greater than or equal to the maximum encoding length of the address encoding in the first address encoding set, for example, the third encoding length may be a preset encoding length, and the maximum encoding length of the address encoding in the first address encoding set may be less than or equal to the preset encoding length. The plurality of address codes covering the hole in the geo-fence may include a plurality of address codes of a third code length, where the corresponding rectangular area is located in the hole.
In this step, the length of the address code for covering the hole is greater than or equal to the maximum code length of the address code for covering the first area, so as to refine the hole area of the geofence.
Step 103, deleting a first target address code from the first address code set to obtain an address code set of the geo-fence, where the first target address code is an address code in the first address code set corresponding to an address code in the second address code set.
In this step, the address code corresponding to the first target address code, that is, the address code in the second address code set, may be deleted from the first address code set, for example, each address code in the first address code set may be converted into an address code corresponding to the third code length to obtain a converted first address code set, then the address code identical to the address code in the second address code set is deleted from the converted first address code set, and then each address code in the deleted first address code set is restored to the address code of the code length before conversion, so as to obtain a geo address code set.
According to the method for determining the address codes of the geo-fence, the boundary area and the central area of the first area are covered by the address codes with different lengths, the number of the address codes covering the geo-fence is reduced to reduce the storage space, and meanwhile the accuracy of the judgment result of the fence to which the position coordinates belong is improved. In addition, the holes in the geofence are covered by the address codes with the length greater than or equal to the maximum value of the lengths of the address codes covering the first area, and the address codes corresponding to the address codes covering the holes in the geofence are deleted from the address codes covering the first area as the address codes of the geofence, so that the accuracy of the result of the position judgment of the geofence with the holes can be improved.
Optionally, the determining a plurality of address codes covering the first area to obtain the first address code set includes:
determining a minimum circumscribed rectangular area of the geofence, obtaining a first rectangular area;
determining a fourth coding length according to the first rectangular area and a preset coding length; the fourth coding length is the minimum value in a first coding length set, each coding length in the first coding length set is smaller than the preset coding length, and the width of a rectangular area corresponding to each coding length in the first coding length set is smaller than the diagonal length of the first rectangular area;
and determining the first address coding set according to the fourth coding length and the preset coding length.
In this embodiment, the preset encoding length may be reasonably set according to actual requirements, for example, the preset encoding length may be 7, 8, or 9. The first encoding length set includes all encoding lengths which are smaller than the preset encoding length and the width of the corresponding rectangular area is smaller than the diagonal length of the first rectangular area. The fourth code length is the minimum code length in the first code length set.
The minimum bounding rectangular area of the geofence can be obtained by traversing the geographic coordinates of the vertices of the outer boundary of the geofence to obtain the corresponding maximum longitude, maximum latitude, and maximum latitude of the geofence, and can be determined according to the corresponding maximum longitude, maximum latitude, and maximum latitude of the geofence, for example, the minimum bounding rectangular area 21 of the geofence 20 shown in fig. 3 a.
Alternatively, the diagonal length of the first rectangular region may be calculated according to a Haversine formula (i.e., a hemiversine formula), and similarly, the width of the rectangular region corresponding to each coding length may also be calculated according to the Haversine formula.
Alternatively, the fourth encoding length may be determined as follows:
according to the preset code length and the lower left corner coordinate of the first rectangular area, determining an address code a1 with the length being the preset code length corresponding to the lower left corner coordinate of the first rectangular area; if the width of the rectangular area corresponding to the address code a1 is smaller than the diagonal length of the first rectangular area, determining that the length corresponding to the lower left corner coordinate of the first rectangular area is the address code a2, and the length of the address code a2 is the preset code length-1; if the width of the rectangular area corresponding to the address code a2 is smaller than the diagonal length of the first rectangular area, determining the address code a3 corresponding to the lower left corner coordinate of the first rectangular area, wherein the length of the address code a3 is the preset code length-2; and repeating the steps until the width of the rectangular region corresponding to the address code with the length corresponding to the lower left corner coordinate of the first rectangular region being the preset code length-K is greater than the diagonal length of the first rectangular region, and taking the preset code length-K +1 as the fourth code length, wherein K is a positive integer.
Specifically, after the fourth encoding length is obtained, a plurality of address codes covering the first area may be determined based on the fourth encoding length and the preset encoding length to obtain a first address code set, for example, the encoding lengths may be increased from the fourth encoding length by a preset step until the preset encoding length is reached, address codes located in the first area and address codes intersecting with the first area in the address codes corresponding to the respective encoding lengths may be respectively obtained, and a plurality of address codes covering the first area may be determined according to the address codes located in the first area and the address codes intersecting with the first area in the address codes corresponding to the respective encoding lengths to obtain the first address code set.
In the embodiment of the application, a first rectangular area is obtained by determining the minimum circumscribed rectangular area of the geo-fence; determining a fourth coding length according to the first rectangular area and a preset coding length; the fourth coding length is the minimum value in a first coding length set, each coding length in the first coding length set is smaller than the preset coding length, and the width of a rectangular area corresponding to each coding length in the first coding length set is smaller than the diagonal length of the first rectangular area; and determining the first address coding set according to the fourth coding length and the preset coding length, so as to obtain a coding length which is more suitable for covering the first area.
The following describes in detail the determination of the first address code set according to the fourth code length and the preset code length with reference to fig. 3a to 3 i.
Optionally, the determining the first address encoding set according to the fourth encoding length and the preset encoding length may include:
a1: determining a plurality of first address codes covering the first area, wherein the length of the first address codes is the length of the fourth code;
a2: determining a first address code of the plurality of first address codes that is located within the first region and determining a first address code of the plurality of first address codes that intersects the first region;
a3: determining a second address code of a plurality of second address codes that is located within the first region and a second address code that intersects the first region; the second address codes are multiple address codes corresponding to a second target address code, the starting value of the second target address code is a first address code which is intersected with the first area in the first address codes, the length of the second address code is a first target code length, and the starting value of the first target code length is the fourth code length plus a preset step length;
a4: updating the value of the second target address code to a second address code which is intersected with the first area in the plurality of second address codes; adding a preset step length to the value of the first target coding length, and returning to execute the step A3 until the value of the first target coding length is larger than the preset coding length;
wherein the first address code set comprises a first address code located in the first region from among the plurality of first address codes, a second address code located in the first region from among the plurality of determined second address codes, and a second address code intersecting the first region from among the plurality of last determined second address codes.
In this embodiment, the preset step length may be reasonably set according to actual requirements, for example, the preset step length may be 1. For example, if the second target address code is an address code of a fourth code length, and the length of the second address code is the fourth code length plus 1, each second target address code corresponds to 32 second address codes.
The determining a specific address code located in the first region and a specific address code intersecting with the first region from among the plurality of specific address codes may include: respectively judging the position relation between each specific address code and the first area, wherein the position relation comprises that the specific address code is positioned in the first area or the specific address code is intersected with the first area; according to the position relation between each specific address code and the first area, acquiring a specific address code located in the first area from the specific address codes, and acquiring a specific address code intersected with the first area from the specific address codes. The specific address code may include a first address code or a second address code.
The determining the position relationship between the specific address code and the first area may include: if four vertexes of the rectangular area corresponding to the specific address code are all located in the first area, determining that the specific address code is the address code located in the first area; and if only partial vertexes of the four vertexes of the rectangular area corresponding to the specific address code are located in the first area, determining that the specific address code is an address code intersected with the first area.
Optionally, in order to improve the accuracy of the determination, when four vertices of the rectangular region corresponding to the specific address code are all located in the first region, it may be further determined whether a first boundary point is located in the rectangular region corresponding to the specific address code, where the first boundary point is a point on an outer boundary of the geo-fence, if not, it is determined that the specific address code is an address code located in the first region, and if so, it is determined that the specific address code is an address code intersecting with the first region.
The fourth encoding length is S1, the preset step size is 1, and the preset encoding length is S2:
the first area can be covered by address codes with the length of S1, and a plurality of address codes b0 covering the first area are obtained; for the address code b0 intersecting with the first area in the plurality of address codes b0 covering the first area, the address code b1 and the address code b1 intersecting with the first area in the address code b1 with the length of S1+1 corresponding to the first area may be determined, for the address code b1 intersecting with the first area, the address code b2 and the address code b2 intersecting with the first area in the address code b2 with the length of S1+2 corresponding to the first area may be determined, and so on until S1+ k is greater than S2, and k is a positive integer, for example, as shown in fig. 3e to 3 i.
Wherein the plurality of address codes covering the first region may include an address code b0 located within the first region, an address code b1 located within the first region, an address code b2 located within the first region up to an address code b (k-1) located within the first region, and an address code b (k-1) intersecting the first region, wherein the address code b (k-1) is an address code having a length of S1+ (k-1).
According to the method and the device, the length of the address code intersected with the first area is gradually increased from the fourth code length to the preset code length according to the preset step length, the effect of gradually refining the outer boundary of the geo-fence can be achieved, the number of the address codes covering the geo-fence can be further reduced to reduce the storage space, and meanwhile, the accuracy of the judgment result of the fence to which the position coordinate belongs is improved.
Optionally, in a case that four vertices of a second rectangular region corresponding to the second address code are located within the first region, the second address code is an address code located within the first region;
in the case where only a part of the four vertices of the second rectangular region is located within the first region, the second address code is an address code that intersects the first region;
in the case where four vertices of the second rectangular region are all located outside the first region and there is a first boundary point located inside the second rectangular region, the second address encoding is an address encoding that intersects the first region, the first boundary point being a point on an outer boundary of the geofence.
In practical applications, the outer boundary of the geofence may include a convex portion, and in order to improve the accuracy of the determination, for any second address code, under the condition that four vertices of the rectangular region corresponding to the second address code are located outside the first region, it may be further determined whether a boundary point exists on the outer boundary of the geofence and is located inside the rectangular region corresponding to the second address code, and under the condition that a boundary point exists on the outer boundary of the geofence and is located inside the rectangular region corresponding to the second address code, it is determined that the second address code is an address code that intersects with the first region, otherwise, it may be determined that the second address code is an address code that is located outside the first region.
In the embodiment of the present application, when four vertices of the second rectangular region are located outside the first region and there is a first boundary point located inside the second rectangular region, the second address code is determined to be an address code intersecting the first region, so that the accuracy of the determination can be improved.
Optionally, in a case that four vertices of a second rectangular region corresponding to the second address code are all located within the first region, and no boundary point on the outer boundary of the geofence is located within the second rectangular region, the second address code is an address code located within the first region.
In practical applications, the outer boundary of the geofence may also include a concave portion, and in order to improve the accuracy of the determination, for any second address code, under the condition that four vertices of the rectangular region corresponding to the second address code are all located within the first region, it may be further determined whether a boundary point exists on the outer boundary of the geofence and is located within the rectangular region corresponding to the second address code, if not, it is determined that the second address code is the address code located within the first region, otherwise, it is determined that the second address code is the address code intersecting with the first region. That is, in the case that four vertices of a second rectangular region corresponding to the second address code are all located within the first region and a first boundary point is located within the second rectangular region, the second address code is an address code located within the first region;
optionally, the determining a plurality of first address encodings covering the first area includes:
calculating a third address code corresponding to the first target vertex according to the fourth code length and the geographic coordinates of the first target vertex of the first rectangular area, wherein the length of the third address code is the fourth code length;
determining the plurality of first address encodings from the third address encoding.
In this embodiment, the first target vertex may be any vertex of the first rectangular region, for example, a lower left corner vertex, a lower right corner vertex, an upper left corner vertex, an upper right corner vertex, or the like of the first rectangular region.
In practical application, a rectangular region corresponding to a third address code corresponding to a first target vertex may be used as a starting region, and first address codes covering the first region may be sequentially obtained according to a preset order, for example, if the first target vertex is an upper left vertex, a rectangular region corresponding to the third address code corresponding to the upper left vertex may be used as the starting region, and the first address codes covering the first region may be sequentially obtained from left to right and from top to bottom; or if the first target vertex is an upper right vertex, then a rectangular region corresponding to a third address code corresponding to the upper right vertex may be used as an initial region, and the first address codes covering the first region are sequentially obtained from right to left and from top to bottom.
According to the method and the device for determining the first address codes, the plurality of first address codes covering the first area are determined according to the third address code corresponding to the first target vertex, and compared with the method and the device for determining the first address codes located in the first area by matching all the first address codes, the efficiency of determining the plurality of first address codes covering the first area can be improved.
Optionally, the determining the plurality of first address codes according to the third address code includes:
if the maximum longitude corresponding to the third rectangular area corresponding to the third address code is smaller than the first longitude, acquiring a fourth address code, and determining whether the maximum longitude corresponding to the fourth rectangular area corresponding to the fourth address code is smaller than the first longitude; the first longitude is the maximum longitude corresponding to the first rectangular area, the length of the fourth address code is the fourth code length, and the fourth rectangular area is located on the right side of the third rectangular area and adjacent to the third rectangular area;
if the maximum latitude corresponding to the third rectangular area is smaller than the first latitude, acquiring a fifth address code, and determining whether the maximum longitude corresponding to the fifth rectangular area corresponding to the fifth address code is smaller than the first longitude; the first longitude is the maximum latitude corresponding to the first rectangular area, the length of the fifth address code is the fourth code length, and the fifth rectangular area is located on the upper side of the third rectangular area and is adjacent to the third rectangular area;
wherein the plurality of first address encodings includes the fourth address encoding and the fifth address encoding.
In this embodiment, a rectangular area corresponding to the third address code corresponding to the vertex of the lower left corner may be used as the start area, and the first address codes covering the first area are sequentially obtained from left to right and from bottom to top, as shown in fig. 3b to fig. 3 e. The examples of the present application are illustrated below by way of examples:
assume that the third address corresponding to the vertex in the lower left corner is encoded as address code e 11. In the case that the maximum longitude corresponding to the rectangular area corresponding to the address code e11 is smaller than the maximum longitude corresponding to the first rectangular area, as shown in fig. 3b, the maximum longitude corresponding to the rectangular area 22 corresponding to the address code e11 is smaller than the maximum longitude corresponding to the first rectangular area 21, and the address code e12 adjacent to the rectangular area corresponding to the address code e11 can be obtained, as shown in fig. 3bIn the case that the maximum longitude corresponding to the rectangular area corresponding to the address code e12 is smaller than the maximum longitude corresponding to the first rectangular area, as shown in fig. 3c, the address code e13 right adjacent to the rectangular area corresponding to the address code e12 may be obtained, and so on until the address code e1k1The maximum longitude corresponding to the corresponding rectangular area is not less than the maximum longitude corresponding to the first rectangular area, where k is1Is a positive integer.
In the case that the maximum latitude corresponding to the rectangular region corresponding to the address code e11 is smaller than the maximum latitude corresponding to the first rectangular region, the address code e21 adjacent to the rectangular region corresponding to the corresponding rectangular region and the address code e11 may be obtained, as shown in fig. 3d, and the same processing procedure as the above-mentioned address code e11 may be performed on the address code e21, and so on until the obtained address code ek ismknThe maximum latitude corresponding to the corresponding rectangular area is not less than the maximum latitude corresponding to the first rectangular area, wherein k ismAnd knAre all positive integers.
The right adjacent may be defined as being positioned on the right side and adjacent to each other, and the upper adjacent may be defined as being positioned on the upper side and adjacent to each other. The plurality of first address codes covering the first area may include the obtained address codes, i.e., the address code e11 to the address code ekmkn
According to the method and the device, the rectangular area corresponding to the third address code corresponding to the vertex at the lower left corner is used as the starting area, the first address codes covering the first area are sequentially acquired from left to right and from bottom to top, and the efficiency and the accuracy of determining the plurality of first address codes covering the first area can be improved.
Optionally, the determining a plurality of address codes covering holes included in the geofence to obtain a second set of address codes includes:
determining a minimum external rectangular area of the hole to obtain a sixth rectangular area;
calculating a sixth address code corresponding to a second target vertex of the sixth rectangular area according to the third code length and the geographic coordinates of the second target vertex, wherein the length of the sixth address code is the third code length;
determining a plurality of seventh address codes covering the holes according to the sixth address codes, wherein the length of the seventh address codes is the length of the third codes;
and acquiring the address codes positioned in the holes in the plurality of seventh address codes to obtain the second address code set.
In this embodiment, the determining the minimum bounding rectangular area of the hole in the geo-fence may be obtained by traversing the geographic coordinates of each point of the outer boundary of the hole to obtain the maximum longitude, the minimum longitude, the maximum latitude and the minimum latitude corresponding to the hole, and determining the minimum bounding rectangular area of the hole according to the maximum longitude, the minimum longitude, the maximum latitude and the minimum latitude corresponding to the hole, for example, the minimum bounding rectangular area 30 of the hole 31 shown in fig. 4 a.
The second target vertex may be an upper left vertex, an upper right vertex, a lower left vertex, a lower right vertex, or the like of the sixth rectangular region.
The determining of the plurality of seventh address codes covering the holes according to the sixth address code may be to take a rectangular region corresponding to the sixth address code as an initial region and obtain the seventh address codes covering the holes according to a preset order, for example, if the second target vertex is an upper left vertex, the rectangular region corresponding to the sixth address code corresponding to the upper left vertex may be taken as the initial region, and the address codes covering the holes are sequentially obtained from left to right and from top to bottom; or if the second target vertex is an upper right vertex, the seventh address code covering the hole may be sequentially obtained from right to left and from top to bottom by using a rectangular region corresponding to the sixth address code corresponding to the upper right vertex as the starting region, as shown in fig. 4 b.
It should be noted that the detailed processing procedure for determining the plurality of seventh address codes covering the hole according to the sixth address code may refer to the procedure for determining the plurality of first address codes according to the third address code, which is not described herein again.
The obtaining of the address codes located in the holes in the seventh address codes to obtain the second address code set may include obtaining the seventh address codes where four vertices of the rectangular regions corresponding to the seventh address codes are located in the holes.
In the embodiment of the present application, a plurality of seventh address codes covering the hole are determined according to the sixth address code, so that efficiency of determining a plurality of seventh address codes covering the hole in the geofence can be improved, and in addition, the address codes located in the hole in the plurality of seventh address codes are obtained to obtain the second address code set.
Optionally, when four vertices of a seventh rectangular region corresponding to the seventh address code are all located in the hole and there is no second boundary point located in the seventh rectangular region, the seventh address code is an address code located in the hole, and the second boundary point is a point on an outer boundary of the hole.
In practical applications, the outer boundary of the hole may include a concave portion, and in order to improve the accuracy of the determination, for any seventh address code, under the condition that four vertices of the rectangular region corresponding to the seventh address code are located inside the hole, it may be further determined whether a boundary point exists on the outer boundary of the hole and is located inside the rectangular region corresponding to the seventh address code, if no vertex exists on the outer boundary of the hole and is located inside the rectangular region corresponding to the seventh address code, it is determined that the seventh address code is the address code located inside the hole, otherwise, it is determined that the seventh address code is not the address code located inside the hole.
It can be understood that, in this embodiment, for each seventh address code covering a hole in the geofence, whether the seventh address code is an address code located within the hole can be determined by the above-mentioned determining method, and then the seventh address code located within the hole in the plurality of seventh address codes covering the hole in the geofence can be obtained.
According to the embodiment of the application, under the condition that the four vertexes of the seventh rectangular area corresponding to the seventh address code are all located in the hole and no second boundary point is located in the seventh rectangular area, the seventh address code is judged to be the address code located in the hole, and the judgment accuracy can be improved.
Optionally, the deleting the first target address code from the first address code set to obtain the address code set of the geo-fence includes:
b1: deleting an eighth address code from the first address code set to obtain a third address code set, wherein the eighth address code is the same address code in the first address code set and the second address code set;
b2: if the second target coding length is larger than a fifth coding length, subtracting a preset step length from the value of the second target coding length; the initial value of the second target coding length is the third coding length, and the fifth coding length is the minimum coding length of the address codes in the first address code set;
b3: determining a ninth address code corresponding to each address code in a fourth address code set to obtain a fifth address code set, where an initial element of the fourth address code set is an address code in the second address code set except for the eighth address code, and the length of the ninth address code is the second target code length;
b4: deleting a tenth address code from a sixth address code set to obtain a seventh address code set, wherein an initial element of the sixth address code set is an address code in the third address code set, and the tenth address code is the same address code in the sixth address code set and the fifth address code set;
b5: updating the elements of the fourth address coding set to address codes in the fifth address coding set except the tenth address code; updating the elements of the sixth address code set to address codes in the seventh address code set, and returning to execute step B2 until the second target code length is less than or equal to the fifth code length;
wherein the set of address encodings for the geofence is the seventh set of address encodings.
The following description takes the third encoding length as L1, the preset step size as 1, the minimum encoding length of the address encoding in the first address encoding set as L0, the first address encoding set as U1, and the second address encoding set as U2 as examples:
deleting the address code which is the same as the address code set U2 from the address code set U1 to obtain an address code set U3, if the L1 is greater than the L0, obtaining the address code which is L1-1 in length and corresponds to each address code in the address code set U4 to obtain an address code set U5, wherein the address code set U4 comprises the address codes in the address code set U2 except the address code which is the same as the address code set U1; deleting the address code which is the same as the address code set U5 from the address code set U3 to obtain an address code set U6, and if L1-1 is greater than L0, obtaining the address code which is L1-2 in length and corresponds to each address code in the address code set U7 to obtain an address code set U8, wherein the address code set U7 comprises the address codes in the address code set U5 except the address code which is the same as the address code set U3, and so on until L1-r is less than or equal to L0, and r is a positive integer, and obtaining the address code set corresponding to the hole-supporting geo-fence, for example, as shown in FIG. 5.
According to the method and the device, the coding length corresponding to the address codes in the second address code set is gradually reduced according to the preset step length to be compared with the address codes in the first code set to determine the address code set corresponding to the geo-fence, so that the accuracy of position judgment of the determined address code set corresponding to the geo-fence can be improved.
Referring to fig. 6, fig. 6 is a flowchart of a position determining method provided in an embodiment of the present application, where the method is applied to an electronic device, and as shown in fig. 6, the method includes the following steps:
step 601, obtaining the geographic coordinates of the target point.
In this embodiment, the target point may be any point that needs to be subjected to position determination. The geographical coordinates may include longitude and latitude.
Step 602, calculating an eleventh address code corresponding to the target point according to the geographic coordinates of the target point; the length of the eleventh address code is a target length, the initial value of the target length is a sixth code length, the sixth code length is the minimum code length of the address codes in the address code set of the geo-fence, and the address code set of the geo-fence is determined according to the address code determination method of the geo-fence.
In this embodiment, the address code set of the geofence may be determined according to the address code determination method of the geofence of any embodiment, where the relevant content of the address code determination method of the geofence may refer to the foregoing discussion, and is not described herein again.
Step 603, if the address code set of the geofence includes the first address code, determining that the target point is located within the geofence.
Step 604, if the address code set of the geo-fence does not include the first address code, adding a preset step length to the value of the target length, and returning to execute step 602 until the value of the target length is greater than a seventh code length, where the seventh code length is a maximum code length of the address codes in the address code set of the geo-fence.
In this step, if the value of the target length is less than or equal to the seventh encoding length, the step 602 is executed again; if the value of the target length is greater than the seventh encoding length, step 605 is executed.
Step 605, determining that the target point is located outside the geo-fence.
The following description takes the target point as point a, the minimum encoding length of the address code in the address code set of the geofence is L0, and the preset step size is 1 as an example:
according to the longitude and latitude of the point A, calculating an address code f0 with the length of L0 corresponding to the point A, determining that the point A is located in a geo-fence B if the address code f0 belongs to the address code set of the geo-fence B, determining that the point A is located in the geo-fence B if the address code f0 does not belong to the address code set of the geo-fence B, calculating an address code f1 with the length of L0+1 corresponding to the point A, determining that the point A is located in the geo-fence B if the address code f1 belongs to the address code set of the geo-fence B, determining that the point A is located outside the geo-fence B if the address code f1 does not belong to the address code set of the geo-fence B, calculating an address code f2 with the length of L0-2 corresponding to the point A, and so on until L0+ p is larger than the maximum value of the length of the address codes in the address code set of the geo-fence, and determining that the point A is located outside the geo-fence B, wherein p is a positive integer.
According to the embodiment of the application, whether the target point is located in the geofence or not is judged by gradually increasing the length of the address code corresponding to the target point according to the preset step length and comparing the length with the address code of the address code set of the geofence, so that the accuracy of position judgment can be improved.
Optionally, the determining that the target point is located within the geofence if the set of address codes of the geofence includes the first address code comprises:
if the address code set of the geo-fence comprises the first address code, determining whether the target point is located in the geo-fence or not in a geometric operation mode;
and if the target point is determined to be located in the geofence through the geometric operation, determining that the target point is located in the geofence.
Since the address code located at the boundary of the geofence may include points outside the geofence, it may happen that the determination result is inaccurate if the determination result is directly determined whether the target point is located within the geofence according to whether the address code corresponding to the target point belongs to the set of address codes of the geofence. Therefore, in the embodiment of the present application, when the address code of the target length corresponding to the target point belongs to the address code set of the geofence, it may be further determined whether the target point is located in the geofence by means of geometric operation, that is, whether the above determination target point is located in the geofence is equivalent to whether the determination point (target point) is located in a geometric shape (i.e., the geofence), and when it is determined that the target point is located in the geofence by means of geometric operation, it is determined that the target point is located in the geofence, otherwise, it is determined that the target point is located outside the geofence, so that the accuracy of the determination may be improved.
It should be noted that, in the case that there are multiple geofences, the address code set corresponding to each geofence may be determined according to the method for determining address codes of geofences in any of the above embodiments, and may be stored in the redis memory in a manner of key value pairs, where a key (key) in a key value pair stores an address code corresponding to a geofence, and a value (value) stores information of a geofence. Thus, for a point, the geofence to which the point belongs can be queried from the redis memory.
Referring to fig. 7, fig. 7 is a block diagram of an address code determination device for a geo-fence according to an embodiment of the present application. As shown in fig. 7, the address code determination apparatus 700 of the geo-fence includes:
a first determining module 701, configured to determine multiple address codes covering a first area, to obtain a first address code set; the first area is an area enclosed by the outer boundary of a geographic fence, the lengths of address codes in the first address code set are at least partially different, the first code length is greater than the second code length, the first code length is the length of an address code corresponding to the boundary area of the first area, and the second code length is the length of an address code corresponding to the central area of the first area;
a second determining module 702, configured to determine a plurality of address codes covering holes included in the geofence, to obtain a second set of address codes; the lengths of the address codes in the second address code set are all third code lengths, and the third code lengths are greater than or equal to the maximum code lengths of the address codes in the first address code set;
a deleting module 703 is configured to delete a first target address code from the first address code set to obtain an address code set of the geofence, where the first target address code is an address code in the first address code set that corresponds to an address code in the second address code set.
Optionally, the first determining module includes:
a first determining unit, configured to determine a minimum bounding rectangular region of the geofence, so as to obtain a first rectangular region;
the second determining unit is used for determining a fourth coding length according to the first rectangular area and a preset coding length; the fourth coding length is the minimum value in a first coding length set, each coding length in the first coding length set is smaller than the preset coding length, and the width of a rectangular area corresponding to each coding length in the first coding length set is smaller than the diagonal length of the first rectangular area;
a third determining unit, configured to determine the first address encoding set according to the fourth encoding length and the preset encoding length.
Optionally, the third determining unit is specifically configured to:
a1: determining a plurality of first address codes covering the first area, wherein the length of the first address codes is the length of the fourth code;
a2: determining a first address code of the plurality of first address codes that is located within the first region and determining a first address code of the plurality of first address codes that intersects the first region;
a3: determining a second address code of a plurality of second address codes that is located within the first region and a second address code that intersects the first region; the second address codes are multiple address codes corresponding to a second target address code, the starting value of the second target address code is a first address code which is intersected with the first area in the first address codes, the length of the second address code is a first target code length, and the starting value of the first target code length is the fourth code length plus a preset step length;
a4: updating the value of the second target address code to a second address code which is intersected with the first area in the plurality of second address codes; adding a preset step length to the value of the first target coding length, and returning to execute the step A3 until the value of the first target coding length is larger than the preset coding length;
wherein the first address code set comprises a first address code located in the first region from among the plurality of first address codes, a second address code located in the first region from among the plurality of determined second address codes, and a second address code intersecting the first region from among the plurality of last determined second address codes.
Optionally, in a case that four vertices of a second rectangular region corresponding to the second address code are located within the first region, the second address code is an address code located within the first region;
in the case where only a part of the four vertices of the second rectangular region is located within the first region, the second address code is an address code that intersects the first region;
in the case where four vertices of the second rectangular region are all located outside the first region and there is a first boundary point located inside the second rectangular region, the second address encoding is an address encoding that intersects the first region, the first boundary point being a point on an outer boundary of the geofence.
Optionally, the third determining unit is specifically configured to:
calculating a third address code corresponding to the first target vertex according to the fourth code length and the geographic coordinates of the first target vertex of the first rectangular area, wherein the length of the third address code is the fourth code length;
determining the plurality of first address encodings from the third address encoding.
Optionally, the first target vertex is a vertex at a lower left corner, and the third determining unit is specifically configured to:
if the maximum longitude corresponding to the third rectangular area corresponding to the third address code is smaller than the first longitude, acquiring a fourth address code, and determining whether the maximum longitude corresponding to the fourth rectangular area corresponding to the fourth address code is smaller than the first longitude; the first longitude is the maximum longitude corresponding to the first rectangular area, the length of the fourth address code is the fourth code length, and the fourth rectangular area is located on the right side of the third rectangular area and adjacent to the third rectangular area;
if the maximum latitude corresponding to the third rectangular area is smaller than the first latitude, acquiring a fifth address code, and determining whether the maximum longitude corresponding to the fifth rectangular area corresponding to the fifth address code is smaller than the first longitude; the first longitude is the maximum latitude corresponding to the first rectangular area, the length of the fifth address code is the fourth code length, and the fifth rectangular area is located on the upper side of the third rectangular area and is adjacent to the third rectangular area;
wherein the plurality of first address encodings includes the fourth address encoding and the fifth address encoding.
Optionally, the second determining module includes:
the fourth determining unit is used for determining the minimum external rectangular area of the hole to obtain a sixth rectangular area;
a calculating unit, configured to calculate a sixth address code corresponding to a second target vertex of the sixth rectangular region according to the third code length and a geographic coordinate of the second target vertex, where the length of the sixth address code is the third code length;
a fifth determining unit, configured to determine, according to the sixth address code, a plurality of seventh address codes covering the hole, where a length of the seventh address code is the third code length;
and the obtaining unit is used for obtaining the address codes positioned in the holes in the plurality of seventh address codes to obtain the second address code set.
Optionally, when four vertices of a seventh rectangular region corresponding to the seventh address code are all located in the hole and there is no second boundary point located in the seventh rectangular region, the seventh address code is an address code located in the hole, and the second boundary point is a point on an outer boundary of the hole.
Optionally, the deleting module is specifically configured to:
b1: deleting an eighth address code from the first address code set to obtain a third address code set, wherein the eighth address code is the same address code in the first address code set and the second address code set;
b2: if the second target coding length is larger than a fifth coding length, subtracting a preset step length from the value of the second target coding length; the initial value of the second target coding length is the third coding length, and the fifth coding length is the minimum coding length of the address codes in the first address code set;
b3: determining a ninth address code corresponding to each address code in a fourth address code set to obtain a fifth address code set, where an initial element of the fourth address code set is an address code in the second address code set except for the eighth address code, and the length of the ninth address code is the second target code length;
b4: deleting a tenth address code from a sixth address code set to obtain a seventh address code set, wherein an initial element of the sixth address code set is an address code in the third address code set, and the tenth address code is the same address code in the sixth address code set and the fifth address code set;
b5: updating the elements of the fourth address coding set to address codes in the fifth address coding set except the tenth address code; updating the elements of the sixth address code set to address codes in the seventh address code set, and returning to execute step B2 until the second target code length is less than or equal to the fifth code length;
wherein the set of address encodings for the geofence is the seventh set of address encodings.
The device 700 for determining an address code of a geo-fence according to the embodiment of the present application can implement each process in the foregoing method for determining an address code of a geo-fence, and for avoiding repetition, details are not described here.
The device 700 for determining address codes of a geo-fence according to the embodiment of the present application covers the boundary area and the central area of the area enclosed by the outer boundary of the geo-fence by address codes of different lengths, covers the hole in the geo-fence by using the address code whose length is greater than or equal to the maximum value of the lengths of the address codes covering the area enclosed by the outer boundary of the geo-fence, and deletes the address code corresponding to the address code covering the hole in the geo-fence from the address codes covering the area enclosed by the outer boundary of the geo-fence as the address code of the geo-fence, so that the number of the address codes covering the geo-fence can be reduced to reduce the storage space, and the accuracy of the judgment result of the fence to which the position coordinate belongs can be improved.
Referring to fig. 8, fig. 8 is a structural diagram of a position determination device according to an embodiment of the present application. As shown in fig. 8, the position determination apparatus 800 includes:
an obtaining module 801, configured to obtain geographic coordinates of a target point;
a calculating module 802, configured to calculate an eleventh address code corresponding to the target point according to the geographic coordinates of the target point; the length of the eleventh address code is a target length, an initial value of the target length is a sixth code length, the sixth code length is a minimum code length of address codes in an address code set of a geo-fence, and the address code set of the geo-fence is determined according to the method of any one of claims 1 to 9;
a third determining module 803, configured to determine that the target point is located within the geofence if the set of address codes of the geofence includes the first address code;
a processing module 804, configured to add a preset step length to a value of the target length if the address code set of the geofence does not include the first address code, and return to the step of executing the step of calculating an eleventh address code corresponding to the target point according to the geographic coordinates of the target point until the value of the target length is greater than a seventh code length, where the seventh code length is a maximum code length of the address codes in the address code set of the geofence;
a fourth determining module 805, configured to determine that the target point is located outside the geo-fence.
Optionally, the third determining module is specifically configured to:
if the address code set of the geo-fence comprises the first address code, determining whether the target point is located in the geo-fence or not in a geometric operation mode;
and if the target point is determined to be located in the geofence through the geometric operation, determining that the target point is located in the geofence.
The position determining apparatus 800 provided in this embodiment of the present application can implement each process in the above-described position determining method embodiment, and is not described here again to avoid repetition.
The position determining apparatus 800 of the embodiment of the application may increase the length of the address code corresponding to the target point gradually according to the preset step length, and compare the length with the address code of the address code set of the geofence to determine whether the target point is located in the geofence, so as to improve the accuracy of position determination.
Referring to fig. 9, fig. 9 is a block diagram of an electronic device provided in the present application, and as shown in fig. 9, an electronic device 900 includes: a processor 901, a memory 902 and a computer program stored on and executable on said memory 902, the various components of the electronic device 900 being coupled together by a bus interface 903, said computer program, when executed by said processor 901, implementing the steps of the address coding determination method of a geo-fence in any of the above-mentioned method embodiments or implementing the steps of the location determination method in any of the above-mentioned method embodiments.
The embodiment of the present application further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when executed by the processor, the computer program implements each process of the above-mentioned address code determining method for a geo-fence, or implements each process of the above-mentioned position determining method, and can achieve the same technical effect, and in order to avoid repetition, the details are not repeated here.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program implements each process of the above-mentioned address code determining method for a geo-fence, or implements each process of the above-mentioned position determining method, and can achieve the same technical effect, and in order to avoid repetition, the details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (15)

1. A geo-fencing address code determination method, the method comprising:
determining a plurality of address codes covering a first area to obtain a first address code set; the first area is an area enclosed by the outer boundary of a geographic fence, the lengths of address codes in the first address code set are at least partially different, the first code length is greater than the second code length, the first code length is the length of an address code corresponding to the boundary area of the first area, and the second code length is the length of an address code corresponding to the central area of the first area;
determining a plurality of address codes covering holes included in the geo-fence to obtain a second address code set; the lengths of the address codes in the second address code set are all third code lengths, and the third code lengths are greater than or equal to the maximum code lengths of the address codes in the first address code set;
deleting a first target address code from the first address code set to obtain an address code set of the geo-fence, wherein the first target address code is an address code in the first address code set corresponding to an address code in the second address code set.
2. The method of claim 1, wherein determining a plurality of address codes covering the first area to obtain the first set of address codes comprises:
determining a minimum circumscribed rectangular area of the geofence, obtaining a first rectangular area;
determining a fourth coding length according to the first rectangular area and a preset coding length; the fourth coding length is the minimum value in a first coding length set, each coding length in the first coding length set is smaller than the preset coding length, and the width of a rectangular area corresponding to each coding length in the first coding length set is smaller than the diagonal length of the first rectangular area;
and determining the first address coding set according to the fourth coding length and the preset coding length.
3. The method of claim 2, wherein determining the first address code set according to the fourth code length and the preset code length comprises:
a1: determining a plurality of first address codes covering the first area, wherein the length of the first address codes is the length of the fourth code;
a2: determining a first address code of the plurality of first address codes that is located within the first region and determining a first address code of the plurality of first address codes that intersects the first region;
a3: determining a second address code of a plurality of second address codes that is located within the first region and a second address code that intersects the first region; the second address codes are multiple address codes corresponding to a second target address code, the starting value of the second target address code is a first address code which is intersected with the first area in the first address codes, the length of the second address code is a first target code length, and the starting value of the first target code length is the fourth code length plus a preset step length;
a4: updating the value of the second target address code to a second address code which is intersected with the first area in the plurality of second address codes; adding a preset step length to the value of the first target coding length, and returning to execute the step A3 until the value of the first target coding length is larger than the preset coding length;
wherein the first address code set comprises a first address code located in the first region from among the plurality of first address codes, a second address code located in the first region from among the plurality of determined second address codes, and a second address code intersecting the first region from among the plurality of last determined second address codes.
4. The method according to claim 3, wherein the second address code is an address code located within the first region in a case where four vertices of a second rectangular region corresponding to the second address code are located within the first region;
in the case where only a part of the four vertices of the second rectangular region is located within the first region, the second address code is an address code that intersects the first region;
in the case where four vertices of the second rectangular region are all located outside the first region and there is a first boundary point located inside the second rectangular region, the second address encoding is an address encoding that intersects the first region, the first boundary point being a point on an outer boundary of the geofence.
5. The method of claim 3, wherein determining a plurality of first address encodings covering the first region comprises:
calculating a third address code corresponding to the first target vertex according to the fourth code length and the geographic coordinates of the first target vertex of the first rectangular area, wherein the length of the third address code is the fourth code length;
determining the plurality of first address encodings from the third address encoding.
6. The method of claim 5, wherein the first target vertex is a lower left corner vertex, and wherein determining the plurality of first address encodings from the third address encoding comprises:
if the maximum longitude corresponding to the third rectangular area corresponding to the third address code is smaller than the first longitude, acquiring a fourth address code, and determining whether the maximum longitude corresponding to the fourth rectangular area corresponding to the fourth address code is smaller than the first longitude; the first longitude is the maximum longitude corresponding to the first rectangular area, the length of the fourth address code is the fourth code length, and the fourth rectangular area is located on the right side of the third rectangular area and adjacent to the third rectangular area;
if the maximum latitude corresponding to the third rectangular area is smaller than the first latitude, acquiring a fifth address code, and determining whether the maximum longitude corresponding to the fifth rectangular area corresponding to the fifth address code is smaller than the first longitude; the first longitude is the maximum latitude corresponding to the first rectangular area, the length of the fifth address code is the fourth code length, and the fifth rectangular area is located on the upper side of the third rectangular area and is adjacent to the third rectangular area;
wherein the plurality of first address encodings includes the fourth address encoding and the fifth address encoding.
7. The method of claim 1, wherein determining a plurality of address codes covering holes included in the geofence, resulting in a second set of address codes, comprises:
determining a minimum external rectangular area of the hole to obtain a sixth rectangular area;
calculating a sixth address code corresponding to a second target vertex of the sixth rectangular area according to the third code length and the geographic coordinates of the second target vertex, wherein the length of the sixth address code is the third code length;
determining a plurality of seventh address codes covering the holes according to the sixth address codes, wherein the length of the seventh address codes is the length of the third codes;
and acquiring the address codes positioned in the holes in the plurality of seventh address codes to obtain the second address code set.
8. The method of claim 7, wherein in a case that four vertices of a seventh rectangular area corresponding to the seventh address code are all located within the hole and there is no second boundary point located within the seventh rectangular area, the seventh address code is an address code located within the hole, and the second boundary point is a point on an outer boundary of the hole.
9. The method of claim 1, wherein said removing the first destination address code from the first set of address codes to obtain the set of address codes for the geofence comprises:
b1: deleting an eighth address code from the first address code set to obtain a third address code set, wherein the eighth address code is the same address code in the first address code set and the second address code set;
b2: if the second target coding length is larger than a fifth coding length, subtracting a preset step length from the value of the second target coding length; the initial value of the second target coding length is the third coding length, and the fifth coding length is the minimum coding length of the address codes in the first address code set;
b3: determining a ninth address code corresponding to each address code in a fourth address code set to obtain a fifth address code set, where an initial element of the fourth address code set is an address code in the second address code set except for the eighth address code, and the length of the ninth address code is the second target code length;
b4: deleting a tenth address code from a sixth address code set to obtain a seventh address code set, wherein an initial element of the sixth address code set is an address code in the third address code set, and the tenth address code is the same address code in the sixth address code set and the fifth address code set;
b5: updating the elements of the fourth address coding set to address codes in the fifth address coding set except the tenth address code; updating the elements of the sixth address code set to address codes in the seventh address code set, and returning to execute step B2 until the second target code length is less than or equal to the fifth code length;
wherein the set of address encodings for the geofence is the seventh set of address encodings.
10. A method of position determination, comprising:
c1: acquiring a geographic coordinate of a target point;
c2: calculating an eleventh address code corresponding to the target point according to the geographic coordinates of the target point; the length of the eleventh address code is a target length, an initial value of the target length is a sixth code length, the sixth code length is a minimum code length of address codes in an address code set of a geo-fence, and the address code set of the geo-fence is determined according to the method of any one of claims 1 to 9;
c3: determining that the target point is located within the geofence if the set of address codes for the geofence includes the first address code;
c4: if the address code set of the geo-fence does not include the first address code, adding a preset step length to the value of the target length, and returning to execute step C2 until the value of the target length is greater than a seventh code length, where the seventh code length is the maximum code length of the address codes in the address code set of the geo-fence;
c5: determining that the target point is outside the geo-fence.
11. The method of claim 10, wherein determining that the target point is located within the geofence if the set of address codes for the geofence includes the first address code comprises:
if the address code set of the geo-fence comprises the first address code, determining whether the target point is located in the geo-fence or not in a geometric operation mode;
and if the target point is determined to be located in the geofence through the geometric operation, determining that the target point is located in the geofence.
12. An apparatus for geo-fencing address code determination, the apparatus comprising:
the first determining module is used for determining a plurality of address codes covering the first area to obtain a first address code set; the first area is an area enclosed by the outer boundary of a geographic fence, the lengths of address codes in the first address code set are at least partially different, the first code length is greater than the second code length, the first code length is the length of an address code corresponding to the boundary area of the first area, and the second code length is the length of an address code corresponding to the central area of the first area;
a second determining module, configured to determine a plurality of address codes covering holes included in the geofence, to obtain a second address code set; the lengths of the address codes in the second address code set are all third code lengths, and the third code lengths are greater than or equal to the maximum code lengths of the address codes in the first address code set;
a deleting module, configured to delete a first target address code from the first address code set to obtain an address code set of the geofence, where the first target address code is an address code in the first address code set that corresponds to an address code in the second address code set.
13. A position determining apparatus, comprising:
the acquisition module is used for acquiring the geographic coordinates of the target point;
the calculation module is used for calculating an eleventh address code corresponding to the target point according to the geographic coordinates of the target point; the length of the eleventh address code is a target length, an initial value of the target length is a sixth code length, the sixth code length is a minimum code length of address codes in an address code set of a geo-fence, and the address code set of the geo-fence is determined according to the method of any one of claims 1 to 9;
a third determining module, configured to determine that the target point is located within the geofence if the set of address codes for the geofence includes the first address code;
a processing module, configured to add a preset step length to a value of the target length if the address code set of the geofence does not include the first address code, and return to the step of executing the eleventh address code corresponding to the target point calculated according to the geographic coordinates of the target point until the value of the target length is greater than a seventh code length, where the seventh code length is a maximum code length of the address codes in the address code set of the geofence;
a fourth determination module to determine that the target point is outside the geo-fence.
14. An electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the address coding determination method of a geo-fence according to any one of claims 1 to 9 or implementing the steps of the location determination method according to any one of claims 10 to 11.
15. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of the method for address coding determination of a geo-fence according to any one of claims 1 to 9, or carries out the steps of the method for location determination according to any one of claims 10 to 11.
CN202110309554.XA 2021-03-23 2021-03-23 Geo-fence address code determining method, location determining method and device Active CN113076719B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110309554.XA CN113076719B (en) 2021-03-23 2021-03-23 Geo-fence address code determining method, location determining method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110309554.XA CN113076719B (en) 2021-03-23 2021-03-23 Geo-fence address code determining method, location determining method and device

Publications (2)

Publication Number Publication Date
CN113076719A CN113076719A (en) 2021-07-06
CN113076719B true CN113076719B (en) 2021-10-08

Family

ID=76613776

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110309554.XA Active CN113076719B (en) 2021-03-23 2021-03-23 Geo-fence address code determining method, location determining method and device

Country Status (1)

Country Link
CN (1) CN113076719B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107408352A (en) * 2015-03-31 2017-11-28 深圳市大疆创新科技有限公司 System and method for the communication of geography fence device
CN109992633A (en) * 2019-02-20 2019-07-09 北京三快在线科技有限公司 Method, apparatus, electronic equipment are determined based on the geography fence of user location
CN110008293A (en) * 2019-02-02 2019-07-12 阿里巴巴集团控股有限公司 Geographic position search method and device
CN110895764A (en) * 2018-09-12 2020-03-20 北京嘀嘀无限科技发展有限公司 Generation method and generation system of geo-fence, computer equipment and storage medium
CN111882421A (en) * 2020-06-17 2020-11-03 马上消费金融股份有限公司 Information processing method, wind control method, device, equipment and storage medium
CN112073907A (en) * 2020-08-11 2020-12-11 陕西正马物流有限公司 Fly ash transport vehicle monitoring method and device, computer equipment and storage medium
CN112261584A (en) * 2020-10-13 2021-01-22 恒大新能源汽车投资控股集团有限公司 Geographic fence determination method and device and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107408352A (en) * 2015-03-31 2017-11-28 深圳市大疆创新科技有限公司 System and method for the communication of geography fence device
CN110895764A (en) * 2018-09-12 2020-03-20 北京嘀嘀无限科技发展有限公司 Generation method and generation system of geo-fence, computer equipment and storage medium
CN110008293A (en) * 2019-02-02 2019-07-12 阿里巴巴集团控股有限公司 Geographic position search method and device
CN109992633A (en) * 2019-02-20 2019-07-09 北京三快在线科技有限公司 Method, apparatus, electronic equipment are determined based on the geography fence of user location
CN111882421A (en) * 2020-06-17 2020-11-03 马上消费金融股份有限公司 Information processing method, wind control method, device, equipment and storage medium
CN112073907A (en) * 2020-08-11 2020-12-11 陕西正马物流有限公司 Fly ash transport vehicle monitoring method and device, computer equipment and storage medium
CN112261584A (en) * 2020-10-13 2021-01-22 恒大新能源汽车投资控股集团有限公司 Geographic fence determination method and device and electronic equipment

Also Published As

Publication number Publication date
CN113076719A (en) 2021-07-06

Similar Documents

Publication Publication Date Title
CN109994038B (en) Method and device for determining interest points in irregular area and electronic equipment
CN110990516B (en) Map data processing method, device and server
CN110633262B (en) Spark-based map intersection area calculation method and system
CN107133351B (en) Plotting method and apparatus, user terminal, server, and computer-readable medium
WO2006059629A1 (en) Device, method and program for managing area information
JP2022535533A (en) Information push method and device
US20150215409A1 (en) Method and apparatus for location-based publications and subscriptions
CN113127125A (en) Page automatic adaptation method, device, equipment and storage medium
CN111753038B (en) Map data rendering method and system
CN110209748B (en) Method and apparatus for indexing geofences
CN113076719B (en) Geo-fence address code determining method, location determining method and device
CN110652728A (en) Game resource management method and device, electronic equipment and storage medium
CN113220808A (en) Encoding method, device and equipment of geographic entity and storage medium
CN110475204B (en) Method, device and equipment for analyzing reverse address of geographic fence
CN112887910B (en) Method and device for determining abnormal coverage area and computer readable storage medium
CN113658342A (en) Method, system, electronic device and storage medium for AR navigation path generation
CN104111951A (en) Method and device for drawing grid pictures
Loyola et al. Extending battery lifetime of mobile devices with geofence capabilities on dynamic-speed urban environments
CN103915035A (en) Data conversion method and data conversion apparatus
CN114238528A (en) Map loading method and device, electronic equipment and storage medium
JP5940718B2 (en) Information processing apparatus, method, and computer program
CN112272354B (en) Cloud mobile phone equipment distribution method and device
CN111949706B (en) Storage method for land big data distributed mining analysis
CN106503197B (en) A method of extracting android system Baidu map base station data
CN112948517B (en) Regional position calibration method and device and electronic equipment

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