CN114328788A - Region coding method, device, equipment and storage medium - Google Patents

Region coding method, device, equipment and storage medium Download PDF

Info

Publication number
CN114328788A
CN114328788A CN202111644026.6A CN202111644026A CN114328788A CN 114328788 A CN114328788 A CN 114328788A CN 202111644026 A CN202111644026 A CN 202111644026A CN 114328788 A CN114328788 A CN 114328788A
Authority
CN
China
Prior art keywords
region
grids
code
determining
coded
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.)
Pending
Application number
CN202111644026.6A
Other languages
Chinese (zh)
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.)
Alibaba Cloud Computing Ltd
Original Assignee
Alibaba Cloud Computing 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 Alibaba Cloud Computing Ltd filed Critical Alibaba Cloud Computing Ltd
Priority to CN202111644026.6A priority Critical patent/CN114328788A/en
Publication of CN114328788A publication Critical patent/CN114328788A/en
Priority to PCT/CN2022/127510 priority patent/WO2023124470A1/en
Pending legal-status Critical Current

Links

Images

Classifications

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Remote Sensing (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The application provides a region coding method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring the position range of a region to be coded; determining a plurality of grids covering the position range, wherein the grids are obtained through a first spatial grid coding algorithm, and determining a first code of a nearest common ancestor grid of the grids; and determining a plurality of second codes corresponding to the grids through a second spatial grid coding algorithm according to the boundary coordinates of the grids, wherein the second codes respectively correspond to the boundary coordinates of the grids. And determining the target code of the region to be coded according to the first code and the plurality of second codes. The two spatial grid coding algorithms are combined to participate in the coding of the region to be coded, so that the precision of the finally obtained coding result of the region to be coded is higher, and the finally obtained coding result can also tolerate the deviation of the boundary position of the region to be coded to a certain degree.

Description

Region coding method, device, equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a region coding method, device, apparatus, and storage medium.
Background
Geospatial meshes are spatial reference systems that subdivide geospatial regions into cells of different dimensions. The grid coding distributes the codes to each grid unit of the geospatial grid system by utilizing a structured index expression technology of the geospatial position to realize the uniform identification of the grid position, and the coding result of each grid is used as the spatial index of a corresponding area. Common geospatial trellis encoding algorithms include the Geohash algorithm, the Google S2 algorithm, and the like.
Such as in vehicle surveillance applications, it is desirable to analyze vehicle residence areas. Assuming that a certain vehicle arrives at a certain loading and unloading point or a parking lot area yesterday, a residence area a (an area with continuous moving speed lower than a set threshold value) can be determined according to longitude and latitude positioning data and moving speed data of the vehicle at the moment, and at the moment, space grid coding needs to be carried out on the residence area a to obtain a space index corresponding to the residence area a. In addition, assuming that the vehicle moves to the loading and unloading point or the parking lot area again today, a parking area B can be determined according to the longitude and latitude positioning data and the moving speed data of the vehicle at the moment, and at the moment, the parking area B needs to be subjected to spatial grid coding to obtain a spatial index corresponding to the parking area B. Since the vehicle moves at different positions each time, the resident area located each time may have a deviation, for example, yesterday and today the vehicle loading and unloading travel route is different, but the resident area is located at the same loading and unloading point, and the resident area is the same in terms of use.
Therefore, in order to avoid the final misjudgment into different regions due to the difference of the region boundaries, it is necessary to perform spatial grid coding according to the region boundaries, so that the coding result can tolerate the boundary deviation condition in a certain range, which corresponds to the above example, that is, the coding result of the residence region a is consistent with the coding result of the residence region B, because both correspond to the loading and unloading point.
Disclosure of Invention
The embodiment of the invention provides a region coding method, a region coding device, region coding equipment and a storage medium, which are used for realizing spatial coding of a position region.
In a first aspect, an embodiment of the present invention provides a region coding method, where the method includes:
acquiring the position range of a region to be coded;
determining a plurality of grids covering the position range, wherein the grids are obtained by a first spatial grid coding algorithm;
determining a first encoding of a nearest common ancestor mesh of the plurality of meshes;
determining a plurality of second codes corresponding to the grids through a second spatial grid coding algorithm according to the boundary coordinates of the grids, wherein the second codes respectively correspond to the boundary coordinates of the grids;
and determining the target code of the region to be coded according to the first code and the plurality of second codes.
In a second aspect, an embodiment of the present invention provides a region coding apparatus, where the apparatus includes:
the acquisition module is used for acquiring the position range of the region to be coded;
a first encoding module, configured to determine a plurality of grids covering the location range, and determine a first encoding of a nearest common ancestor grid of the plurality of grids, where the plurality of grids are obtained by a first spatial grid encoding algorithm;
a second encoding module, configured to determine, according to boundary coordinates of the multiple grids, multiple second codes corresponding to the multiple grids through a second spatial grid encoding algorithm, where the multiple second codes correspond to the boundary coordinates of the multiple grids, respectively;
a determining module, configured to determine a target code of the region to be coded according to the first code and the plurality of second codes.
In a third aspect, an embodiment of the present invention provides an electronic device, including: a memory, a processor, a communication interface; wherein the memory has stored thereon executable code which, when executed by the processor, causes the processor to implement at least the region encoding method as described in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to implement at least the region encoding method according to the first aspect.
In a fifth aspect, an embodiment of the present invention provides a region coding method, including:
determining the position range of the region to be coded according to the position information of the vehicle continuously corresponding to the residence state within the set time length;
determining a plurality of grids covering the position range, wherein the grids are obtained by a first spatial grid coding algorithm;
determining a first encoding of a nearest common ancestor mesh of the plurality of meshes;
determining a plurality of second codes corresponding to the grids through a second spatial grid coding algorithm according to the boundary coordinates of the grids, wherein the second codes respectively correspond to the boundary coordinates of the grids;
determining a target code of the region to be coded according to the first code and the plurality of second codes;
storing a correspondence between the target code and a vehicle identification of the vehicle.
In the embodiment of the invention, the region defined by the corresponding position coordinates of the vehicle in a resident state within a period of time can be used as the region to be coded, the position range of the region to be coded is determined by the minimum and maximum longitude and latitude coordinates, and after the position range of the region to be coded is obtained, the region to be coded is subjected to space grid coding so as to determine the corresponding target code. Specifically, first, among several known grids obtained by a first spatial grid coding algorithm (such as Google S2 algorithm), a plurality of grids covering a region to be coded are determined, and then a nearest common ancestor grid of the plurality of grids is determined, that is, a code (referred to as a first code) of the nearest common ancestor grid is determined. Secondly, according to each boundary coordinate of the grids, a plurality of second codes corresponding to the grids are determined through a second space grid coding algorithm (such as a Geohash algorithm), wherein the plurality of second codes respectively correspond to each boundary coordinate of the grids. And finally, determining the target code of the region to be coded according to the first code and the plurality of second codes.
In the embodiment of the invention, two different spatial grid coding algorithms are jointly used for carrying out unique coding on a region to be coded, wherein after a plurality of grids corresponding to the region to be coded are determined from grids of different levels obtained based on a first spatial grid coding algorithm, and a nearest common ancestor grid of the grids is calculated, as the range which can be covered by the nearest common ancestor grid is probably much larger than the range of the region to be coded, if a first code corresponding to the nearest common ancestor grid is directly adopted as a unique code identifier of the region to be coded, a large position deviation exists, so that in order to reduce the deviation, a second spatial grid coding algorithm is combined to participate in the coding of the region to be coded, and under the condition that the nearest common ancestor grid causes large errors, the errors can be reduced through respective corresponding second coding results of the grids in the second spatial grid coding algorithm, therefore, the accuracy of the finally obtained coding result of the region to be coded is higher. In addition, the combination of the first encoding of the common ancestor grid and the plurality of second encodings is used to determine the grid encoding result of the region to be encoded, so that a certain degree of deviation of the boundary of the region to be encoded can be tolerated, that is, for example, two regions to be encoded, which have different boundary coordinates but are mostly overlapped, may often make the two regions to be encoded have the same encoding result by using the encoding method provided by the embodiment of the present invention.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a flowchart of a region coding method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a determination result of an S2 mesh set covering an area to be encoded according to an embodiment of the present invention;
FIG. 3 is a diagram of the nearest common ancestor grid of a set of S2 grids provided by an embodiment of the present invention;
FIG. 4 is a diagram illustrating two regions with boundary position deviation having the same coding result according to an embodiment of the present invention;
fig. 5 is a flowchart of a region coding method according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an area coding apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device corresponding to the area coding apparatus provided in the embodiment shown in fig. 7.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. 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 invention.
Some embodiments of the invention are described in detail below with reference to the accompanying drawings. The features of the embodiments and examples described below may be combined with each other without conflict between the embodiments. In addition, the sequence of steps in each method embodiment described below is only an example and is not strictly limited.
The area coding method provided by the embodiment of the invention can be executed by an electronic device, the electronic device can be a server or a user terminal, and the server can be a physical server or a virtual server (virtual machine) of a cloud.
The two different spatial grid coding algorithms used in the region coding method provided in the embodiment of the present invention may be, for example, a first spatial grid coding algorithm may be a Google S2 algorithm, a second spatial grid coding algorithm may be a Geohash algorithm, and certainly, without being limited thereto, the first spatial grid coding algorithm may be any spatial grid coding algorithm that can divide the earth space (or the map space) into grids of different scales and uniquely code each grid.
The Geohash algorithm, invented by gustivo Niemeyer, is a hierarchical data structure that divides the space into quadrilateral meshes. The Geohash algorithm is used for coding a longitude and latitude coordinate point and mapping the longitude and latitude coordinate point to a character string, each character string represents a rectangular area divided by longitude and latitude, and different longitude and latitude coordinates can be mapped to the same character string. The length (encoding length) of the character string calculated by the Geohash algorithm can control the size of the grid. The Geohash code has 12 levels with side lengths ranging from 5000km to 3.7 cm. The algorithm provides 12 stages, the variation of each middle stage is large, sometimes the coverage range of the upper stage may be too large, and the coverage range of the lower stage may be too small.
The Google S2 algorithm defines a framework for decomposing a unit sphere into a hierarchy of cells. Each Cell is a quadrilateral defined by four geodesic lines. The top level of the hierarchy is obtained by projecting the six faces of the cube onto the unit sphere, and the lower levels are obtained recursively by subdividing each upper level grid into four sub-grids (sub-levels). The S2 library decomposes a unit sphere into hierarchical structures called cells, and encodes all cells on a three-dimensional sphere (similar to the earth), where the code of each unit is uniquely identified by a 64-bit CellId, i.e. the length of the code result of each grid is 64 bits. The S2 algorithm provides a total of 30 levels (level) of trellis encoding, ranging from 0.7cm to 85,000,000km in side length. The algorithm provides 30 levels, and the change of each middle level is relatively gentle and close to a curve of 4 power.
The region coding scheme provided by the embodiment of the invention can be applied to a dynamic region coding scene, wherein the dynamic state refers to the situation that a moving body such as a vehicle is actually in the same 'functional region' every time, but a resident region is deviated due to possible low-speed movement and route change of the vehicle.
Such as exemplified above: in the same loading and unloading point or parking lot area, the parking area corresponding to the vehicle on the first day is A, the parking area corresponding to the vehicle on the second day is B, the parking area A and the parking area B are not completely the same, the boundary is deviated, but the parking areas are actually in the same functional area, namely the loading and unloading point or parking lot area. In other words, for one of the residence areas, such as residence area a, the final encoding result needs to tolerate a certain range of boundary deviation of the area, that is, the encoding result is also applicable for residence area B having a slight deviation from the boundary of residence area a. In short, assuming that the range covered by the final encoding result is called range X, both the residence area a and the residence area B should be included in the range X, but the range X should not be much larger than the location ranges of the residence area a and the residence area B, because the encoding precision is too low.
The following is a description of the implementation process of the region coding scheme provided by the embodiment of the present invention.
Fig. 1 is a flowchart of a region coding method according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
101. the position range of the region to be encoded is obtained.
In an alternative embodiment, obtaining the position range of the region to be encoded may be implemented as:
acquiring position information continuously transmitted by a vehicle;
and if the vehicles are determined to be in a low-speed moving state within the set time length according to the position information, determining the position range of the region to be coded according to the position information received within the set time length.
The low-speed moving state comprises a stopping state and a moving state with the speed lower than a set threshold value.
The vehicle can report its own vehicle state data, including the current position, moving speed and the like, at a short set time interval, assuming that the set time is 10 minutes, if the reported speed of the vehicle is lower than a set threshold value within 10 consecutive minutes, the vehicle can be considered to be in a parking state, at this time, the position coordinates (longitude and latitude coordinates) received within the 10 minutes can be merged, and the position range defined by the longitude and latitude coordinates is determined to be the position range of the area to be coded, that is, the position range of the parking area. For example, the maximum latitude and longitude and the minimum latitude and longitude, namely the positions of the southeast corner and the northwest corner of the rectangle are calculated, and the drawn rectangle is the resident area, namely the area to be coded. The 10 minutes is only an example, and the value of the set time period can be set according to actual needs.
The determination method of the region to be encoded is not limited to the rectangular region determined by the maximum latitude and longitude and the minimum latitude and longitude, and other methods for determining the minimum circumscribed polygonal region surrounding each position coordinate within 10 minutes may be used.
In addition, in the above example, the parking state of the vehicle is determined based on the moving speed, and actually, it may be determined whether the vehicle is in the parking state as follows: and determining the moving distance of the vehicle in 10 minutes according to the position coordinates reported by the vehicle within 10 continuous minutes, if the moving distance is smaller than a set threshold (such as 200 meters), determining that the vehicle is in a resident state within the 10 minutes, and calculating the position range of the area to be coded according to the position coordinates reported within the 10 minutes.
For a special situation, assuming that the reported positions of the vehicles within 10 consecutive minutes are the same, that is, the vehicles are in a complete stop state, at this time, the region to be coded may be determined to be a circular region with the position coordinate as the center of a circle and a preset length as a radius, where the preset length is, for example, 200 meters.
102. The method comprises the steps of determining a plurality of grids covering the position range of a region to be coded, and determining a first code of a nearest common ancestor grid of the grids, wherein the grids are obtained through a first spatial grid coding algorithm.
In this embodiment, taking the first spatial grid coding algorithm as the Google S2 algorithm as an example, a function for obtaining a grid covering a certain area is provided in the S2 library, which is referred to as a grid screening algorithm herein, and for a certain area x, parameters such as the maximum grid number (maxcels), the maximum precision level (MaxLevel) of the grid, and the minimum precision level (MinLevel) of the grid are set, that is, a grid set covering the area x can be obtained through the grid screening algorithm.
Based on this, in this embodiment, determining a plurality of grids covering the position range of the region to be encoded may be implemented as:
determining a target grid precision grade matched with the position range of the region to be coded from a plurality of different grid precision grades provided by a first spatial grid coding algorithm;
and inputting the target grid precision grade and the grid quantity into a preset grid screening algorithm so as to output a plurality of second grids through the grid screening algorithm.
It should be noted that, on the basis that a plurality of grids with different scales (i.e. different precision levels) corresponding to the geospatial space have been obtained in advance through the first spatial grid coding algorithm, not only the code corresponding to each grid but also the coverage position range of each grid is actually known, and the coverage position range can be represented by four boundary coordinates of the grid. In addition, the input of the grid screening algorithm also comprises the position range of the region to be coded, so that the grid screening algorithm can screen a plurality of grids matched with the position range of the region to be coded from a plurality of known grids. The grid screening algorithm may find the multiple grids by using a greedy algorithm.
In addition, a target mesh accuracy level matching the position range of the region to be encoded is determined from a plurality of different mesh accuracy levels provided by the first spatial mesh encoding algorithm, and optionally, a target mesh accuracy level matching the area of the region to be encoded may be determined based on the area of the region to be encoded and the coverage area of the mesh of each level. Alternatively, the target mesh accuracy level may be set to a default certain level, for example, level 13, which covers about 1000 meters in length, because most functional areas in practical applications have a length of 1000 meters in general.
As can be seen from the above description, in the present embodiment, the parameters may be set as follows: MaxLevel ═ MinLevel ═ 13, and MaxCells ═ 1.
And the Maxlevel is set as Minlevel, so that the determined grids are of equal precision level, and the grids are actually adjacent in position. If a mesh which can surround the region to be coded and whose precision level conforms to the MaxLevel — MinLevel constraint cannot be found, a minimum number of meshes which can surround the region to be coded and whose precision levels conform to the MaxLevel — MinLevel constraint are further searched, where the minimum number, that is, the number of the meshes is generally greater than or equal to 2.
Of course, in practical applications, when a mesh capable of surrounding the region to be encoded and having a precision level conforming to the MaxLevel-MinLevel constraint is directly found based on the input parameter values through the mesh screening algorithm, the encoding of the mesh may be used as the final corresponding target encoding of the region to be encoded, and the encoding process is ended.
It should be noted that, in practice, MaxLevel may also be different from MinLevel, for example, MinLevel is set to a certain mesh precision level whose coverage area is equal to or smaller than the area corresponding to the region to be encoded, and MaxLevel is set to a certain mesh precision level whose coverage area is larger than the area corresponding to the region to be encoded. MaxCells may also be set to a value greater than 1.
The determination results of the above-mentioned multiple meshes covering the region to be coded are exemplarily described with reference to fig. 2, as described in fig. 2, the region to be coded is assumed to be a polygon illustrated in the drawing, and the multiple meshes covering the region to be coded, which are obtained by the mesh screening algorithm, are assumed to be composed of a mesh g1 and a mesh g2, where it is assumed that the accuracy levels corresponding to the mesh g1 and the mesh g2 are both 13.
That is, fig. 2 illustrates a case where the region to be encoded spans different grids, and in fact, there may be a sibling relationship between grid g1 and grid g2, and there may also be a table sibling relationship. If a sibling relationship, both will have a common parent grid. If the relationship is table brother, a brother or table brother relationship exists between the parent grids. However, no matter which position adjacent relationship the grid g1 and the grid g2 are embodied in, when the region to be coded is covered by a plurality of grids, the region to be coded cannot be uniquely coded by directly adopting the codes of the grid g1 and the grid g 2.
Thus, next, a nearest common ancestor mesh of the plurality of meshes needs to be determined, and the encoding of the nearest common ancestor mesh is referred to as a first encoding.
Prior to describing the process of determining the first encoding of the nearest common ancestor lattice of the plurality of lattices described above, the nearest common ancestor lattices of lattice g1 and lattice g2 are illustrated in connection with FIG. 3.
As shown in fig. 3, first, parent grids of grid g1 and grid g2 are found, assuming grid parent _ g1 and grid parent _ g2, respectively, and it is found that grid parent _ g1 and grid parent _ g2 are still two different grids adjacent in position, and then parent grids of grid parent _ g1 and grid parent _ g2 continue to be found, assuming grid parent _ parent _ g1 and grid parent _ parent _ g2, respectively. Finding that the grid parent _ parent _ G1 and the grid parent _ parent _ G2 are still two different grids adjacent in position, continuing to find the parent grids of the grid parent _ parent _ G1 and the grid parent _ parent _ G2, and so on, assuming that a grid G is finally found, i.e. the parent grids of the grid parent _ parent _ G1 and the grid parent _ parent _ G2 are the same grid G, at this time, the grid G is the nearest common ancestor grid of the grid G1 and the grid G2.
In the google s2 algorithm, each trellis code (CellID) is composed of 64 bits. The first 3 bits represent one of the 6 faces of the cube, over a range of values [0,5 ]. 3 bits may represent values 0-7, but 6, 7 are invalid values. The last bit of the 64 bits is a 1, which is purposely left out. To quickly find how many bits there are in the middle. Looking forward from the last bit at the end, the first position is found which is not 0, i.e. the first 1, and the first 4 th bit of this bit (since the first 3 bits are occupied) is the available number. The grids with level >0 all have common ancestors.
Based on the trellis-coded data structure, it can be seen that, in practice, the problem of finding the nearest common ancestor trellis can be converted into a problem of finding the longest common sequence in the binary strings of multiple trellis codes from left to right, the longest common ancestor starting from the root node (the code of the trellis with level 1), that is, the nearest common ancestor trellis.
Specifically, the nearest common ancestor mesh of the plurality of meshes may be determined by:
carrying out XOR processing on the codes of the grids to obtain an XOR result;
determining the length of the coded public sequence of the grids according to the length of the bit number of the exclusive or result;
determining a first encoding of a nearest common ancestor lattice of the plurality of lattices in accordance with the common sequence length.
Because of the 64-bit length process, for ease of illustration, only a certain shorter length 24 is illustrated here:
assume the encoding of grid g1 is: 111111111100000000000000
Assume the encoding of grid g2 is: 111111121100000000000000
The xor result of the encoding of the two grids is: 000000010000000000000000, 10000000000000000, having a length of 17. Note that the preceding multi-bit 0 after xor is meaningless and is therefore ignored.
Based on this, the common sequence length of the codes of the two grids is: 24-17-7 bits, meaning that the first 7 bits of the two trellis codes are the same, so the first 7 bits of the two trellis codes are truncated, and the remaining 17 bits of the two trellis codes are 0, so that the code of the nearest common ancestor trellis of the two trellis can be obtained: 111111100000000000000000.
103. and determining a plurality of second codes corresponding to the grids through a second spatial grid coding algorithm according to the boundary coordinates of the grids, wherein the second codes respectively correspond to the boundary coordinates of the grids.
104. And determining the target code of the region to be coded according to the first code and the plurality of second codes.
The common prefix codes of the plurality of second codes can be determined first, and then the target code of the region to be coded is determined according to the first code and the common prefix codes.
In the above, for the case that the region to be encoded is covered by multiple grids, the encoding of the nearest common ancestor grid of the multiple grids is calculated, and since the precision level corresponding to the nearest common ancestor grid may be greatly different from the precision level of the MinLevel grid, the deviation of the side length of the nearest common ancestor grid from the maximum side length of the region to be encoded is larger. As illustrated in fig. 3, it is assumed that the level of the grid g1 and the grid g2 is 15, the side length is about 306 m, the maximum side length of the region to be encoded is about 600 m, the level of the nearest common ancestor grid of the grid g1 and the grid g2 is 11, the side length is about 5000 m, and the deviation is large.
In order to reduce errors, in the present embodiment, a second spatial mesh coding algorithm, such as a geohash algorithm, is combined to participate in a spatial coding process of a to-be-coded region, a length of the geohash mesh coding is similar to a mesh precision level of the first spatial mesh coding algorithm, different coding lengths correspond to different coverage ranges, and under a condition that a coding of a nearest common ancestor mesh of the multiple meshes has a large error, the error may be reduced by using a longest common prefix of the geohash coding corresponding to the multiple meshes.
Specifically, first, according to each boundary coordinate of the multiple grids, a second spatial grid coding algorithm, such as a geohash algorithm, is used to determine multiple second codes corresponding to the multiple grids. As described above, four boundary coordinates of each grid are known, and a coding result corresponding to each boundary coordinate can be obtained based on the geohash algorithm.
In addition, as described above, the geohash algorithm may output codes of different lengths, each corresponding to a different coverage area. In practical applications, a default target code length, for example, 9 bits, may be set according to actual conditions, so that each boundary coordinate will be coded into a code with the length of the target code length. Alternatively, the target code length may be determined according to the following manner:
acquiring coverage ranges corresponding to different coding lengths under a second spatial grid coding algorithm;
and determining the target coding length matched with the position range of the area to be coded according to the position range of the area to be coded and the coverage ranges corresponding to different coding lengths. Wherein the match may be: the side length corresponding to the target coding length is less than or equal to the longest side length of the region to be coded.
And after the second code corresponding to each boundary coordinate of each grid of the grids is obtained, determining the common prefix code of all the obtained second codes.
For example, assume that the plurality of second encodings comprises: abcdefg, abcdefd, abcdefe, and abcdefb, and the longest common prefix code of these codes is: abcdef.
The target coding of the region to be coded may be determined as: the concatenation result of the common prefix codes of the first code and the plurality of second codes of the nearest common ancestor grid is: first code common prefix code.
However, in practical applications, some special cases may occur, for example, the coverage area corresponding to the common prefix code is larger than the coverage area corresponding to the first code, and at this time, the target code of the region to be coded may be the first code.
That is to say, if the coverage range corresponding to the common prefix code is smaller than the coverage range corresponding to the first code, determining that the target code of the region to be coded is a splicing result of the first code and the common prefix code; and if the coverage range corresponding to the common prefix code is larger than the coverage range corresponding to the first code, determining that the target code of the region to be coded is the first code.
The concatenation result of the first code and the common prefix code can be understood as follows: in a large range defined by the first code, a plurality of small sub-regions are further divided, wherein the code of one sub-region is common prefix code, and the code of the sub-region is the code result of the region to be coded. Thus, the error caused by narrowing the nearest s2 common ancestor trellis encoding by using the geohash common prefix encoding is realized.
Based on the above description, it can be known that the coverage area corresponding to the finally determined target code depends on the coverage areas corresponding to the first code and the common prefix code, and this coverage area is generally larger than the position range of the region to be coded, so that all the regions to be coded that fall within the coverage area corresponding to the target code will finally obtain the same target code by the coding method provided by the embodiment of the present invention, that is, the target code can tolerate a certain degree of deviation of the region boundary of the region to be coded, and has good credibility and stability. For example, as shown in fig. 4, the region to be coded Q1 and the region to be coded Q2 shown in the figure are mostly overlapped, and only the boundary position is deviated, based on the above coding scheme, the region to be coded Q1 and the region to be coded Q2 finally correspond to the same target code, and two different coding results cannot be caused due to slight boundary deviation of the two regions to be coded.
In addition, the coverage range corresponding to the target code obtained by the scheme is not obviously larger than the position range of the region to be coded, so that the precision of the coding result is ensured.
In practical application, spatial grid coding of a region to be coded has many practical meanings. For example, the correspondence between the target code and the residence information of the vehicle may be recorded, where the residence information includes the identification of the vehicle and the residence time of the vehicle. The vehicle refers to the vehicle of the area to be coded determined according to vehicle state data such as the position, the moving speed and the like of the vehicle. For example, the geographic area corresponding to the target code is actually a parking lot area, a vehicle often goes to the parking lot area to park, each time the vehicle goes to the parking lot area to park, an area to be coded can be determined, and the target code corresponding to the area to be coded determined each time is the same, so that the corresponding relationship between the target code and the number of times of parking of the vehicle can be recorded.
For another example, the method can also be used for analyzing the traffic travel condition of the user. For example, a user often makes a round trip between two places X and Y, so that each time a vehicle drives to a place X, a region to be coded can be determined, the target code corresponding to each region to be coded is determined to be a by the scheme, similarly, each time a vehicle drives to a place Y, a region to be coded can be determined, the target code corresponding to each region to be coded is determined to be B by the scheme, and further, the analysis result that the user often makes a round trip between the geographical regions corresponding to the two target codes can be analyzed by combining the number of times of parking of the vehicle recorded in association on the target code a and the target code B and the rule of determining the time of the target code a and the target code B each time.
Two alternative embodiments of the above-mentioned two calculation processes are exemplified below, one of which is: determining a first encoding of a nearest common ancestor mesh of the plurality of meshes, another computational process being: a common prefix code of the plurality of second codes is determined.
For the first encoding that determines the nearest common ancestor mesh of the multiple meshes, in practice, the number of the multiple meshes may be more than two, such as possibly three, four, and so on. The first code of the nearest common ancestor mesh of the multiple meshes is determined, the codes of the multiple meshes can be directly subjected to exclusive-or calculation, and the first code of the nearest common ancestor mesh is determined according to the exclusive-or result. Or, based on the computing power of the electronic device executing the regional coding scheme, the codes of every two grids may be subjected to exclusive or, and finally, the first code of the nearest common ancestor grid is determined according to the target exclusive or result with the longest bit among the obtained multiple exclusive or results. For example, assuming that the plurality of grids are composed of grid 1, grid 2, and grid 3, the length of the number of bits of the exclusive-or result of grid 1 and grid 2 is n1, the length of the number of bits of the exclusive-or result of grid 1 and grid 3 is n2, the length of the number of bits of the exclusive-or result of grid 2 and grid 3 is n3, and assuming that n1 is greater than n2 and n1 is greater than n3, that is, the number of bits n1 of the exclusive-or result of grid 1 and grid 2 is the longest, and the total length of codes of the grids is 64, it can be determined that the common sequence lengths of the codes of the three grids are: since 64-n1 is m bits, meaning that the first m bits of the three trellis codes are the same, the first m bits of the three trellis codes are cut out, and the remaining n1 bits are set to 0, so that the code of the nearest common ancestor trellis of the three trellis can be obtained.
For the common prefix code that determines the plurality of second codes, assuming that the lengths of the plurality of second codes are all equal and the length is k, the middle position of the total length may be taken first: (1+ k)/2 ═ p, comparing the first p bits of the plurality of second codes, if equal, determining that the first p bits of the plurality of second codes are the same, updating the traversal range to the remaining multiple bits after the p bits, calculating the intermediate positions of the remaining multiple bits, and repeating the process; and if the first p bits of the second codes are unequal, the common prefix codes of the second codes are positioned in the first p bits and cannot be positioned behind the p bits, at the moment, the traversal range is updated to the first p bits, the middle position of the first p bits is calculated, and the judgment process is repeated. And traversing layer by layer, the longest common prefix part of a plurality of second codes can be found.
Fig. 5 is a flowchart of a region coding method according to an embodiment of the present invention, and as shown in fig. 5, the method may include the following steps:
501. and determining the position range of the region to be coded according to the position information of the vehicle continuously corresponding to the resident state in the set time length.
The implementation of this step can refer to the related description in the foregoing embodiments, which is not repeated herein.
502. Determining a plurality of grids covering the position range, and determining a first code of a nearest common ancestor grid of the plurality of grids, wherein the plurality of grids are obtained by a first spatial grid coding algorithm.
503. And determining a plurality of second codes corresponding to the grids through a second spatial grid coding algorithm according to the boundary coordinates of the grids, wherein the second codes respectively correspond to the boundary coordinates of the grids.
504. And determining a target code of the region to be coded according to the first code and the plurality of second codes, and storing the corresponding relation between the target code and the vehicle identification of the vehicle.
In an optional embodiment, the method further comprises:
and determining the number of times of the vehicle staying in the position area corresponding to the target code according to the storage result. The position region corresponding to the target code is a position region where all the coding results are the target code, and includes but is not limited to the above-mentioned region to be coded.
In some practical application scenarios, for example, there may be a need to analyze where a user frequently goes, and in the face of the need, it is assumed that the user is driving and needs to stop after arriving at a certain place, and in the parking process, the vehicle moving speed is relatively low, and it is considered that the user is continuously in a resident state (the speed is lower than a set threshold), so that the region to be coded may be formed based on a moving track generated in the parking process, and the region to be coded is coded to obtain the target code (the determination process of the target code refers to the relevant descriptions in the foregoing other embodiments), so as to record the corresponding relationship between the target code and the vehicle identifier in sequence, which indicates that the user drives the vehicle to arrive at the location region corresponding to the target code once. Each time the user drives to arrive at the position area, a to-be-coded area is formed based on the current parking track, and the target codes corresponding to the to-be-coded area obtained each time are consistent, so that the number of stay times of the user in the position area corresponding to the target codes and the time of arrival each time can be counted. And providing a basis for carrying out targeted service pushing on the user based on the position statistical result.
In another optional embodiment, the method further comprises:
acquiring regional function information corresponding to a target code;
determining whether the vehicle has the authority of parking in the position area corresponding to the target code according to the area function information;
and if the vehicle does not have the authority, generating a violation record of the vehicle.
In practical application, the corresponding area function information, such as parking lots, passenger stations, etc., can be obtained according to the position and the range of the position area corresponding to the target code. The regional functional information may be pre-labeled by the traffic authority.
For example, assume that the function of the location area corresponding to the target code is: passenger transport stations. However, if the vehicle of the user entering the area is not authorized to operate, it means that the vehicle does not have the right to enter the location area for parking, and the vehicle can be considered as a "black car", and a parking violation record of the vehicle is generated, where the parking violation record includes information such as vehicle identification, object code, and entry time. Wherein, the permission of determining whether the user vehicle has the permission to stop at the passenger station can be inquired by inquiring the license issuing database.
The area encoding apparatus of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these means can each be constructed using commercially available hardware components and by performing the steps taught in this disclosure.
Fig. 6 is a schematic structural diagram of an area coding apparatus according to an embodiment of the present invention, as shown in fig. 6, the apparatus includes: the device comprises an acquisition module 11, a calculation module 12, a compression module 13 and a sending module 14.
An obtaining module 11, configured to obtain a position range of the region to be encoded.
A first encoding module 12, configured to determine a plurality of grids covering the location range, and determine a first encoding of a nearest common ancestor grid of the plurality of grids, where the plurality of grids are obtained through a first spatial grid encoding algorithm.
A second encoding module 13, configured to determine, according to boundary coordinates of the multiple grids, multiple second codes corresponding to the multiple grids through a second spatial grid encoding algorithm, and determine a common prefix code of the multiple second codes, where the multiple second codes respectively correspond to the boundary coordinates of the multiple grids.
A determining module 14, configured to determine a target code of the region to be coded according to the first code and the common prefix code.
Optionally, the first encoding module 12 is specifically configured to: carrying out XOR processing on the codes of the grids to obtain an XOR result; determining the length of the coded common sequence of the grids according to the length of the bits of the exclusive-or result; determining a first encoding of a nearest common ancestor lattice of the plurality of lattices in accordance with the common sequence length.
Optionally, the code lengths of the plurality of second codes are target code lengths, and the target code lengths are preset values, or the target code lengths are determined according to the following manner: acquiring coverage ranges corresponding to different coding lengths under the second spatial grid coding algorithm; and determining the target coding length matched with the position range of the region to be coded according to the position range of the region to be coded and the coverage ranges corresponding to the different coding lengths.
Optionally, the first encoding module 12 is specifically configured to: determining a target grid precision level matched with the position range of the region to be coded from a plurality of different grid precision levels provided by the first spatial grid coding algorithm; and inputting the target grid precision grade and the grid quantity into a preset grid screening algorithm so as to output the plurality of second grids through the grid screening algorithm.
Optionally, the determining module 14 is specifically configured to: if the coverage range corresponding to the common prefix code is smaller than the coverage range corresponding to the first code, determining that the target code of the region to be coded is a splicing result of the first code and the common prefix code; and if the coverage range corresponding to the common prefix code is larger than the coverage range corresponding to the first code, determining that the target code of the region to be coded is the first code.
Optionally, the obtaining module 11 is specifically configured to: acquiring position information continuously transmitted by a vehicle; and if the vehicles are determined to be in a low-speed moving state within the set time length according to the position information, determining the position range of the region to be coded according to the position information received within the set time length.
Optionally, the apparatus further comprises: and the counting module is used for recording the corresponding relation between the target code and the resident information of the vehicle, wherein the resident information comprises the identification of the vehicle and the resident times of the vehicle.
The apparatus shown in fig. 6 can perform the steps provided in the foregoing embodiments, and the detailed performing process and technical effects refer to the description in the foregoing embodiments, which are not described herein again.
In one possible design, the structure of the area coding apparatus shown in fig. 6 may be implemented as an electronic device. As shown in fig. 7, the electronic device may include: a processor 21, a memory 22, and a communication interface 23. Wherein the memory 22 has stored thereon executable code which, when executed by the processor 21, makes the processor 21 at least to implement the region coding method as provided in the previous embodiments.
In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium having stored thereon executable code, which, when executed by a processor of an electronic device, causes the processor to implement at least the region encoding method as provided in the foregoing embodiments.
The above described embodiments of the apparatus are merely illustrative, wherein the network elements illustrated as separate components may or may not be physically separate. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course, can also be implemented by a combination of hardware and software. With this understanding in mind, the above-described aspects and portions of the present technology which contribute substantially or in part to the prior art may be embodied in the form of a computer program product, which may be embodied on one or more computer-usable storage media having computer-usable program code embodied therein, including without limitation disk storage, CD-ROM, optical storage, and the like.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (14)

1. A region coding method, comprising:
acquiring the position range of a region to be coded;
determining a plurality of grids covering the position range, wherein the grids are obtained by a first spatial grid coding algorithm;
determining a first encoding of a nearest common ancestor mesh of the plurality of meshes;
determining a plurality of second codes corresponding to the grids through a second spatial grid coding algorithm according to the boundary coordinates of the grids, wherein the second codes respectively correspond to the boundary coordinates of the grids;
and determining the target code of the region to be coded according to the first code and the plurality of second codes.
2. The method of claim 1, wherein determining the target coding of the region to be coded according to the first coding and the plurality of second codings comprises:
determining a common prefix encoding of the plurality of second encodings;
and determining the target code of the region to be coded according to the first code and the common prefix code.
3. The method of claim 1, wherein determining a first encoding of a nearest common ancestor mesh of the plurality of meshes comprises:
carrying out XOR processing on the codes of the grids to obtain an XOR result;
determining the length of the coded common sequence of the grids according to the length of the bits of the exclusive-or result;
determining a first encoding of a nearest common ancestor lattice of the plurality of lattices in accordance with the common sequence length.
4. The method of claim 1, wherein the coding lengths of the plurality of second codes are target coding lengths, and wherein the target coding lengths are preset values, or wherein the target coding lengths are determined according to the following method:
acquiring coverage ranges corresponding to different coding lengths under the second spatial grid coding algorithm;
and determining the target coding length matched with the position range of the region to be coded according to the position range of the region to be coded and the coverage ranges corresponding to the different coding lengths.
5. The method of claim 1, wherein determining a plurality of grids covering the location range comprises:
determining a target grid precision level matched with the position range of the region to be coded from a plurality of different grid precision levels provided by the first spatial grid coding algorithm;
and inputting the target grid precision grade and the grid quantity into a preset grid screening algorithm so as to output the plurality of second grids through the grid screening algorithm.
6. The method of claim 2, wherein the determining the target code of the region to be coded according to the first code and the common prefix code comprises:
if the coverage range corresponding to the common prefix code is smaller than the coverage range corresponding to the first code, determining that the target code of the region to be coded is a splicing result of the first code and the common prefix code;
and if the coverage range corresponding to the common prefix code is larger than the coverage range corresponding to the first code, determining that the target code of the region to be coded is the first code.
7. The method according to any one of claims 1 to 6, wherein the obtaining the position range of the region to be encoded comprises:
acquiring position information continuously transmitted by a vehicle;
and if the vehicles are determined to be in a low-speed moving state within the set time length according to the position information, determining the position range of the region to be coded according to the position information received within the set time length.
8. The method of claim 7, further comprising:
and recording the corresponding relation between the target code and the resident information of the vehicle, wherein the resident information comprises the identification of the vehicle and the resident times of the vehicle.
9. An area encoding apparatus, comprising:
the acquisition module is used for acquiring the position range of the region to be coded;
a first encoding module, configured to determine a plurality of grids covering the location range, and determine a first encoding of a nearest common ancestor grid of the plurality of grids, where the plurality of grids are obtained by a first spatial grid encoding algorithm;
a second encoding module, configured to determine, according to boundary coordinates of the multiple grids, multiple second codes corresponding to the multiple grids through a second spatial grid encoding algorithm, and determine common prefix codes of the multiple second codes, where the multiple second codes respectively correspond to the boundary coordinates of the multiple grids;
a determining module, configured to determine a target code of the region to be coded according to the first code and the plurality of second codes.
10. An electronic device, comprising: a memory, a processor, a communication interface; wherein the memory has stored thereon executable code which, when executed by the processor, causes the processor to carry out the region encoding method of any one of claims 1 to 8.
11. A non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform the region encoding method of any one of claims 1 to 8.
12. A region coding method, comprising:
determining the position range of the region to be coded according to the position information of the vehicle continuously corresponding to the residence state within the set time length;
determining a plurality of grids covering the position range, wherein the grids are obtained by a first spatial grid coding algorithm;
determining a first encoding of a nearest common ancestor mesh of the plurality of meshes;
determining a plurality of second codes corresponding to the grids through a second spatial grid coding algorithm according to the boundary coordinates of the grids, wherein the second codes respectively correspond to the boundary coordinates of the grids;
determining a target code of the region to be coded according to the first code and the plurality of second codes;
storing a correspondence between the target code and a vehicle identification of the vehicle.
13. The method of claim 12, further comprising:
and determining the number of times of the vehicle staying in the position area corresponding to the target code according to the storage result.
14. The method of claim 12, further comprising:
acquiring regional function information corresponding to the target code;
determining whether the vehicle has the authority to stop in the position area corresponding to the target code according to the area function information;
and if the vehicle does not have the authority, generating a violation record of the vehicle.
CN202111644026.6A 2021-12-29 2021-12-29 Region coding method, device, equipment and storage medium Pending CN114328788A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111644026.6A CN114328788A (en) 2021-12-29 2021-12-29 Region coding method, device, equipment and storage medium
PCT/CN2022/127510 WO2023124470A1 (en) 2021-12-29 2022-10-26 Region coding method and apparatus, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111644026.6A CN114328788A (en) 2021-12-29 2021-12-29 Region coding method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114328788A true CN114328788A (en) 2022-04-12

Family

ID=81017513

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111644026.6A Pending CN114328788A (en) 2021-12-29 2021-12-29 Region coding method, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN114328788A (en)
WO (1) WO2023124470A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023124470A1 (en) * 2021-12-29 2023-07-06 阿里云计算有限公司 Region coding method and apparatus, device and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5955378B2 (en) * 2011-04-12 2016-07-20 トムソン ライセンシングThomson Licensing Encoding method and decoding method
CN110909093B (en) * 2019-10-11 2020-10-30 中国人民解放军战略支援部队信息工程大学 Method and device for constructing intelligent landmark control network
CN111475597B (en) * 2020-03-31 2022-11-22 中国人民解放军战略支援部队信息工程大学 Non-rigid grid coding, spatial object unique identification and query method and device
CN113806456A (en) * 2020-06-16 2021-12-17 华为技术有限公司 Mesh coding method and device
CN113536188A (en) * 2021-09-16 2021-10-22 统信软件技术有限公司 Data storage method, data query method, computing device and storage medium
CN114328788A (en) * 2021-12-29 2022-04-12 阿里云计算有限公司 Region coding method, device, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023124470A1 (en) * 2021-12-29 2023-07-06 阿里云计算有限公司 Region coding method and apparatus, device and storage medium

Also Published As

Publication number Publication date
WO2023124470A1 (en) 2023-07-06

Similar Documents

Publication Publication Date Title
CN106997466B (en) Method and device for detecting road
CN112449754B (en) Data encoding and decoding method, device and storage medium
CN110909093B (en) Method and device for constructing intelligent landmark control network
CN110502599A (en) Querying method, device and the computer readable storage medium of map datum
CN110782708A (en) Unmanned aerial vehicle flight network modeling method based on low-altitude airspace limiting conditions
CN114238384B (en) Area positioning method, device, equipment and storage medium
KR20230148259A (en) Vehicle trajectory deviation correction method, device and electronic devices
CN112700479B (en) Registration method based on CNN point cloud target detection
CN111090712A (en) Data processing method, device and equipment and computer storage medium
CN111830543A (en) Providing atmospheric correction data for GNSS network-RTK systems by encoding data according to a quadtree hierarchy
CN111291776A (en) Channel information extraction method based on crowd-sourced trajectory data
CN116860905B (en) Space unit coding generation method of city information model
CN116036604B (en) Data processing method, device, computer and readable storage medium
CN114328788A (en) Region coding method, device, equipment and storage medium
CN112330332B (en) Methods, computing devices, and media for identifying fraud risk with respect to node tasks
CN112132951B (en) Construction method of grid semantic map based on vision
CN112100308A (en) Similarity query method for Beidou space-time trajectory
CN112184900B (en) Method, device and storage medium for determining elevation data
CN111080080A (en) Method and system for estimating risk of geological disaster of villages and small towns
CN115713600A (en) Method and device for generating digital elevation model of automatic driving scene
CN113671460B (en) Map generation method, map generation device, computer equipment and storage medium
CN114329058A (en) Image gathering method and device and electronic equipment
CN112183831A (en) Route generation method and device, storage medium and electronic equipment
CN111414444A (en) Method and device for processing space-time trajectory information
CN115270520B (en) Low-altitude monitoring performance simulation analysis method and system based on elevation grid

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