WO2023124470A1 - Region coding method and apparatus, device and storage medium - Google Patents

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

Info

Publication number
WO2023124470A1
WO2023124470A1 PCT/CN2022/127510 CN2022127510W WO2023124470A1 WO 2023124470 A1 WO2023124470 A1 WO 2023124470A1 CN 2022127510 W CN2022127510 W CN 2022127510W WO 2023124470 A1 WO2023124470 A1 WO 2023124470A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
grids
grid
area
region
Prior art date
Application number
PCT/CN2022/127510
Other languages
French (fr)
Chinese (zh)
Inventor
徐攀登
Original Assignee
阿里云计算有限公司
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 阿里云计算有限公司 filed Critical 阿里云计算有限公司
Publication of WO2023124470A1 publication Critical patent/WO2023124470A1/en

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

Definitions

  • the present application relates to the technical field of data processing, and in particular to a region coding method, device, equipment and storage medium.
  • the geospatial grid is a spatial reference system that divides the geospatial region into units of different scales.
  • Grid coding utilizes the structured index expression technology of geospatial position to assign the code to each grid unit of the geospatial grid system to realize the unified identification of the grid position, and the coding result of each grid is used as the spatial index.
  • Commonly used geospatial grid coding algorithms include Geohash algorithm, Google S2 algorithm, and so on.
  • a parking area A (the area where the continuous moving speed is lower than the set threshold) can be determined.
  • a parking area B can be determined according to the latitude and longitude positioning data and moving speed data of the vehicle at this time.
  • the parking area B needs to be Perform spatial grid coding to obtain the spatial index corresponding to the residence area B. Since the moving position of the vehicle is different each time, there may be deviations in the resident area each time. For example, the driving route of the vehicle loading and unloading is different yesterday and today, but they are all at the same loading and unloading point. This area is based on its use. Said it should be the same.
  • the coding result is consistent with the coding result of the parking area B, because they both correspond to the above-mentioned loading and unloading points.
  • Embodiments of the present application provide an area encoding method, device, device, and storage medium, so as to implement spatial encoding of a location area.
  • the embodiment of the present application provides a region coding method, including: obtaining the location range of the region to be coded; determining multiple grids covering the location range, and the multiple grids are obtained through the first spatial grid coding algorithm Determining the first encoding of the nearest common ancestor grid of multiple grids; according to the boundary coordinates of multiple grids, a plurality of second encodings corresponding to multiple grids are determined through the second spatial grid encoding algorithm, wherein , the multiple second codes respectively correspond to the boundary coordinates of the multiple grids; according to the first code and the multiple second codes, determine the target code of the area to be coded.
  • the embodiment of the present application provides an area encoding device, including: an acquisition module, used to acquire the location range of the area to be encoded; a first encoding module, used to determine multiple grids covering the location range, and determine the The first coding of the nearest common ancestor grid of a grid, the multiple grids are obtained through the first spatial grid coding algorithm; the second coding module is used to pass the second coding according to the boundary coordinates of multiple grids The spatial grid coding algorithm determines multiple second codes corresponding to multiple grids, wherein the multiple second codes correspond to the boundary coordinates of the multiple grids; the determining module is configured to use the first code and the multiple second codes The second code is to determine the target code of the area to be coded.
  • the embodiment of the present application provides an electronic device, including: a memory, a processor, and a communication interface; wherein, executable code is stored in the memory, and when the executable code is executed by the processor, the processor can at least Realize the region coding method as in the first aspect.
  • the embodiment of the present application provides a non-transitory machine-readable storage medium, on which executable code is stored, and when the executable code is executed by a processor of an electronic device, the The processor can at least implement the region coding method in the first aspect.
  • the embodiment of the present application provides an area encoding method, including: determining the position range of the area to be encoded according to the position information of the vehicle corresponding to the parking state within a set time period; Grid, multiple grids are obtained through the first spatial grid encoding algorithm; determine the first encoding of the nearest common ancestor grid of multiple grids; according to the boundary coordinates of multiple grids, through the second spatial network
  • the lattice coding algorithm determines multiple second codes corresponding to multiple grids, wherein the multiple second codes correspond to the boundary coordinates of multiple grids respectively; according to the first code and multiple second codes, determine the area to be coded
  • the target code store the corresponding relationship between the target code and the vehicle identification of the vehicle.
  • FIG. 1 is a flow chart of an area coding method provided in an embodiment of the present application
  • FIG. 2 is a schematic diagram of a determination result of an S2 grid set covering an area to be encoded provided by an embodiment of the present application;
  • FIG. 3 is a schematic diagram of a nearest common ancestor grid of a S2 grid set provided in an embodiment of the present application
  • Fig. 4 is a schematic diagram of two areas with a boundary position deviation having the same encoding result provided by the embodiment of the present application;
  • FIG. 5 is a flow chart of an area coding method provided in an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a region coding device provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an electronic device corresponding to the region encoding device provided in the embodiment shown in FIG. 6 .
  • the region coding method provided in the embodiment of the present application can be executed by an electronic device, which can be a server or a user terminal, and the server can be a physical server or a virtual server (virtual machine) in the cloud.
  • an electronic device which can be a server or a user terminal
  • the server can be a physical server or a virtual server (virtual machine) in the cloud.
  • the first spatial grid coding algorithm can be the Google S2 algorithm
  • the second spatial grid coding algorithm can be the Geohash algorithm
  • the first spatial grid encoding algorithm can be any spatial grid that can divide the earth space (or map space) into grids of different scales and uniquely encode each grid lattice encoding algorithm.
  • the Geohash algorithm is a hierarchical data structure that divides space into a quadrilateral grid. What the Geohash algorithm does is to encode a latitude and longitude coordinate point and map it to a string. Each string represents a rectangular area divided by latitude and longitude. Different latitude and longitude coordinates may be mapped to the same character. string.
  • the length (code length) of the string calculated by the Geohash algorithm can control the size of the grid.
  • a framework for decomposing a unit sphere into a hierarchy of cells is defined in the Google S2 algorithm.
  • Each grid (Cell) is a quadrilateral bounded by four geodesics.
  • the top layers of the hierarchy are obtained by projecting the six faces of the cube onto the unit sphere, and the lower layers are obtained recursively by subdividing each upper mesh into four sub-meshes (sublayers).
  • the S2 library decomposes the unit sphere into a hierarchical structure called Cell, and encodes all the Cells on the three-dimensional sphere (similar to the earth).
  • the encoding of each unit is uniquely identified by a 64-bit CellId, that is, the cellId of each grid
  • the length of the encoding result is 64bit.
  • the S2 algorithm provides a total of 30 levels of grid coding, ranging from 0.7cm to 85,000,000km in side length. Among the 30 levels provided by the algorithm, the change of each level in the middle is relatively gentle, close to the curve
  • the area coding scheme provided by the embodiment of the present application can be applied to the scene of dynamic area coding, wherein the so-called dynamic means that the moving objects such as vehicles are actually in the same "functional area” each time but because of the possible low-speed movement and route of the vehicle Situations where the residency area deviates due to the change.
  • the parking area corresponding to the vehicle on the first day is A
  • the parking area corresponding to the second day is B
  • the parking area A and parking area B are incomplete.
  • the boundary will be deviated, but they are actually in the same functional area - the loading and unloading point or the parking area.
  • the coding results corresponding to the two resident areas should be the same, because they actually correspond to the same functional area.
  • the final encoding result needs to tolerate a certain range of boundary deviations in the area, that is, the encoding result is slightly different from the boundary of the resident area A.
  • FIG. 1 is a flow chart of an area coding method 100 provided by an embodiment of the present application. As shown in FIG. 1 , the method 100 includes the following steps 101 to 104 .
  • step 101 the location range of the region to be coded is obtained.
  • obtaining the location range of the area to be coded can be achieved by: obtaining the location information continuously sent by the vehicle; if it is determined according to the location information that the vehicle is moving at a low speed within a set The received location information determines the location range of the area to be coded.
  • the low-speed moving state includes a stop state and a moving state whose speed is lower than a set threshold.
  • the vehicle can report its own vehicle status data at short set time intervals, including the current position, moving speed, etc. Assuming that the above-mentioned set time is 10 minutes, if the vehicle is within 10 consecutive minutes, the reported speed is low When the threshold is set, it can be considered that the vehicle is in a parked state. At this time, the location coordinates (latitude and longitude coordinates) received within the 10 minutes can be combined to determine the location range defined by these latitude and longitude coordinates as the area to be encoded. The location range of , that is, the location range of the residence area.
  • calculate the maximum longitude and latitude and minimum longitude and latitude that is, the positions of the southeast and northwest corners of the rectangle, and the rectangle drawn in this way is the resident area, that is, the area to be coded. 10 minutes is just an example, and the value of the set duration can be set according to actual needs.
  • the way to determine the area to be coded is not limited to the rectangular area determined by the above-mentioned maximum latitude and longitude and minimum longitude and latitude, other methods for determining the minimum circumscribed polygonal area surrounding each position coordinate within the above 10 minutes can be used.
  • the parking state of the vehicle is determined based on the moving speed.
  • whether the vehicle is in the parking state can also be determined in the following way: According to the position coordinates reported by the vehicle within 10 consecutive minutes, determine the 10 The moving distance of the vehicle in minutes, if the moving distance is less than the set threshold (such as 200 meters), it is considered that the vehicle is in the parking state within these 10 minutes, and the position range of the area to be encoded is calculated according to the position coordinates reported within these 10 minutes .
  • the set threshold such as 200 meters
  • the area to be encoded is a circle with the position coordinate as the center and the preset length as the radius area, the preset length is, for example, 200 meters.
  • step 102 a plurality of grids covering the location range of the area to be encoded is determined, and a first encoding of the nearest common ancestor grid of the plurality of grids is determined, and the plurality of grids are obtained through a first spatial grid encoding algorithm.
  • the S2 library provides a function for obtaining a grid covering a certain area, which is called a grid screening algorithm here, and for a certain For an area x, set the parameters such as the maximum number of cells (MaxCells), the maximum accuracy level of the grid (MaxLevel), and the minimum accuracy level of the grid (MinLevel), that is, the grid screening algorithm can be used to solve the problem that covers the area The grid collection of x.
  • determining a plurality of grids covering the location range of the area to be encoded can be implemented as: determining from a variety of different grid precision levels provided by the first spatial grid encoding algorithm and the grid area to be encoded A target grid accuracy level for location range matching; input the target grid accuracy level and the number of grids into a preset grid screening algorithm, so as to output a plurality of second grids through the grid screening algorithm.
  • the input of the above-mentioned grid screening algorithm also includes the location range of the area to be encoded, so that the grid screening algorithm can screen out a plurality of grids that match the location range of the area to be encoded from several known grids .
  • the mesh screening algorithm can find the plurality of meshes by using a greedy algorithm.
  • MaxLevel can also be different from MinLevel.
  • MinLevel is set to a certain grid precision level whose coverage area is equal to or smaller than the area corresponding to the area to be coded
  • MaxLevell is set to cover an area larger than the area corresponding to the area to be coded.
  • MaxCells can also be set to a value greater than 1.
  • the multiple grids in the area to be coded are composed of grid g1 and grid g2, where it is assumed that the precision levels corresponding to grid g1 and grid g2 are both 13.
  • FIG. 2 what is illustrated in FIG. 2 is a situation where the region to be encoded spans different grids.
  • grid g1 and grid g2 may have a brother relationship or a cousin relationship. If it is a sibling relationship, both will have a common parent grid. In the case of a cousin relationship, there is a brother or cousin relationship between its parent grids.
  • the encoding of the nearest common ancestor grid is called the first encoding.
  • the nearest common ancestor grids of grid g1 and grid g2 are illustrated with reference to FIG. 3 .
  • the grid parent_parent_g1 and the grid parent_parent_g2 are still two different grids adjacent to each other, continue 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, that is, the grid
  • the parent grid of grid parent_parent_g1 and grid parent_parent_g2 is the same grid G, and at this time, grid G is the nearest common ancestor grid of grid g1 and grid g2.
  • each grid code (CellID) is composed of 64 bits.
  • the first 3 bits represent one of the 6 faces of the cube, and the value range is [0,5]. 3 bits can represent the value 0-7, but 6, 7 are invalid values.
  • the last bit of 64 bits is 1, which is reserved on purpose. Used to quickly find how many bits are in the middle. Search forward from the last digit at the end to find the first position that is not 0, that is, to find the first 1, and the previous digit of this digit to the 4th digit at the beginning (because the first 3 digits are occupied) are all available number.
  • Meshes with level > 0 have a common ancestor.
  • the nearest common ancestor grid of multiple grids can be determined in the following manner: Exclusive OR processing is performed on the codes of multiple grids to obtain an exclusive OR result; The common sequence length of the coding of grids; according to the common sequence length, determine the first coding of the nearest common ancestor grid of multiple grids.
  • the XOR result of the coding of the above two grids is: 000000010000000000000000, that is, 10000000000000000, and the length is 17. Note that the multi-bit 0s in front of the XOR are meaningless, so ignore them.
  • step 103 according to the boundary coordinates of the plurality of grids, a plurality of second codes corresponding to the plurality of grids are determined through the second spatial grid encoding algorithm, wherein the plurality of second codes correspond to the plurality of grids respectively Coordinates of each boundary.
  • step 104 according to the first code and multiple second codes, the target code of the region to be coded is determined.
  • the common prefix codes of multiple second codes may be determined first, and then, according to the first codes and the common prefix codes, the target codes of the regions to be coded are determined.
  • the area defined by the position coordinates corresponding to the vehicle in the parking state for a period of time can be used as the area to be encoded.
  • the position range of the area to be encoded is determined by the minimum and maximum latitude and longitude coordinates.
  • spatial grid encoding is performed on the area to be encoded to determine its corresponding target encoding. Specifically, first, among the known grids obtained by the first spatial grid encoding algorithm (such as Google S2 algorithm), determine multiple grids covering the area to be encoded, and then determine the nearest common grid of multiple grids.
  • the ancestral grid that is, the encoding that determines the nearest common ancestor grid (referred to as the first encoding).
  • a plurality of second codes corresponding to multiple grids are determined through a second spatial grid coding algorithm (such as Geohash algorithm), wherein the multiple second codes correspond to multiple The coordinates of each boundary of the grid.
  • a second spatial grid coding algorithm such as Geohash algorithm
  • two different spatial grid encoding algorithms are jointly used to uniquely encode the area to be encoded, wherein, the grids of different levels obtained based on the first spatial grid encoding algorithm are determined to be After calculating the multiple grids corresponding to the region, and calculating the nearest common ancestor grids of these multiple grids, since the range that the nearest common ancestor grid can cover may be much larger than the range of the area to be encoded, the nearest common ancestor is directly used If the first code corresponding to the grid is used as the unique coding identifier of the region to be coded, there will be a large positional deviation. Therefore, in order to reduce the deviation, the second space grid coding algorithm is combined to participate in the coding of the area to be coded.
  • the error can be reduced through the second encoding results corresponding to the above-mentioned multiple grids in the second spatial grid encoding algorithm, so that the accuracy of the encoding result finally obtained in the area to be encoded higher.
  • the combination of the first encoding of the above-mentioned common ancestor grid and the above-mentioned multiple second encodings to determine the grid encoding result of the area to be encoded can tolerate a certain degree of deviation of the boundary of the area to be encoded, that is, for example, two boundary coordinates
  • the encoding method provided by the embodiment of the present application can often make the two areas to be encoded have the same encoding result.
  • the encoding of the nearest common ancestor grid of multiple grids is calculated, because the accuracy level corresponding to the nearest common ancestor grid may differ from the accuracy level of the above MinLevel grid Larger, it will cause the side length of the nearest common ancestor grid to be larger than the maximum side length deviation of the region to be encoded.
  • the side length is about 306 meters
  • the maximum side length of the region to be coded is about 600 meters
  • the side length is about 5000 meters, and the deviation is large.
  • this embodiment combines the second spatial grid encoding algorithm such as the geohash algorithm to participate in the spatial encoding process of the area to be encoded.
  • the length of the geohash grid encoding is similar to the grid precision level of the first spatial grid encoding algorithm above. Different encoding lengths correspond to different coverage areas. In the case that the encoding of the nearest common ancestor grid of the above multiple grids has a large error, the error can be reduced by the longest common prefix of the geohash encoding corresponding to the multiple grids.
  • multiple second codes corresponding to the multiple grids are determined through a second spatial grid coding algorithm such as the geohash algorithm.
  • a second spatial grid coding algorithm such as the geohash algorithm.
  • the geohash algorithm can output codes of different lengths, each length corresponding to a different coverage.
  • a default target code length such as 9 bits, can be set according to the actual situation.
  • each boundary coordinate will be coded into a code whose length is the target code length.
  • the target coding length can also be determined in the following manner: obtain the coverages corresponding to different coding lengths under the second spatial grid coding algorithm; The location range of the coded region matches the target code length.
  • the matching may be: the side length corresponding to the target encoding length is less than or equal to the longest side length of the region to be encoded.
  • the target code of the area to be coded can be determined as: the splicing result of the first code of the above-mentioned nearest common ancestor grid and the common prefix codes of multiple second codes: first code_common prefix code.
  • the coverage area corresponding to the common prefix code is larger than the coverage area corresponding to the first code.
  • the target code of the area to be coded can use the first code.
  • the coverage corresponding to the common prefix code is smaller than the coverage corresponding to the first code, it is determined that the target code of the area to be coded is the splicing result of the first code and the public prefix code; if the coverage corresponding to the public prefix code is larger than For the coverage area corresponding to the first code, it is determined that the target code of the area to be coded is the first code.
  • the splicing result of the first code and the public prefix code can be understood as follows: within a large range defined by the first code, multiple small sub-regions are further divided, and the code of one of the sub-regions is the common prefix code , the encoding of this sub-area is the encoding result of the area to be encoded. Therefore, the use of geohash common prefix encoding to reduce the error caused by the grid encoding of the nearest s2 common ancestor.
  • the coverage corresponding to the finally determined target code depends on the coverage corresponding to the above-mentioned first code and the common prefix code, and this coverage is generally larger than the location range of the area to be coded, so , so that all the regions to be coded that fall within the coverage corresponding to the target code will eventually get the same target code through the coding method provided by the embodiment of the present application, that is, the target code can tolerate the area boundary of the region to be coded to have A certain degree of deviation, with good credibility and stability. For example, as shown in Figure 4, most of the area to be encoded Q1 and the area to be encoded Q2 shown in the figure overlap, but the boundary position is slightly different.
  • the final area Q1 to be encoded and the area to be encoded Q2 corresponds to the same target encoding, and two different encoding results will not be caused due to a slight boundary deviation between the two regions to be encoded.
  • the coverage area corresponding to the target code obtained through the above solution is not significantly larger than the location range of the area to be coded, so the accuracy of the coded result is guaranteed.
  • performing spatial grid coding on the area to be coded has many practical significances.
  • the corresponding relationship between the target code and the resident information of the vehicle may be recorded, wherein the resident information includes the identification of the vehicle and the number of resident times of the vehicle.
  • the vehicle refers to the vehicle in the above-mentioned area to be encoded determined according to the vehicle state data such as its position and moving speed.
  • the geographic area corresponding to the target code is actually a parking lot area. A certain vehicle often parks in this parking lot area, and then every time it goes to this parking lot area to park, it can determine an area to be encoded.
  • the final target codes corresponding to each determined area to be coded are the same, and the corresponding relationship between the target codes and the number of parking times of the vehicle can be recorded.
  • it can also be used to analyze the traffic situation of users. For example, if a user often travels between places X and Y, then every time he drives to place X, he can determine a region to be coded, and determine the target code corresponding to each region to be coded through the above scheme Both are A. Similarly, every time you drive to the location Y, you can determine a region to be coded. Through the above scheme, it is determined that the target code corresponding to each region to be coded is B.
  • One of the calculation processes is: determining the first code of the nearest common ancestor grid of multiple grids, and the other calculation process is : Determine the common prefix encoding of multiple second encodings.
  • the number of the plurality of grids may be more than two, such as may be three, four, and so on.
  • XOR calculation can be directly performed on the codes of these multiple grids, and the first code of the nearest common ancestor grid can be determined according to the XOR result.
  • the bit length of the XOR result of grid 1 and grid 2 is n1, and the XOR result of grid 1 and grid 3
  • FIG. 5 is a flow chart of an area coding method 500 provided by an embodiment of the present application. As shown in FIG. 5 , the method 500 may include steps 501 to 504 as follows.
  • step 501 the location range of the area to be coded is determined according to the location information of the vehicle corresponding to the parking state continuously within a set time period.
  • step 502 a plurality of grids covering a location range are determined, and a first encoding of a nearest common ancestor grid of the plurality of grids is determined, the plurality of grids are obtained through a first spatial grid encoding algorithm.
  • step 503 according to the boundary coordinates of the multiple grids, a plurality of second codes corresponding to the multiple grids are determined through the second space grid coding algorithm, wherein the multiple second codes correspond to the multiple grids respectively Coordinates of each boundary.
  • step 504 according to the first code and multiple second codes, the target code of the area to be coded is determined, and the corresponding relationship between the target code and the vehicle identification of the vehicle is stored.
  • the area coding method further includes: according to the storage result, determining the number of times the vehicle stays in the location area corresponding to the target code.
  • the location area corresponding to the target code refers to the location area where all coding results are the target code, including but not limited to the above-mentioned to-be-coded area.
  • the moving speed of the vehicle is Relatively low, it is considered to be continuously in the resident state (the state where the speed is lower than the set threshold), so that the above-mentioned area to be encoded can be formed based on the movement track generated during the parking process, and the area to be encoded is encoded to obtain the above-mentioned target code (determination of the target code For the process, refer to the related descriptions in other aforementioned embodiments), so as to record the corresponding relationship between the target code and the vehicle identification in turn, indicating that the user drives to the location area corresponding to the target code once.
  • an area to be encoded will be formed based on the parking trajectory at that time, and the target codes corresponding to the area to be encoded each time are consistent, so the user's position corresponding to the target code can be calculated.
  • the number of stops in the area, and the time of each arrival. Provide a basis for subsequent targeted service pushes for users based on the location statistics.
  • the method further includes: acquiring the area function information corresponding to the target code; determining whether the vehicle has the authority to park in the location area corresponding to the target code according to the area function information; if the vehicle does not have the authority, generating a vehicle violation record.
  • the corresponding area function information such as parking lot, passenger station, and so on, can be obtained.
  • the area function information may be pre-marked by the traffic management agency.
  • the function of the location area corresponding to the target code is: passenger station.
  • the vehicle of the user entering the area does not have an operating permit, it means that the vehicle does not have the authority to enter the location area and park.
  • the parking record includes information such as vehicle identification, target code, and entry time. Wherein, it may be determined by querying the license issuing database whether the user's vehicle has the authority to park at the passenger station.
  • the area coding device of one or more embodiments of the present application will be described in detail below. Those skilled in the art can understand that these devices can be configured by using commercially available hardware components through the steps taught in this solution.
  • FIG. 6 is a schematic structural diagram of a region coding device provided by an embodiment of the present application. As shown in FIG.
  • the obtaining module 11 is used to obtain the location range of the region to be coded.
  • the first encoding module 12 is configured to determine a plurality of grids covering a location range, and determine a first encoding of a nearest common ancestor grid of the plurality of grids, and the plurality of grids are obtained through a first spatial grid encoding algorithm.
  • the second coding module 13 is used to determine multiple second codes corresponding to multiple grids through the second spatial grid coding algorithm according to the boundary coordinates of multiple grids, and determine the common prefix codes of multiple second codes, wherein , the plurality of second codes respectively correspond to the boundary coordinates of the plurality of grids.
  • the determination module 14 is configured to determine the target code of the area to be coded according to the first code and the common prefix code.
  • the first encoding module 12 is specifically configured to: perform XOR processing on the codes of multiple grids to obtain an XOR result; determine the common value of the codes of multiple grids according to the bit length of the XOR results. Sequence length; according to the common sequence length, determine the first encoding of the nearest common ancestor grid of the plurality of grids.
  • the encoding lengths of multiple second encodings are the target encoding lengths, and the target encoding lengths are preset values, or the target encoding lengths are determined according to the following method: obtaining the different encoding lengths under the second space grid encoding algorithm The coverage corresponding to the length; according to the location range of the region to be encoded and the coverage corresponding to different encoding lengths, determine the target encoding length matching the location range of the area to be encoded.
  • the first encoding module 12 is specifically configured to: determine a target grid accuracy level that matches the location range of the area to be encoded from a variety of different grid accuracy levels provided by the first spatial grid encoding algorithm; Input the target grid accuracy level and the number of grids into the preset grid screening algorithm, so as to output a plurality of second grids through the grid screening algorithm.
  • the determining module 14 is specifically configured to: if the coverage area corresponding to the common prefix code is smaller than the coverage area corresponding to the first code, determine that the target code of the area to be coded is the splicing result of the first code and the public prefix code ; If the coverage area corresponding to the common prefix code is larger than the coverage area corresponding to the first code, determine that the target code of the area to be coded is the first code.
  • the acquiring module 11 is specifically used to: acquire the location information continuously sent by the vehicle; The information determines the location range of the region to be coded.
  • the area coding device further includes: a statistics module, configured to record the correspondence between the target code and the parking information of the vehicle, where the parking information includes the identification of the vehicle and the number of parking times of the vehicle.
  • the device shown in FIG. 6 can execute the steps provided in the foregoing embodiments.
  • the detailed execution process and technical effects refer to the descriptions in the foregoing embodiments, and details are not repeated here.
  • the structure of the region encoding device shown in FIG. 6 above can be implemented as an electronic device.
  • the electronic device may include: a processor 21 , a memory 22 , and a communication interface 23 .
  • executable codes are stored in the memory 22, and when the executable codes are executed by the processor 21, the processor 21 can at least implement the region encoding method provided in the foregoing embodiments.
  • the embodiment of the present application provides a non-transitory machine-readable storage medium, the non-transitory machine-readable storage medium stores executable code, when the executable code is executed by the processor of the electronic device , so that the processor can at least implement the region coding method provided in the foregoing embodiments.
  • each embodiment can be implemented by means of a general hardware platform plus necessary, and of course can also be implemented by a combination of hardware and software.
  • the above-mentioned technical solution can be embodied in the form of a computer product in essence or the part that contributes to the related technology, and this application can adopt one or more computer-usable storage media containing computer-usable program codes. (including but not limited to disk storage, CD-ROM, optical storage, etc.) in the form of a computer program product.

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 present application provides a region coding method and apparatus, a device and a storage medium. The method comprises: acquiring a position range of a region to be coded; determining a plurality of grids covering the position range, the plurality of grids being obtained by means of a first spatial grid coding algorithm, and determining a first code of a lowest common ancestors grid of the plurality of grids; according to boundary coordinates of the plurality of grids, determining, by means of a second spatial grid coding algorithm, a plurality of second codes corresponding to the plurality of grids, wherein the plurality of second codes correspond to the boundary coordinates of the plurality of grids, respectively; and according to the first code and the plurality of second codes, determining a target code of said region. Two spatial grid coding algorithms are combined to participate in coding of a region to be coded, such that the precision of a coding result finally obtained in said region is high, and the final coding result can also tolerate the deviation of boundary positions of said region to a certain extent.

Description

区域编码方法、装置、设备和存储介质Area coding method, device, equipment and storage medium
本申请要求于2021年12月29日提交中国专利局、申请号为202111644026.6、发明名称为“区域编码方法、装置、设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202111644026.6 and the title of the invention "region coding method, device, equipment and storage medium" filed with the China Patent Office on December 29, 2021, the entire contents of which are incorporated by reference in In this application.
技术领域technical field
本申请涉及数据处理技术领域,尤其涉及一种区域编码方法、装置、设备和存储介质。The present application relates to the technical field of data processing, and in particular to a region coding method, device, equipment and storage medium.
背景技术Background technique
地球空间网格是将地球空间区域剖分成不同尺度单元的空间参考系统。网格编码利用地理空间位置的结构化索引表达技术,将编码分配给地球空间网格系统的每个网格单元,实现网格位置的统一标识,每个网格的编码结果即作为相应区域的空间索引。常用的地理空间网格编码算法包括Geohash算法、Google S2算法,等等。The geospatial grid is a spatial reference system that divides the geospatial region into units of different scales. Grid coding utilizes the structured index expression technology of geospatial position to assign the code to each grid unit of the geospatial grid system to realize the unified identification of the grid position, and the coding result of each grid is used as the spatial index. Commonly used geospatial grid coding algorithms include Geohash algorithm, Google S2 algorithm, and so on.
比如在对车辆进行监管的应用中,需要对车辆驻留区域进行分析。假设某辆车,昨天去到某个装卸货点或停车场区域,根据此时车辆的经纬度定位数据以及移动速度数据可以确定出一个驻留区域A(连续移动速度都低于设定阈值的区域),此时,需要对该驻留区域A进行空间网格编码,得到该驻留区域A对应的空间索引。另外,假设该车辆今天又去到该装卸货点或该停车场区域,根据此时车辆的经纬度定位数据以及移动速度数据可以确定出一个驻留区域B,此时,需要对该驻留区域B进行空间网格编码,得到该驻留区域B对应的空间索引。由于车辆每次的移动位置不同,所以每次定位出的驻留区域可能存在偏差,比如昨天和今天车辆装卸货的行驶路线不一样,但是都是在同一个装卸货点,这个区域从用途上来说应该是一样的。For example, in the application of supervising vehicles, it is necessary to analyze the vehicle parking area. Assume that a certain vehicle went to a certain loading and unloading point or parking area yesterday. According to the latitude and longitude positioning data and moving speed data of the vehicle at this time, a parking area A (the area where the continuous moving speed is lower than the set threshold) can be determined. ), at this time, it is necessary to perform spatial grid coding on the dwelling area A to obtain the corresponding spatial index of the dwelling area A. In addition, assuming that the vehicle goes to the loading and unloading point or the parking area today, a parking area B can be determined according to the latitude and longitude positioning data and moving speed data of the vehicle at this time. At this time, the parking area B needs to be Perform spatial grid coding to obtain the spatial index corresponding to the residence area B. Since the moving position of the vehicle is different each time, there may be deviations in the resident area each time. For example, the driving route of the vehicle loading and unloading is different yesterday and today, but they are all at the same loading and unloading point. This area is based on its use. Said it should be the same.
因此,为了避免区域边界差异导致最终误判为不同区域,需要根据区域边界进行空间网格编码,使得编码结果能够容忍一定范围的边界偏差情况,对应于上述举例,即是使得驻留区域A的编码结果与驻留区域B的编码结果是一致的,因为都对应于上述装卸货点。Therefore, in order to avoid the final misjudgment of different regions due to differences in regional boundaries, it is necessary to perform spatial grid coding according to the regional boundaries so that the coding results can tolerate a certain range of boundary deviations. The coding result is consistent with the coding result of the parking area B, because they both correspond to the above-mentioned loading and unloading points.
发明内容Contents of the invention
本申请实施例提供了一种区域编码方法、装置、设备和存储介质,用以实现位置区域的空间编码。Embodiments of the present application provide an area encoding method, device, device, and storage medium, so as to implement spatial encoding of a location area.
第一方面,本申请实施例提供了一种区域编码方法,包括:获取待编码区域的位置范围;确定覆盖位置范围的多个网格,多个网格是通过第一空间网格编码算法得到的;确定多个网格的最近公共祖先网格的第一编码;根据多个网格的各边界坐标,通过第二空间网格编码算法确定多个网格对应的多个第二编码,其中,多个第二编码分别对应于多个网格的各边界坐标;根据第一编码和多个第二编码,确定待编码区域的目标编码。In the first aspect, the embodiment of the present application provides a region coding method, including: obtaining the location range of the region to be coded; determining multiple grids covering the location range, and the multiple grids are obtained through the first spatial grid coding algorithm Determining the first encoding of the nearest common ancestor grid of multiple grids; according to the boundary coordinates of multiple grids, a plurality of second encodings corresponding to multiple grids are determined through the second spatial grid encoding algorithm, wherein , the multiple second codes respectively correspond to the boundary coordinates of the multiple grids; according to the first code and the multiple second codes, determine the target code of the area to be coded.
第二方面,本申请实施例提供了一种区域编码装置,包括:获取模块,用于获取待编码区域的位置范围;第一编码模块,用于确定覆盖位置范围的多个网格,确定多个网格的最近公共祖先网格的第一编码,多个网格是通过第一空间网格编码算法得到的;第二编码 模块,用于根据多个网格的各边界坐标,通过第二空间网格编码算法确定多个网格对应的多个第二编码,其中,多个第二编码分别对应于多个网格的各边界坐标;确定模块,用于根据第一编码和多个第二编码,确定待编码区域的目标编码。In the second aspect, the embodiment of the present application provides an area encoding device, including: an acquisition module, used to acquire the location range of the area to be encoded; a first encoding module, used to determine multiple grids covering the location range, and determine the The first coding of the nearest common ancestor grid of a grid, the multiple grids are obtained through the first spatial grid coding algorithm; the second coding module is used to pass the second coding according to the boundary coordinates of multiple grids The spatial grid coding algorithm determines multiple second codes corresponding to multiple grids, wherein the multiple second codes correspond to the boundary coordinates of the multiple grids; the determining module is configured to use the first code and the multiple second codes The second code is to determine the target code of the area to be coded.
第三方面,本申请实施例提供了一种电子设备,包括:存储器、处理器、通信接口;其中,存储器上存储有可执行代码,当可执行代码被处理器执行时,使处理器至少可以实现如第一方面的区域编码方法。In a third aspect, the embodiment of the present application provides an electronic device, including: a memory, a processor, and a communication interface; wherein, executable code is stored in the memory, and when the executable code is executed by the processor, the processor can at least Realize the region coding method as in the first aspect.
第四方面,本申请实施例提供了一种非暂时性机器可读存储介质,非暂时性机器可读存储介质上存储有可执行代码,当可执行代码被电子设备的处理器执行时,使处理器至少可以实现如第一方面的区域编码方法。In a fourth aspect, the embodiment of the present application provides a non-transitory machine-readable storage medium, on which executable code is stored, and when the executable code is executed by a processor of an electronic device, the The processor can at least implement the region coding method in the first aspect.
第五方面,本申请实施例提供了一种区域编码方法,包括:根据车辆在设定时长内连续对应于驻留状态的位置信息,确定待编码区域的位置范围;确定覆盖位置范围的多个网格,多个网格是通过第一空间网格编码算法得到的;确定多个网格的最近公共祖先网格的第一编码;根据多个网格的各边界坐标,通过第二空间网格编码算法确定多个网格对应的多个第二编码,其中,多个第二编码分别对应于多个网格的各边界坐标;根据第一编码和多个第二编码,确定待编码区域的目标编码;存储目标编码与车辆的车辆标识之间的对应关系。In the fifth aspect, the embodiment of the present application provides an area encoding method, including: determining the position range of the area to be encoded according to the position information of the vehicle corresponding to the parking state within a set time period; Grid, multiple grids are obtained through the first spatial grid encoding algorithm; determine the first encoding of the nearest common ancestor grid of multiple grids; according to the boundary coordinates of multiple grids, through the second spatial network The lattice coding algorithm determines multiple second codes corresponding to multiple grids, wherein the multiple second codes correspond to the boundary coordinates of multiple grids respectively; according to the first code and multiple second codes, determine the area to be coded The target code; store the corresponding relationship between the target code and the vehicle identification of the vehicle.
上述概述仅仅是为了说明书的目的,并不意图以任何方式进行限制。除上述描述的示意性的方面、实施方式和特征之外,通过参考附图和以下的详细描述,本申请进一步的方面、实施方式和特征将会是容易明白的。The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present application will be readily apparent by reference to the drawings and the following detailed description.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present application. For those skilled in the art, other drawings can also be obtained based on these drawings without creative effort.
图1为本申请实施例提供的一种区域编码方法的流程图;FIG. 1 is a flow chart of an area coding method provided in an embodiment of the present application;
图2为本申请实施例提供的一种覆盖待编码区域的S2网格集合确定结果的示意图;FIG. 2 is a schematic diagram of a determination result of an S2 grid set covering an area to be encoded provided by an embodiment of the present application;
图3为本申请实施例提供的一种S2网格集合的最近公共祖先网格的示意图;FIG. 3 is a schematic diagram of a nearest common ancestor grid of a S2 grid set provided in an embodiment of the present application;
图4为本申请实施例提供的一种边界位置偏差的两个区域具有同一编码结果的示意图;Fig. 4 is a schematic diagram of two areas with a boundary position deviation having the same encoding result provided by the embodiment of the present application;
图5为本申请实施例提供的一种区域编码方法的流程图;FIG. 5 is a flow chart of an area coding method provided in an embodiment of the present application;
图6为本申请实施例提供的一种区域编码装置的结构示意图;以及FIG. 6 is a schematic structural diagram of a region coding device provided by an embodiment of the present application; and
图7为与图6所示实施例提供的区域编码装置对应的电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device corresponding to the region encoding device provided in the embodiment shown in FIG. 6 .
具体实施方式Detailed ways
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员 在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments It is a part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
下面结合附图对本申请的一些实施方式作详细说明。在各实施例之间不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。另外,下述各方法实施例中的步骤时序仅为一种举例,而非严格限定。Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. Under the condition that there is no conflict between the various embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the sequence of steps in the following method embodiments is only an example, rather than a strict limitation.
本申请实施例提供的区域编码方法可以由一电子设备来执行,该电子设备可以是服务器,也可以是用户终端,该服务器可以是云端的物理服务器或虚拟服务器(虚拟机)。The region coding method provided in the embodiment of the present application can be executed by an electronic device, which can be a server or a user terminal, and the server can be a physical server or a virtual server (virtual machine) in the cloud.
本申请实施例提供的区域编码方法中所使用的两种不同的空间网格编码算法,比如第一空间网格编码算法可以是Google S2算法,第二空间网格编码算法可以是Geohash算法,当然,不以此为限,第一空间网格编码算法可以是任何一种能够将地球空间(或说地图空间)进行不同尺度的网格划分,并为每个网格进行唯一性编码的空间网格编码算法。Two different spatial grid coding algorithms used in the area coding method provided by the embodiment of the present application, for example, the first spatial grid coding algorithm can be the Google S2 algorithm, and the second spatial grid coding algorithm can be the Geohash algorithm, of course , not limited to this, the first spatial grid encoding algorithm can be any spatial grid that can divide the earth space (or map space) into grids of different scales and uniquely encode each grid lattice encoding algorithm.
Geohash算法,由Gustavo Niemeyer发明,它是一种分级的数据结构,把空间划分为四边形网格。Geohash算法所做的事情就是对一个经纬度坐标点进行编码,将其映射到一个字符串上,每个字符串表示的就是一个以经纬度划分出的矩形区域,不同的经纬度坐标可能映射为同一个字符串。Geohash算法计算出的字符串的长度(编码长度),可以控制网格的大小。Geohash编码有12级,边长范围从5000km到3.7cm。该算法提供的12级中,中间每一级的变化比较大,有时候可能选择上一级覆盖范围会过大,而选择下一级又会过小。The Geohash algorithm, invented by Gustavo Niemeyer, is a hierarchical data structure that divides space into a quadrilateral grid. What the Geohash algorithm does is to encode a latitude and longitude coordinate point and map it to a string. Each string represents a rectangular area divided by latitude and longitude. Different latitude and longitude coordinates may be mapped to the same character. string. The length (code length) of the string calculated by the Geohash algorithm can control the size of the grid. There are 12 levels of Geohash encoding, and the side length ranges from 5000km to 3.7cm. Among the 12 levels provided by the algorithm, the change of each level in the middle is relatively large, and sometimes the coverage of the upper level may be too large, while the coverage of the lower level may be too small.
Google S2算法中定义了一个将单位球体分解成单元格层次结构的框架。每个网格(Cell)是由四个测地线限定的四边形。通过将立方体的六个面投影到单位球上来获得层级的顶层,递归地通过将每个上层网格细分为四个子网格(子层)来获得较低层。S2库将单位球体分解为称为Cell的层次结构,对三维球体(类似于地球)上的所有Cell进行编码,每个单元的编码即由一个64位的CellId唯一标识,即每个网格的编码结果的长度都是64bit。S2算法提供了一共30个等级(level)的网格编码,范围边长从0.7cm到85,000,000km。该算法提供的30个等级中,中间每一级的变化都比较平缓,接近于4次方的曲线。A framework for decomposing a unit sphere into a hierarchy of cells is defined in the Google S2 algorithm. Each grid (Cell) is a quadrilateral bounded by four geodesics. The top layers of the hierarchy are obtained by projecting the six faces of the cube onto the unit sphere, and the lower layers are obtained recursively by subdividing each upper mesh into four sub-meshes (sublayers). The S2 library decomposes the unit sphere into a hierarchical structure called Cell, and encodes all the Cells on the three-dimensional sphere (similar to the earth). The encoding of each unit is uniquely identified by a 64-bit CellId, that is, the cellId of each grid The length of the encoding result is 64bit. The S2 algorithm provides a total of 30 levels of grid coding, ranging from 0.7cm to 85,000,000km in side length. Among the 30 levels provided by the algorithm, the change of each level in the middle is relatively gentle, close to the curve of the 4th power.
本申请实施例提供的区域编码方案,可以适用于动态区域编码场景中,其中,所谓动态是指诸如车辆等移动体每次实际上在同一“功能区域”内但因为车辆可能的低速移动和路线更改导致的驻留区域有所偏差的情形。The area coding scheme provided by the embodiment of the present application can be applied to the scene of dynamic area coding, wherein the so-called dynamic means that the moving objects such as vehicles are actually in the same "functional area" each time but because of the possible low-speed movement and route of the vehicle Situations where the residency area deviates due to the change.
比如前文所举例的:在同一装卸货点或停车场区域,车辆第一天对应的驻留区域为A,第二天对应的驻留区域为B,驻留区域A和驻留区域B不完全相同,边界会有所偏差,但是实际上都在同一功能区域——装卸货点或停车场区域,因此,在对驻留区域A和驻留区域B进行空间网格编码时,从最终结果来说,两个驻留区域最终对应的编码结果应该是一致的,因为实际上都对应于同一功能区域。换个角度来说,针对其中一个驻留区域比如驻留区域A来说,其最终的编码结果需要容忍区域一定范围的边界偏差,也就是说,该编码结果针对与驻留区域A的边界稍有偏差的驻留区域B来说,同样适用。简单来说,假设将最终的编码结果所能覆盖的范围称为范围X,那么驻留区域A和驻留区域B都应该包含在该范围X内,但是范围X又不应该比驻留区域A、驻留区域B的位置范围大过多,因为这样编码精度就会过低。For example, in the example 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, and the parking area corresponding to the second day is B, and the parking area A and parking area B are incomplete. The same, the boundary will be deviated, but they are actually in the same functional area - the loading and unloading point or the parking area. In other words, the coding results corresponding to the two resident areas should be the same, because they actually correspond to the same functional area. From another perspective, for one of the resident areas such as resident area A, the final encoding result needs to tolerate a certain range of boundary deviations in the area, that is, the encoding result is slightly different from the boundary of the resident area A. The same applies for the dwell area B of the deviation. To put it simply, assuming that the range covered by the final encoding result is called range X, then both the resident area A and the resident area B should be included in the range X, but the range X should not be larger than the resident area A. 1. The location range of the dwelling area B is too large, because the encoding precision will be too low.
下面对本申请实施例提供的区域编码方案的实施过程进行说明。The implementation process of the region coding scheme provided by the embodiment of the present application will be described below.
图1为本申请实施例提供的一种区域编码方法100的流程图,如图1所示,该方法100包括如下步骤101至步骤104。FIG. 1 is a flow chart of an area coding method 100 provided by an embodiment of the present application. As shown in FIG. 1 , the method 100 includes the following steps 101 to 104 .
在步骤101、获取待编码区域的位置范围。In step 101, the location range of the region to be coded is obtained.
在一实施例中,获取待编码区域的位置范围,可以实现为:获取车辆连续发送的位置信息;若根据位置信息确定车辆在超过设定时长内均处于低速移动状态,则根据设定时长内收到的位置信息确定待编码区域的位置范围。In one embodiment, obtaining the location range of the area to be coded can be achieved by: obtaining the location information continuously sent by the vehicle; if it is determined according to the location information that the vehicle is moving at a low speed within a set The received location information determines the location range of the area to be coded.
其中,低速移动状态包括停止状态以及速度低于设定阈值的移动状态。Wherein, the low-speed moving state includes a stop state and a moving state whose speed is lower than a set threshold.
车辆可以每隔较短的设定时间间隔上报自己的车辆状态数据,包括当前的位置,移动速度等,假设上述设定时长为10分钟,如果车辆在连续的10分钟内,上报的速度都低于设定阈值,则可以认为该车辆处于驻留状态,此时,可以合并这10分钟内接收到的各个位置坐标(经纬度坐标),确定由这些经纬度坐标所界定出的位置范围作为待编码区域的位置范围,亦即驻留区域的位置范围。比如计算出最大经纬度和最小经纬度,也就是矩形的东南角和西北角位置,这样画出来的矩形就是驻留区域即待编码区域。10分钟仅为举例,可以根据实际需要而设定该设定时长的取值。The vehicle can report its own vehicle status data at short set time intervals, including the current position, moving speed, etc. Assuming that the above-mentioned set time is 10 minutes, if the vehicle is within 10 consecutive minutes, the reported speed is low When the threshold is set, it can be considered that the vehicle is in a parked state. At this time, the location coordinates (latitude and longitude coordinates) received within the 10 minutes can be combined to determine the location range defined by these latitude and longitude coordinates as the area to be encoded. The location range of , that is, the location range of the residence area. For example, calculate the maximum longitude and latitude and minimum longitude and latitude, that is, the positions of the southeast and northwest corners of the rectangle, and the rectangle drawn in this way is the resident area, that is, the area to be coded. 10 minutes is just an example, and the value of the set duration can be set according to actual needs.
待编码区域的确定方式不局限于以上述最大经纬度和最小经纬度所确定的矩形区域,其他用于确定包围上述10分钟内的各个位置坐标的最小外接多边形区域的方法均可以。The way to determine the area to be coded is not limited to the rectangular area determined by the above-mentioned maximum latitude and longitude and minimum longitude and latitude, other methods for determining the minimum circumscribed polygonal area surrounding each position coordinate within the above 10 minutes can be used.
另外,上述举例中是以移动速度为依据来确定车辆的驻留状态的,实际上,也可以通过如下方式确定车辆是否处于驻留状态:根据车辆连续10分钟内上报的位置坐标,确定这10分钟车辆的移动距离,如果移动距离小于设定阈值(比如200米),则认为车辆在这10分钟内处于驻留状态,根据这10分钟内上报的各位置坐标计算出待编码区域的位置范围。In addition, in the above example, the parking state of the vehicle is determined based on the moving speed. In fact, whether the vehicle is in the parking state can also be determined in the following way: According to the position coordinates reported by the vehicle within 10 consecutive minutes, determine the 10 The moving distance of the vehicle in minutes, if the moving distance is less than the set threshold (such as 200 meters), it is considered that the vehicle is in the parking state within these 10 minutes, and the position range of the area to be encoded is calculated according to the position coordinates reported within these 10 minutes .
针对一种特殊情形,假设车辆在连续10分钟内的上报位置都相同,即车辆处于完全停止状态,此时,可以确定待编码区域为以该位置坐标为圆心,预设长度为半径的圆形区域,该预设长度比如为200米。For a special situation, assuming that the reported position of the vehicle is the same within 10 consecutive minutes, that is, the vehicle is completely stopped, at this time, it can be determined that the area to be encoded is a circle with the position coordinate as the center and the preset length as the radius area, the preset length is, for example, 200 meters.
在步骤102、确定覆盖待编码区域的位置范围的多个网格,确定多个网格的最近公共祖先网格的第一编码,多个网格是通过第一空间网格编码算法得到的。In step 102, a plurality of grids covering the location range of the area to be encoded is determined, and a first encoding of the nearest common ancestor grid of the plurality of grids is determined, and the plurality of grids are obtained through a first spatial grid encoding algorithm.
在一种实施例中,以第一空间网格编码算法为Google S2算法为例,S2库中提供有用于求取覆盖某个区域的网格的函数,这里称为网格筛选算法,针对某个区域x来说,设置最大网格数(MaxCells)、网格的最大精度等级(MaxLevel)、网格的最小精度等级(MinLevel)这些参数,即可以通过该网格筛选算法求解出覆盖该区域x的网格集合。In one embodiment, taking the first spatial grid coding algorithm as the Google S2 algorithm as an example, the S2 library provides a function for obtaining a grid covering a certain area, which is called a grid screening algorithm here, and for a certain For an area x, set the parameters such as the maximum number of cells (MaxCells), the maximum accuracy level of the grid (MaxLevel), and the minimum accuracy level of the grid (MinLevel), that is, the grid screening algorithm can be used to solve the problem that covers the area The grid collection of x.
基于此,本实施例中,确定覆盖待编码区域的位置范围的多个网格,可以实现为:从第一空间网格编码算法提供的多种不同网格精度等级中确定与待编码区域的位置范围匹配的目标网格精度等级;将目标网格精度等级以及网格数量输入预设的网格筛选算法中,以通过网格筛选算法输出多个第二网格。Based on this, in this embodiment, determining a plurality of grids covering the location range of the area to be encoded can be implemented as: determining from a variety of different grid precision levels provided by the first spatial grid encoding algorithm and the grid area to be encoded A target grid accuracy level for location range matching; input the target grid accuracy level and the number of grids 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 of obtaining several grids of different scales (that is, different precision levels) corresponding to the earth space through the first spatial grid coding algorithm in advance, in fact, not only the Encoding, and the coverage location range of each grid is also known, and the coverage location range can be represented by the four boundary coordinates of the grid. In addition, the input of the above-mentioned grid screening algorithm also includes the location range of the area to be encoded, so that the grid screening algorithm can screen out a plurality of grids that match the location range of the area to be encoded from several known grids . The mesh screening algorithm can find the plurality of meshes by using a greedy algorithm.
另外,从第一空间网格编码算法提供的多种不同网格精度等级中确定与待编码区域的位置范围匹配的目标网格精度等级,在一种实施方式中,可以基于待编码区域的面积以及每种等级的网格的覆盖面积,确定与待编码区域的面积相匹配的目标网格精度等级。或者,在一种实施方式中,也可以设置目标网格精度等级为默认的某个等级,比如level=13,其覆盖边长约为1000米,因为实际应用中的大部分功能区域的边长一般都在1000米的范围内。In addition, the target grid accuracy level matching the location range of the area to be encoded is determined from a variety of different grid accuracy levels provided by the first spatial grid encoding algorithm. In one embodiment, it can be based on the area of the area to be encoded As well as the coverage area of each level of grid, determine the target grid accuracy level that matches the area of the area to be coded. Or, in one embodiment, the target grid accuracy level can also be set to a default level, such as level=13, which covers a side length of about 1000 meters, because the side length of most functional areas in practical applications Generally within the range of 1000 meters.
由上述说明可知,本实施例中,可以将参数设置如下:MaxLevel=MinLevel=13,MaxCells=1。It can be known from the above description that in this embodiment, the parameters can be set as follows: MaxLevel=MinLevel=13, MaxCells=1.
其中,MaxLevel=MinLevel的设置,使得确定出的多个网格是相等精度等级的,这样多个网格实际上是位置相邻的网格。MaxCells=1,并非意味着确定出的网格的数量仅为一个,而是在如果不能找到一个能够包围住待编码区域的精度等级符合MaxLevel=MinLevel约束的网格的时候,会进一步寻找最少数量的能够包围住待编码区域的精度等级符合MaxLevel=MinLevel约束的多个网格,该最少数量亦即多个网格的数量一般大于或等于2。Wherein, the setting of MaxLevel=MinLevel makes the determined multiple grids have the same precision level, so that the multiple grids are actually adjacent grids. MaxCells=1 does not mean that the number of determined grids is only one, but if a grid with a precision level that can surround the area to be encoded cannot be found and meets the MaxLevel=MinLevel constraint, it will further search for the minimum number The precision level that can enclose the area to be coded is a plurality of grids conforming to the constraint of MaxLevel=MinLevel, and the minimum number, that is, the number of multiple grids is generally greater than or equal to 2.
当然,如果实际应用中,通过上述网格筛选算法,基于输入的参数值,直接找到了一个能够包围住待编码区域的精度等级符合MaxLevel=MinLevel约束的网格的时候,那么这个网格的编码即可以作为待编码区域最终对应的目标编码,结束编码处理即可。Of course, if in practical applications, through the above-mentioned grid screening algorithm, based on the input parameter values, a grid that can enclose the area to be encoded with a precision level that meets the constraint of MaxLevel=MinLevel is directly found, then the grid’s encoding That is, it can be used as the final target encoding corresponding to the area to be encoded, and the encoding process can be ended.
需要说明的是,实际上,MaxLevel也可以与MinLevel不等,比如MinLevel设置为覆盖面积等于或小于待编码区域对应的面积的某个网格精度等级,MaxLevell设置为覆盖面积大于待编码区域对应的面积的某个网格精度等级。MaxCells也可以设置为大于1的数值。It should be noted that, in fact, MaxLevel can also be different from MinLevel. For example, MinLevel is set to a certain grid precision level whose coverage area is equal to or smaller than the area corresponding to the area to be coded, and MaxLevell is set to cover an area larger than the area corresponding to the area to be coded. A certain grid precision level for the area. MaxCells can also be set to a value greater than 1.
结合图2来示例性说明上述覆盖待编码区域的多个网格的确定结果,如图2中,假设待编码区域为图中示意的一个多边形,并假设通过网格筛选算法得出的覆盖该待编码区域的多个网格由网格g1和网格g2组成,其中假设网格g1和网格g2对应的精度等级都为13。In conjunction with Fig. 2, the determination results of the above-mentioned multiple grids covering the region to be coded are exemplified. The multiple grids in the area to be coded are composed of grid g1 and grid g2, where it is assumed that the precision levels corresponding to grid g1 and grid g2 are both 13.
也就是说,图2中示意的是待编码区域跨越了不同网格的情形,实际上,网格g1和网格g2可能存在兄弟关系,也可能存在表兄弟关系。如果是兄弟关系,两者会有共同的父网格。如果是表兄弟关系,其父网格之间存在兄弟或表兄弟关系。但是不管网格g1和网格g2具体表现为哪种位置相邻关系,当待编码区域由多个网格才能覆盖时,这种情况无法直接采用网格g1和网格g2的编码对待编码区域进行唯一编码。That is to say, what is illustrated in FIG. 2 is a situation where the region to be encoded spans different grids. In fact, grid g1 and grid g2 may have a brother relationship or a cousin relationship. If it is a sibling relationship, both will have a common parent grid. In the case of a cousin relationship, there is a brother or cousin relationship between its parent grids. However, no matter what kind of adjacent relationship between grid g1 and grid g2 is, when the area to be coded can only be covered by multiple grids, it is impossible to directly use the coding of grid g1 and grid g2 to code the area to be coded uniquely coded.
因此,接下来,需要确定这多个网格的最近公共祖先网格,将该最近公共祖先网格的编码称为第一编码。Therefore, next, it is necessary to determine the nearest common ancestor grid of the plurality of grids, and the encoding of the nearest common ancestor grid is called the first encoding.
在介绍上述多个网格的最近公共祖先网格的第一编码的确定过程之前,先结合图3示例性说明网格g1和网格g2的最近公共祖先网格。Before introducing the determination process of the first encoding of the nearest common ancestor grids of the above-mentioned multiple grids, the nearest common ancestor grids of grid g1 and grid g2 are illustrated with reference to FIG. 3 .
如图3中所示,首先,需要找到网格g1和网格g2各自的父网格,假设分别为网格parent_g1和网格parent_g2,发现网格parent_g1和网格parent_g2仍旧为位置相邻的两个不同网格,进而,继续找网格parent_g1和网格parent_g2的父网格,假设分别表示为网格parent_parent_g1和网格parent_parent_g2。发现网格parent_parent_g1和网格parent_ parent_g2仍旧为位置相邻的两个不同网格,继续找网格parent_parent_g1和网格parent_parent_g2的父网格,以此类推,假设最终找到了一个网格G,即网格parent_parent_g1和网格parent_parent_g2的父网格为同一个网格G,此时,网格G即为网格g1和网格g2的最近公共祖先网格。As shown in Figure 3, first, it is necessary to find the respective parent grids of grid g1 and grid g2, assuming that they are grid parent_g1 and grid parent_g2 respectively, and it is found that grid parent_g1 and grid parent_g2 are still two neighboring grids. different grids, and then continue to find the parent grids of grid parent_g1 and grid parent_g2, which are assumed to be grid parent_parent_g1 and grid parent_parent_g2 respectively. It is found that the grid parent_parent_g1 and the grid parent_parent_g2 are still two different grids adjacent to each other, continue 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, that is, the grid The parent grid of grid parent_parent_g1 and grid parent_parent_g2 is the same grid G, and at this time, grid G is the nearest common ancestor grid of grid g1 and grid g2.
在Google S2算法中,每个网格编码(CellID)是由64位组成的。开头的3位表示正方体6个面中的一个,取值范围[0,5]。3位可以表示数值0-7,但是6,7是无效值。64位的最后一位是1,这一位是特意留出来的。用来快速查找中间有多少位。从末尾最后一位向前查找,找到第一个不为0的位置,即找到第一个1,这一位的前一位到开头的第4位(因为前3位被占用)都是可用数字。level>0的网格都有公共祖先。In the Google S2 algorithm, each grid code (CellID) is composed of 64 bits. The first 3 bits represent one of the 6 faces of the cube, and the value range is [0,5]. 3 bits can represent the value 0-7, but 6, 7 are invalid values. The last bit of 64 bits is 1, which is reserved on purpose. Used to quickly find how many bits are in the middle. Search forward from the last digit at the end to find the first position that is not 0, that is, to find the first 1, and the previous digit of this digit to the 4th digit at the beginning (because the first 3 digits are occupied) are all available number. Meshes with level > 0 have a common ancestor.
基于网格编码的数据结构可知,实际上,查找最近公共祖先网格的问题可以转化为从左往右查找多个网格编码的二进制串中的最长公共序列问题,最长的即是从根节点(level=1的网格的编码)开始最远的公共祖先,也就是最近公共祖先网格。Based on the grid coded data structure, in fact, the problem of finding the nearest common ancestor grid can be transformed into the problem of finding the longest common sequence in multiple grid coded binary strings from left to right, and the longest one is from The root node (encoding of the grid with level=1) starts with the furthest common ancestor, which is the nearest common ancestor grid.
在一种实施方式中,可以通过如下方式确定多个网格的最近公共祖先网格:对多个网格的编码进行异或处理,得到异或结果;根据异或结果的位数长度确定多个网格的编码的公共序列长度;根据公共序列长度,确定多个网格的最近公共祖先网格的第一编码。In one embodiment, the nearest common ancestor grid of multiple grids can be determined in the following manner: Exclusive OR processing is performed on the codes of multiple grids to obtain an exclusive OR result; The common sequence length of the coding of grids; according to the common sequence length, determine the first coding of the nearest common ancestor grid of multiple grids.
由于64位长度过程,为便于举例,这里仅以某个短一些的长度24来举例说明:假设网格g1的编码为:111111111100000000000000。假设网格g2的编码为:111111121100000000000000。Due to the 64-bit length process, for the convenience of examples, only a shorter length of 24 is used as an example here: suppose the code of the grid g1 is: 111111111100000000000000. Suppose the code of grid g2 is: 111111121100000000000000.
上述两个网格的编码的异或结果为:000000010000000000000000,即10000000000000000,长度为17。注意,异或后前边的多位0是没有意义的,所以忽略。The XOR result of the coding of the above two grids is: 000000010000000000000000, that is, 10000000000000000, and the length is 17. Note that the multi-bit 0s in front of the XOR are meaningless, so ignore them.
基于此,这两个网格的编码的公共序列长度为:24-17=7位,意味着这两个网格的编码的前7位是相同的,所以,从这两个网格的编码中截取出前7位编码,剩下的17位编码置为0即可以得到这两个网格的最近公共祖先网格的编码:111111100000000000000000。Based on this, the common sequence length of the coding of the two grids is: 24-17=7 bits, which means that the first 7 bits of the coding of the two grids are the same, so, from the coding of the two grids Intercept the first 7 codes, and set the remaining 17 codes to 0 to get the code of the nearest common ancestor grid of the two grids: 111111100000000000000000.
在步骤103、根据多个网格的各边界坐标,通过第二空间网格编码算法确定多个网格对应的多个第二编码,其中,多个第二编码分别对应于多个网格的各边界坐标。In step 103, according to the boundary coordinates of the plurality of grids, a plurality of second codes corresponding to the plurality of grids are determined through the second spatial grid encoding algorithm, wherein the plurality of second codes correspond to the plurality of grids respectively Coordinates of each boundary.
在步骤104、根据第一编码和多个第二编码,确定待编码区域的目标编码。In step 104, according to the first code and multiple second codes, the target code of the region to be coded is determined.
其中,可以先确定多个第二编码的公共前缀编码,进而,根据第一编码和该公共前缀编码,确定待编码区域的目标编码。Wherein, the common prefix codes of multiple second codes may be determined first, and then, according to the first codes and the common prefix codes, the target codes of the regions to be coded are determined.
本申请实施例中,可以将车辆在一段时间内处于驻留状态下所对应的位置坐标所界定出的区域作为待编码区域,该待编码区域的位置范围由最小、最大经纬度坐标来确定,在得到待编码区域的位置范围后,对该待编码区域进行空间网格编码,以确定其对应的目标编码。具体地,首先,在通过第一空间网格编码算法(如Google S2算法)得到的已知的若干网格中,确定覆盖待编码区域的多个网格,进而确定多个网格的最近公共祖先网格,即确定最近公共祖先网格的编码(称为第一编码)。其次,根据多个网格的各边界坐标,通过第二空间网格编码算法(如Geohash算法)确定多个网格对应的多个第二编码,其中,多个第二编码分别对应于多个网格的各边界坐标。最终,根据第一编码和多个第二编码,确定待编码区域的目标编码。In the embodiment of the present application, the area defined by the position coordinates corresponding to the vehicle in the parking state for a period of time can be used as the area to be encoded. The position range of the area to be encoded is determined by the minimum and maximum latitude and longitude coordinates. After the location range of the area to be encoded is obtained, spatial grid encoding is performed on the area to be encoded to determine its corresponding target encoding. Specifically, first, among the known grids obtained by the first spatial grid encoding algorithm (such as Google S2 algorithm), determine multiple grids covering the area to be encoded, and then determine the nearest common grid of multiple grids. The ancestral grid, that is, the encoding that determines the nearest common ancestor grid (referred to as the first encoding). Secondly, according to the boundary coordinates of multiple grids, a plurality of second codes corresponding to multiple grids are determined through a second spatial grid coding algorithm (such as Geohash algorithm), wherein the multiple second codes correspond to multiple The coordinates of each boundary of the grid. Finally, according to the first code and multiple second codes, the target code of the region to be coded is determined.
本申请实施例中,联合使用两种不同的空间网格编码算法来对待编码区域进行唯一性 编码,其中,在基于第一空间网格编码算法得到的不同等级的网格中确定出与待编码区域对应的多个网格,并计算出这多个网格的最近公共祖先网格后,由于最近公共祖先网格能够覆盖的范围可能会比待编码区域的范围大很多,直接采用最近公共祖先网格对应的第一编码作为待编码区域的唯一编码标识的话,会存在很大的位置偏差,因此,为了降低偏差,结合了第二空间网格编码算法参与待编码区域的编码,在最近公共祖先网格会导致较大误差的情形下,可以通过上述多个网格在第二空间网格编码算法各自对应的第二编码结果来降低误差,从而,使得待编码区域最终得到的编码结果精度更高。另外,上述公共祖先网格的第一编码以及上述多个第二编码的结合,以确定待编码区域的网格编码结果,可以容忍一定程度的待编码区域边界的偏差,即比如两个边界坐标不同但是大部分重合的待编码区域,采用本申请实施例提供的这种编码方法往往可以使得这两个待编码区域具有相同的编码结果。In the embodiment of the present application, two different spatial grid encoding algorithms are jointly used to uniquely encode the area to be encoded, wherein, the grids of different levels obtained based on the first spatial grid encoding algorithm are determined to be After calculating the multiple grids corresponding to the region, and calculating the nearest common ancestor grids of these multiple grids, since the range that the nearest common ancestor grid can cover may be much larger than the range of the area to be encoded, the nearest common ancestor is directly used If the first code corresponding to the grid is used as the unique coding identifier of the region to be coded, there will be a large positional deviation. Therefore, in order to reduce the deviation, the second space grid coding algorithm is combined to participate in the coding of the area to be coded. In the recent public In the case that the ancestral grid will cause a large error, the error can be reduced through the second encoding results corresponding to the above-mentioned multiple grids in the second spatial grid encoding algorithm, so that the accuracy of the encoding result finally obtained in the area to be encoded higher. In addition, the combination of the first encoding of the above-mentioned common ancestor grid and the above-mentioned multiple second encodings to determine the grid encoding result of the area to be encoded can tolerate a certain degree of deviation of the boundary of the area to be encoded, that is, for example, two boundary coordinates For different but mostly overlapping areas to be encoded, the encoding method provided by the embodiment of the present application can often make the two areas to be encoded have the same encoding result.
上文对于待编码区域由多个网格覆盖的情况下计算了多个网格的最近公共祖先网格的编码,由于最近公共祖先网格对应的精度等级可能与上述MinLevel网格的精度等级相差较大,会导致最近公共祖先网格的边长比待编码区域的最大边长偏差较大。如图3中示意的,假设网格g1和网格g2的level=15,边长约306米,待编码区域的最大边长约600米,网格g1和网格g2的最近公共祖先网格的level=11,边长约5000米,偏差较大。For the case where the region to be encoded is covered by multiple grids, the encoding of the nearest common ancestor grid of multiple grids is calculated, because the accuracy level corresponding to the nearest common ancestor grid may differ from the accuracy level of the above MinLevel grid Larger, it will cause the side length of the nearest common ancestor grid to be larger than the maximum side length deviation of the region to be encoded. As shown in Figure 3, assuming that grid g1 and grid g2 have level=15, the side length is about 306 meters, the maximum side length of the region to be coded is about 600 meters, and the nearest common ancestor grid of grid g1 and grid g2 The level=11, the side length is about 5000 meters, and the deviation is large.
为了降低误差,本实施例结合了第二空间网格编码算法如geohash算法参与待编码区域的空间编码过程中,geohash网格编码的长度类似上述第一空间网格编码算法的网格精度层级,不同编码长度对应于不同的覆盖范围,在上述多个网格的最近公共祖先网格的编码具有较大误差的情况下,可以通过多个网格对应的geohash编码的最长公共前缀降低误差。In order to reduce the error, this embodiment combines the second spatial grid encoding algorithm such as the geohash algorithm to participate in the spatial encoding process of the area to be encoded. The length of the geohash grid encoding is similar to the grid precision level of the first spatial grid encoding algorithm above. Different encoding lengths correspond to different coverage areas. In the case that the encoding of the nearest common ancestor grid of the above multiple grids has a large error, the error can be reduced by the longest common prefix of the geohash encoding corresponding to the multiple grids.
在一种实施方式中,首先,根据多个网格的各边界坐标,通过第二空间网格编码算法如geohash算法确定多个网格对应的多个第二编码。如上文,每个网格的四个边界坐标是已知的,基于geohash算法可以得到每个边界坐标对应的编码结果。In one embodiment, firstly, according to the boundary coordinates of the multiple grids, multiple second codes corresponding to the multiple grids are determined through a second spatial grid coding algorithm such as the geohash algorithm. As above, the four boundary coordinates of each grid are known, and the encoding result corresponding to each boundary coordinate can be obtained based on the geohash algorithm.
另外,如上文,geohash算法可以输出不同长度的编码,每种长度对应于不同的覆盖范围。实际应用中,可以根据实际情况,设置某个默认的目标编码长度,比如9位,这样,每个边界坐标都将编码成长度为该目标编码长度的编码。或者,该目标编码长度也可以根据如下方式确定:获取第二空间网格编码算法下,不同编码长度对应的覆盖范围;根据待编码区域的位置范围以及不同编码长度对应的覆盖范围,确定与待编码区域的位置范围相匹配的目标编码长度。其中,该相匹配可以是:目标编码长度对应的边长小于或等于待编码区域的最长边长。In addition, as above, the geohash algorithm can output codes of different lengths, each length corresponding to a different coverage. In practical applications, a default target code length, such as 9 bits, can be set according to the actual situation. In this way, each boundary coordinate will be coded into a code whose length is the target code length. Alternatively, the target coding length can also be determined in the following manner: obtain the coverages corresponding to different coding lengths under the second spatial grid coding algorithm; The location range of the coded region matches the target code length. Wherein, the matching may be: the side length corresponding to the target encoding length is less than or equal to the longest side length of the region to be encoded.
在得到上述多个网格的每个网格的每个边界坐标所对应的第二编码后,确定得到的全部多个第二编码的公共前缀编码。After obtaining the second code corresponding to each boundary coordinate of each grid of the plurality of grids, determine the common prefix code of all the obtained multiple second codes.
在一种实施方式中,假设多个第二编码包括:abcdefg、abcdefd、abcdefe、abcdefb,则这几个编码的最长的公共前缀编码为:abcdef。In one embodiment, assuming that multiple second codes include: abcdefg, abcdefd, abcdefe, abcdefb, the longest common prefix code of these codes is: abcdef.
待编码区域的目标编码可以确定为:上述最近公共祖先网格的第一编码和多个第二编码的公共前缀编码的拼接结果:第一编码_公共前缀编码。The target code of the area to be coded can be determined as: the splicing result of the first code of the above-mentioned nearest common ancestor grid and the common prefix codes of multiple second codes: first code_common prefix code.
但是,实际应用中,可能会出现一些特殊情况,比如公共前缀编码对应的覆盖范围大 于第一编码对应的覆盖范围,此时,待编码区域的目标编码可以采用第一编码即可。However, in practical applications, there may be some special cases, such as the coverage area corresponding to the common prefix code is larger than the coverage area corresponding to the first code. At this time, the target code of the area to be coded can use the first code.
也就是说,若公共前缀编码对应的覆盖范围小于第一编码对应的覆盖范围,则确定待编码区域的目标编码为第一编码和公共前缀编码的拼接结果;若公共前缀编码对应的覆盖范围大于第一编码对应的覆盖范围,则确定待编码区域的目标编码为第一编码。That is to say, if the coverage corresponding to the common prefix code is smaller than the coverage corresponding to the first code, it is determined that the target code of the area to be coded is the splicing result of the first code and the public prefix code; if the coverage corresponding to the public prefix code is larger than For the coverage area corresponding to the first code, it is determined that the target code of the area to be coded is the first code.
第一编码和公共前缀编码的拼接结果可以这样理解:在第一编码所界定出的一个大的范围内,进一步划分出了多个小的子区域,其中一个子区域的编码即为公共前缀编码,这个子区域的编码即为待编码区域的编码结果。从而实现了使用geohash公共前缀编码缩小最近s2公共祖先网格编码所导致的误差。The splicing result of the first code and the public prefix code can be understood as follows: within a large range defined by the first code, multiple small sub-regions are further divided, and the code of one of the sub-regions is the common prefix code , the encoding of this sub-area is the encoding result of the area to be encoded. Therefore, the use of geohash common prefix encoding to reduce the error caused by the grid encoding of the nearest s2 common ancestor.
基于上述介绍可知,最终所确定的目标编码所对应的覆盖范围取决于上述第一编码和公共前缀编码所对应的覆盖范围,而这个覆盖范围一般来说是大于待编码区域的位置范围的,因此,这样落入该目标编码所对应的该覆盖范围内的所有待编码区域,通过本申请实施例提供的编码方法,最终都会得到同一目标编码,即该目标编码可以容忍待编码区域的区域边界具有一定程度的偏差,具有良好的可信性和稳定性。比如如图4中所示,图中示意的待编码区域Q1和待编码区域Q2,大部分区域是重合的,只是边界位置有所偏差,基于上述编码方案,最终待编码区域Q1和待编码区域Q2对应于同一目标编码,不会因为这两个待编码区域的些许的边界偏差就导致两个不同的编码结果。Based on the above introduction, it can be seen that the coverage corresponding to the finally determined target code depends on the coverage corresponding to the above-mentioned first code and the common prefix code, and this coverage is generally larger than the location range of the area to be coded, so , so that all the regions to be coded that fall within the coverage corresponding to the target code will eventually get the same target code through the coding method provided by the embodiment of the present application, that is, the target code can tolerate the area boundary of the region to be coded to have A certain degree of deviation, with good credibility and stability. For example, as shown in Figure 4, most of the area to be encoded Q1 and the area to be encoded Q2 shown in the figure overlap, but the boundary position is slightly different. Based on the above encoding scheme, the final area Q1 to be encoded and the area to be encoded Q2 corresponds to the same target encoding, and two different encoding results will not be caused due to a slight boundary deviation between the two regions to be encoded.
另外,通过上述方案得到的该目标编码,其所对应的覆盖范围不会明显大于待编码区域的位置范围很多,因此,编码结果的精度得以保证。In addition, the coverage area corresponding to the target code obtained through the above solution is not significantly larger than the location range of the area to be coded, so the accuracy of the coded result is guaranteed.
在一种实施方式中,对待编码区域进行空间网格编码具有很多现实意义。比如,可以记录目标编码与车辆的驻留信息之间的对应关系,其中,驻留信息中包括车辆的标识以及车辆的驻留次数。该车辆是指根据其位置、移动速度等车辆状态数据确定出的上述待编码区域的车辆。比如,目标编码所对应的地理区域实际上是一个停车场区域,某个车辆经常去往该停车场区域停车,则每次去到该停车场区域停车时,都可以确定出一个待编码区域,而每次确定的待编码区域最终对应的目标编码都是相同的,则可以记录该目标编码与该车辆的停车次数之间的对应关系。In one implementation manner, performing spatial grid coding on the area to be coded has many practical significances. For example, the corresponding relationship between the target code and the resident information of the vehicle may be recorded, wherein the resident information includes the identification of the vehicle and the number of resident times of the vehicle. The vehicle refers to the vehicle in the above-mentioned area to be encoded determined according to the vehicle state data such as its position and moving speed. For example, the geographic area corresponding to the target code is actually a parking lot area. A certain vehicle often parks in this parking lot area, and then every time it goes to this parking lot area to park, it can determine an area to be encoded. However, the final target codes corresponding to each determined area to be coded are the same, and the corresponding relationship between the target codes and the number of parking times of the vehicle can be recorded.
再比如,还可以用于进行用户交通出行情况的分析。例如,某用户经常在X和Y两个地方之间往返,那么每次驾车去到地点X的时候,都可以确定出一个待编码区域,通过上述方案确定出每个待编码区域对应的目标编码均为A,同理,每次驾车去到地点Y的时候,都可以确定出一个待编码区域,通过上述方案确定出每个待编码区域对应的目标编码均为B,进而,再结合目标编码A和目标编码B上关联记录的该车辆的停车次数,以及每次确定上述目标编码A和目标编码B的时间之间的规律,便可以分析出该用户经常在这两个目标编码所对应的地理区域之间往返的分析结果。For another example, it can also be used to analyze the traffic situation of users. For example, if a user often travels between places X and Y, then every time he drives to place X, he can determine a region to be coded, and determine the target code corresponding to each region to be coded through the above scheme Both are A. Similarly, every time you drive to the location Y, you can determine a region to be coded. Through the above scheme, it is determined that the target code corresponding to each region to be coded is B. Then, combined with the target code The number of parking times of the vehicle associated with records on A and target code B, and the regularity between the time when the above target code A and target code B are determined each time, it can be analyzed that the user is often in the two target codes. Analysis results to and from geographic regions.
下面对上文中涉及到的两个计算过程的可选具体实施方式进行示例性说明,其中一个计算过程为:确定多个网格的最近公共祖先网格的第一编码,另一个计算过程为:确定多个第二编码的公共前缀编码。The following is an exemplary description of the optional specific implementation of the two calculation processes involved in the above. One of the calculation processes is: determining the first code of the nearest common ancestor grid of multiple grids, and the other calculation process is : Determine the common prefix encoding of multiple second encodings.
针对确定多个网格的最近公共祖先网格的第一编码来说,实际上,多个网格的数量可能不止两个,比如可能三个、四个,等等。确定多个网格的最近公共祖先网格的第一编码,可以直接对这多个网格的编码进行异或计算,根据异或结果确定最近公共祖先网格的第一 编码。或者,基于执行区域编码方案的电子设备的计算能力,也可以两两网格的编码进行异或,最后根据得到的多个异或结果中位数最长的目标异或结果确定最近公共祖先网格的第一编码。比如,假设多个网格由网格1、网格2和网格3构成,网格1与网格2的异或结果的位数长度为n1,网格1与网格3的异或结果的位数长度为n2,网格2与网格3的异或结果的位数长度为n3,并假设n1大于n2,n1大于n3,即网格1与网格2的异或结果的位数n1是最长的,另外网格的编码的总长度是64,则可以确定这三个网格的编码的公共序列长度为:64-n1=m位,意味着这三个网格的编码的前m位是相同的,所以,从这三个网格的编码中截取出前m位编码,剩下的n1位编码置为0即可以得到这三个网格的最近公共祖先网格的编码。Regarding the first code for determining the nearest common ancestor grid of the plurality of grids, in fact, the number of the plurality of grids may be more than two, such as may be three, four, and so on. To determine the first code of the nearest common ancestor grid of multiple grids, XOR calculation can be directly performed on the codes of these multiple grids, and the first code of the nearest common ancestor grid can be determined according to the XOR result. Or, based on the computing power of the electronic equipment that implements the regional coding scheme, it is also possible to perform XOR with the coding of two grids, and finally determine the nearest common ancestor network according to the target XOR result with the longest median of the obtained multiple XOR results The first code of the grid. For example, assuming that multiple grids are composed of grid 1, grid 2 and grid 3, the bit length of the XOR result of grid 1 and grid 2 is n1, and the XOR result of grid 1 and grid 3 The length of bits is n2, the length of bits of the XOR 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 of the XOR result of grid 1 and grid 2 n1 is the longest, and the total length of the coding of the grid is 64 in addition, then it can be determined that the common sequence length of the coding of the three grids is: 64-n1=m bits, which means that the coding of the three grids is The first m bits are the same, so the codes of the nearest common ancestor grid of the three grids can be obtained by cutting out the first m bit codes from the codes of the three grids, and setting the remaining n1 bit codes to 0.
针对确定多个第二编码的公共前缀编码来说,假设多个第二编码的长度都相等,长度为k,则可以先取总长度的中间位置:(1+k)/2=p,比较多个第二编码的前p位,如果相等,则确定多个第二编码的前p位是相同的,此时将遍历范围更新为p位之后剩下的多位,计算剩余多位的中间位置,重复上述过程;而如果多个第二编码的前p位是不相等的,则意味着多个第二编码的公共前缀编码是位于前p位之内的,不会位于p位之后,此时,将遍历范围更新为前p位,计算前p位的中间位置,重复上述判断过程。这样逐层遍历下去,便可以找到多个第二编码的最长公共前缀部分。For determining the common prefix code of multiple second codes, assuming that the lengths of multiple second codes are equal and the length is k, then the middle position of the total length can be taken first: (1+k)/2=p, more If the first p bits of the second codes are equal, it is determined that the first p bits of the multiple second codes are the same, and at this time, the traversal range is updated to the remaining bits after the p bits, and the middle position of the remaining bits is calculated , repeat the above process; and if the first p bits of multiple second codes are not equal, it means that the common prefix codes of multiple second codes are located within the first p bits and will not be located after p bits. , update the traversal range to the first p bits, calculate the middle position of the first p bits, and repeat the above judgment process. In this way, by traversing layer by layer, the longest common prefix part of multiple second codes can be found.
图5为本申请实施例提供的一种区域编码方法500的流程图,如图5所示,该方法500可以包括如下步骤501至步骤504。FIG. 5 is a flow chart of an area coding method 500 provided by an embodiment of the present application. As shown in FIG. 5 , the method 500 may include steps 501 to 504 as follows.
在步骤501,根据车辆在设定时长内连续对应于驻留状态的位置信息,确定待编码区域的位置范围。In step 501, the location range of the area to be coded is determined according to the location information of the vehicle corresponding to the parking state continuously within a set time period.
该步骤的实现可以参考前述实施例中的相关说明,在此不赘述。For the implementation of this step, reference may be made to relevant descriptions in the foregoing embodiments, and details are not repeated here.
在步骤502,确定覆盖位置范围的多个网格,确定多个网格的最近公共祖先网格的第一编码,多个网格是通过第一空间网格编码算法得到的。In step 502, a plurality of grids covering a location range are determined, and a first encoding of a nearest common ancestor grid of the plurality of grids is determined, the plurality of grids are obtained through a first spatial grid encoding algorithm.
在步骤503,根据多个网格的各边界坐标,通过第二空间网格编码算法确定多个网格对应的多个第二编码,其中,多个第二编码分别对应于多个网格的各边界坐标。In step 503, according to the boundary coordinates of the multiple grids, a plurality of second codes corresponding to the multiple grids are determined through the second space grid coding algorithm, wherein the multiple second codes correspond to the multiple grids respectively Coordinates of each boundary.
在步骤504,根据第一编码和多个第二编码,确定待编码区域的目标编码,存储目标编码与车辆的车辆标识之间的对应关系。In step 504, according to the first code and multiple second codes, the target code of the area to be coded is determined, and the corresponding relationship between the target code and the vehicle identification of the vehicle is stored.
在一实施例中,区域编码方法还包括:根据存储结果,确定车辆在目标编码对应的位置区域内的停留次数。其中,目标编码对应的位置区域是指所有编码结果都为该目标编码的位置区域,包括但不限于上述待编码区域。In an embodiment, the area coding method further includes: according to the storage result, determining the number of times the vehicle stays in the location area corresponding to the target code. Wherein, the location area corresponding to the target code refers to the location area where all coding results are the target code, including but not limited to the above-mentioned to-be-coded area.
在一种实施方式中,比如可能存在分析用户经常去往哪些地方的需求,面对该需求,假设用户出行都是驾车出行,到达某个地方后需要停车,在停车过程中,车辆移动速度都比较低,认为持续处于驻留状态(速度低于设定阈值的状态),从而,基于停车过程产生的移动轨迹可以形成上述待编码区域,对待编码区域进行编码得到上述目标编码(目标编码的确定过程参考前述其他实施例中的相关说明),从而记录依次该目标编码与车辆标识间的对应关系,表明该用户驾车来到该目标编码对应的位置区域一次。每次用户驾车来到该位置区域,都会基于当时的停车轨迹形成一个待编码区域,每次得到的待编码区域对应的目标编码都是一致的,从而,可以统计出用户在目标编码对应的位置区域内的停留次数, 以及每次到达的时间。为后续基于该位置统计结果为用户进行针对性的服务推送提供依据。In one embodiment, for example, there may be a need to analyze where the user often goes. In the face of this need, it is assumed that the user travels by car and needs to stop after arriving at a certain place. During the parking process, the moving speed of the vehicle is Relatively low, it is considered to be continuously in the resident state (the state where the speed is lower than the set threshold), so that the above-mentioned area to be encoded can be formed based on the movement track generated during the parking process, and the area to be encoded is encoded to obtain the above-mentioned target code (determination of the target code For the process, refer to the related descriptions in other aforementioned embodiments), so as to record the corresponding relationship between the target code and the vehicle identification in turn, indicating that the user drives to the location area corresponding to the target code once. Every time the user drives to the location area, an area to be encoded will be formed based on the parking trajectory at that time, and the target codes corresponding to the area to be encoded each time are consistent, so the user's position corresponding to the target code can be calculated The number of stops in the area, and the time of each arrival. Provide a basis for subsequent targeted service pushes for users based on the location statistics.
在另一实施例中,方法还包括:获取目标编码对应的区域功能信息;根据区域功能信息,确定车辆是否具有停靠在目标编码对应的位置区域内的权限;若车辆不具有权限,则生成车辆的违停记录。In another embodiment, the method further includes: acquiring the area function information corresponding to the target code; determining whether the vehicle has the authority to park in the location area corresponding to the target code according to the area function information; if the vehicle does not have the authority, generating a vehicle violation record.
在一种实施方式中,可以根据目标编码所对应的位置区域的位置和范围,获得其对应的区域功能信息,比如停车场、客运站,等等。该区域功能信息可以是交通管理机构预先标注的。In one embodiment, according to the location and range of the location area corresponding to the target code, the corresponding area function information, such as parking lot, passenger station, and so on, can be obtained. The area function information may be pre-marked by the traffic management agency.
举例来说,假设目标编码对应的位置区域的功能为:客运站。但是,如果进入该区域的用户的车辆是没有运营许可证的,那么意味着该车辆没有进入该位置区域停靠的权限,可以认为该车辆为“黑车”,生成该车辆的违停记录,该违停记录中包括车辆标识、目标编码以及进入时间等信息。其中,可以通过查询许可证颁发数据库来查询确定上述用户车辆是否具有停靠客运站的权限。For example, assume that the function of the location area corresponding to the target code is: passenger station. However, if the vehicle of the user entering the area does not have an operating permit, it means that the vehicle does not have the authority to enter the location area and park. The parking record includes information such as vehicle identification, target code, and entry time. Wherein, it may be determined by querying the license issuing database whether the user's vehicle has the authority to park at the passenger station.
以下将详细描述本申请的一个或多个实施例的区域编码装置。本领域技术人员可以理解,这些装置均可使用市售的硬件组件通过本方案所教导的步骤进行配置来构成。The area coding device of one or more embodiments of the present application will be described in detail below. Those skilled in the art can understand that these devices can be configured by using commercially available hardware components through the steps taught in this solution.
图6为本申请实施例提供的一种区域编码装置的结构示意图,如图6所示,该装置包括:获取模块11、计算模块12、压缩模块13、发送模块14。FIG. 6 is a schematic structural diagram of a region coding device provided by an embodiment of the present application. As shown in FIG.
获取模块11用于获取待编码区域的位置范围。The obtaining module 11 is used to obtain the location range of the region to be coded.
第一编码模块12用于确定覆盖位置范围的多个网格,确定多个网格的最近公共祖先网格的第一编码,多个网格是通过第一空间网格编码算法得到的。The first encoding module 12 is configured to determine a plurality of grids covering a location range, and determine a first encoding of a nearest common ancestor grid of the plurality of grids, and the plurality of grids are obtained through a first spatial grid encoding algorithm.
第二编码模块13用于根据多个网格的各边界坐标,通过第二空间网格编码算法确定多个网格对应的多个第二编码,确定多个第二编码的公共前缀编码,其中,多个第二编码分别对应于多个网格的各边界坐标。The second coding module 13 is used to determine multiple second codes corresponding to multiple grids through the second spatial grid coding algorithm according to the boundary coordinates of multiple grids, and determine the common prefix codes of multiple second codes, wherein , the plurality of second codes respectively correspond to the boundary coordinates of the plurality of grids.
确定模块14用于根据第一编码和公共前缀编码,确定待编码区域的目标编码。The determination module 14 is configured to determine the target code of the area to be coded according to the first code and the common prefix code.
在一种实施方式中,第一编码模块12具体用于:对多个网格的编码进行异或处理,得到异或结果;根据异或结果的位数长度确定多个网格的编码的公共序列长度;根据公共序列长度,确定多个网格的最近公共祖先网格的第一编码。In one embodiment, the first encoding module 12 is specifically configured to: perform XOR processing on the codes of multiple grids to obtain an XOR result; determine the common value of the codes of multiple grids according to the bit length of the XOR results. Sequence length; according to the common sequence length, determine the first encoding of the nearest common ancestor grid of the plurality of grids.
在一种实施方式中,多个第二编码的编码长度为目标编码长度,目标编码长度是预设值,或者,根据如下方式确定目标编码长度:获取第二空间网格编码算法下,不同编码长度对应的覆盖范围;根据待编码区域的位置范围以及不同编码长度对应的覆盖范围,确定与待编码区域的位置范围相匹配的目标编码长度。In one embodiment, the encoding lengths of multiple second encodings are the target encoding lengths, and the target encoding lengths are preset values, or the target encoding lengths are determined according to the following method: obtaining the different encoding lengths under the second space grid encoding algorithm The coverage corresponding to the length; according to the location range of the region to be encoded and the coverage corresponding to different encoding lengths, determine the target encoding length matching the location range of the area to be encoded.
在一种实施方式中,第一编码模块12具体用于:从第一空间网格编码算法提供的多种不同网格精度等级中确定与待编码区域的位置范围匹配的目标网格精度等级;将目标网格精度等级以及网格数量输入预设的网格筛选算法中,以通过网格筛选算法输出多个第二网格。In one embodiment, the first encoding module 12 is specifically configured to: determine a target grid accuracy level that matches the location range of the area to be encoded from a variety of different grid accuracy levels provided by the first spatial grid encoding algorithm; Input the target grid accuracy level and the number of grids into the preset grid screening algorithm, so as to output a plurality of second grids through the grid screening algorithm.
在一种实施方式中,确定模块14具体用于:若公共前缀编码对应的覆盖范围小于第一编码对应的覆盖范围,则确定待编码区域的目标编码为第一编码和公共前缀编码的拼接结果;若公共前缀编码对应的覆盖范围大于第一编码对应的覆盖范围,则确定待编码区域 的目标编码为第一编码。In one embodiment, the determining module 14 is specifically configured to: if the coverage area corresponding to the common prefix code is smaller than the coverage area corresponding to the first code, determine that the target code of the area to be coded is the splicing result of the first code and the public prefix code ; If the coverage area corresponding to the common prefix code is larger than the coverage area corresponding to the first code, determine that the target code of the area to be coded is the first code.
在一种实施方式中,获取模块11具体用于:获取车辆连续发送的位置信息;若根据位置信息确定车辆在超过设定时长内均处于低速移动状态,则根据设定时长内收到的位置信息确定待编码区域的位置范围。In one embodiment, the acquiring module 11 is specifically used to: acquire the location information continuously sent by the vehicle; The information determines the location range of the region to be coded.
在一种实施方式中,区域编码装置还包括:统计模块,用于记录目标编码与车辆的驻留信息之间的对应关系,驻留信息中包括车辆的标识以及车辆的驻留次数。In one embodiment, the area coding device further includes: a statistics module, configured to record the correspondence between the target code and the parking information of the vehicle, where the parking information includes the identification of the vehicle and the number of parking times of the vehicle.
图6所示的装置可以执行前述实施例中提供的步骤,详细的执行过程和技术效果参见前述实施例中的描述,在此不再赘述。The device shown in FIG. 6 can execute the steps provided in the foregoing embodiments. For the detailed execution process and technical effects, refer to the descriptions in the foregoing embodiments, and details are not repeated here.
在一个可能的设计中,上述图6所示区域编码装置的结构可实现为一电子设备。如图7所示,该电子设备可以包括:处理器21、存储器22、通信接口23。其中,存储器22上存储有可执行代码,当可执行代码被处理器21执行时,使处理器21至少可以实现如前述实施例中提供的区域编码方法。In a possible design, the structure of the region encoding device shown in FIG. 6 above can 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, executable codes are stored in the memory 22, and when the executable codes are executed by the processor 21, the processor 21 can at least implement the region encoding method provided in the foregoing embodiments.
另外,本申请实施例提供了一种非暂时性机器可读存储介质,所述非暂时性机器可读存储介质上存储有可执行代码,当所述可执行代码被电子设备的处理器执行时,使所述处理器至少可以实现如前述实施例中提供的区域编码方法。In addition, the embodiment of the present application provides a non-transitory machine-readable storage medium, the non-transitory machine-readable storage medium stores executable code, when the executable code is executed by the processor of the electronic device , so that the processor can at least implement the region coding method provided in the foregoing embodiments.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的网元可以是或者也可以不是物理上分开的。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only illustrative, and the network elements described as separate components may or may not be physically separated. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without any creative efforts.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助加必需的通用硬件平台的方式来实现,当然也可以通过硬件和软件结合的方式来实现。基于这样的理解,上述技术方案本质上或者说对相关技术做出贡献的部分可以以计算机产品的形式体现出来,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of a general hardware platform plus necessary, and of course can also be implemented by a combination of hardware and software. Based on such an understanding, the above-mentioned technical solution can be embodied in the form of a computer product in essence or the part that contributes to the related technology, and this application can adopt one or more computer-usable storage media containing computer-usable program codes. (including but not limited to disk storage, CD-ROM, optical storage, etc.) in the form of a computer program product.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than limiting them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent replacements are made to some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (14)

  1. 一种区域编码方法,包括:A region coding method, comprising:
    获取待编码区域的位置范围;Obtain the location range of the area to be encoded;
    确定覆盖所述位置范围的多个网格,所述多个网格是通过第一空间网格编码算法得到的;determining a plurality of grids covering the range of locations, the plurality of grids obtained by a first spatial grid coding algorithm;
    确定所述多个网格的最近公共祖先网格的第一编码;determining a first encoding of a nearest common ancestor mesh of the plurality of meshes;
    根据所述多个网格的各边界坐标,通过第二空间网格编码算法确定所述多个网格对应的多个第二编码,其中,所述多个第二编码分别对应于所述多个网格的各边界坐标;According to the boundary coordinates of the plurality of grids, a plurality of second codes corresponding to the plurality of grids are determined through a second spatial grid encoding algorithm, wherein the plurality of second codes correspond to the plurality of grids respectively. The boundary coordinates of each grid;
    根据所述第一编码和所述多个第二编码,确定所述待编码区域的目标编码。Determine a target code of the region to be coded according to the first code and the plurality of second codes.
  2. 根据权利要求1所述的方法,其中,所述根据所述第一编码和所述多个第二编码,确定所述待编码区域的目标编码,包括:The method according to claim 1, wherein said determining the target code of the region to be coded according to the first code and the plurality of second codes comprises:
    确定所述多个第二编码的公共前缀编码;determining a common prefix code of the plurality of second codes;
    根据所述第一编码和所述公共前缀编码,确定所述待编码区域的目标编码。Determine the target code of the region to be coded according to the first code and the common prefix code.
  3. 根据权利要求1所述的方法,其中,所述确定所述多个网格的最近公共祖先网格的第一编码,包括:The method according to claim 1, wherein said determining the first encoding of the nearest common ancestor grid of said plurality of grids comprises:
    对所述多个网格的编码进行异或处理,得到异或结果;Exclusive OR processing is performed on the codes of the plurality of grids to obtain an exclusive OR result;
    根据所述异或结果的位数长度确定所述多个网格的编码的公共序列长度;determining the common sequence length of the coding of the plurality of grids according to the bit length of the XOR result;
    根据所述公共序列长度,确定所述多个网格的最近公共祖先网格的第一编码。A first encoding of a nearest common ancestor grid of the plurality of grids is determined based on the common sequence length.
  4. 根据权利要求1所述的方法,其中,所述多个第二编码的编码长度为目标编码长度,所述目标编码长度是预设值,或者,根据如下方式确定所述目标编码长度:The method according to claim 1, wherein the code lengths of the plurality of second codes are target code lengths, and the target code length is a preset value, or the target code length is determined according to the following manner:
    获取所述第二空间网格编码算法下,不同编码长度对应的覆盖范围;Acquiring coverages corresponding to different coding lengths under the second spatial grid coding algorithm;
    根据所述待编码区域的位置范围以及所述不同编码长度对应的覆盖范围,确定与所述待编码区域的位置范围相匹配的目标编码长度。According to the location range of the region to be coded and the coverage ranges corresponding to the different code lengths, determine a target code length matching the location range of the region to be coded.
  5. 根据权利要求1所述的方法,其中,所述确定覆盖所述位置范围的多个网格,包括:The method of claim 1, wherein said determining a plurality of grids covering said range of locations comprises:
    从所述第一空间网格编码算法提供的多种不同网格精度等级中确定与所述待编码区域的位置范围匹配的目标网格精度等级;determining a target grid precision level that matches the location range of the region to be encoded from a plurality of different grid precision levels provided by the first spatial grid coding algorithm;
    将所述目标网格精度等级以及网格数量输入预设的网格筛选算法中,以通过所述网格筛选算法输出所述多个第二网格。The target mesh accuracy level and the number of meshes are input into a preset mesh screening algorithm, so as to output the plurality of second meshes through the mesh screening algorithm.
  6. 根据权利要求2所述的方法,其中,所述根据所述第一编码和所述公共前缀编码,确定所述待编码区域的目标编码,包括:The method according to claim 2, wherein said determining the target code of the region to be coded according to the first code and the common prefix code comprises:
    若所述公共前缀编码对应的覆盖范围小于所述第一编码对应的覆盖范围,则确定所述待编码区域的目标编码为所述第一编码和所述公共前缀编码的拼接结果;If the coverage corresponding to the common prefix code is smaller than the coverage corresponding to the first code, then determine that the target code of the area to be coded is the splicing result of the first code and the public prefix code;
    若所述公共前缀编码对应的覆盖范围大于所述第一编码对应的覆盖范围,则确定所述待编码区域的目标编码为所述第一编码。If the coverage corresponding to the common prefix code is larger than the coverage corresponding to the first code, determine that the target code of the area to be coded is the first code.
  7. 根据权利要求1至6中任一项所述的方法,其中,所述获取待编码区域的位置范围,包括:The method according to any one of claims 1 to 6, wherein said obtaining the location range of the region to be coded comprises:
    获取车辆连续发送的位置信息;Obtain the location information continuously sent by the vehicle;
    若根据所述位置信息确定所述车辆在超过设定时长内均处于低速移动状态,则根据所述设定时长内收到的位置信息确定所述待编码区域的位置范围。If it is determined according to the position information that the vehicle is moving at a low speed within a set time period, the position range of the area to be encoded is determined according to the position information received within the set time period.
  8. 根据权利要求7所述的方法,其中,所述方法还包括:The method according to claim 7, wherein the method further comprises:
    记录所述目标编码与所述车辆的驻留信息之间的对应关系,所述驻留信息中包括所述车辆的标识以及所述车辆的驻留次数。Recording the correspondence between the target code and the resident information of the vehicle, where the resident information includes the identification of the vehicle and the resident times of the vehicle.
  9. 一种区域编码装置,包括:A region coding device, comprising:
    获取模块,用于获取待编码区域的位置范围;An acquisition module, configured to acquire the location range of the area to be encoded;
    第一编码模块,用于确定覆盖所述位置范围的多个网格,确定所述多个网格的最近公共祖先网格的第一编码,所述多个网格是通过第一空间网格编码算法得到的;A first encoding module, configured to determine a plurality of grids covering the location range, determine a first encoding of a nearest common ancestor grid of the plurality of grids, the plurality of grids are passed through the first spatial grid obtained by the encoding algorithm;
    第二编码模块,用于根据所述多个网格的各边界坐标,通过第二空间网格编码算法确定所述多个网格对应的多个第二编码,确定所述多个第二编码的公共前缀编码,其中,所述多个第二编码分别对应于所述多个网格的各边界坐标;The second encoding module is configured to determine a plurality of second encodings corresponding to the plurality of grids through a second spatial grid encoding algorithm according to the boundary coordinates of the plurality of grids, and determine the plurality of second encodings A public prefix code, wherein the plurality of second codes correspond to the boundary coordinates of the plurality of 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. 一种电子设备,包括:存储器、处理器、通信接口;其中,所述存储器上存储有可执行代码,当所述可执行代码被所述处理器执行时,使所述处理器执行如权利要求1至8中任一项所述的区域编码方法。An electronic device, comprising: a memory, a processor, and a communication interface; wherein, executable code is stored on the memory, and when the executable code is executed by the processor, the processor is made to execute the The area coding method described in any one of 1 to 8.
  11. 一种非暂时性机器可读存储介质,其中,所述非暂时性机器可读存储介质上存储有可执行代码,当所述可执行代码被电子设备的处理器执行时,使所述处理器执行如权利要求1至8中任一项所述的区域编码方法。A non-transitory machine-readable storage medium, wherein executable code is stored on the non-transitory machine-readable storage medium, and when the executable code is executed by a processor of an electronic device, the processor Executing the region coding method as described in any one of claims 1 to 8.
  12. 一种区域编码方法,包括:A region coding method, comprising:
    根据车辆在设定时长内连续对应于驻留状态的位置信息,确定待编码区域的位置范围;Determine the location range of the area to be encoded according to the location information of the vehicle that continuously corresponds to the parking state within the set duration;
    确定覆盖所述位置范围的多个网格,所述多个网格是通过第一空间网格编码算法得到的;determining a plurality of grids covering the range of locations, the plurality of grids obtained by a first spatial grid coding algorithm;
    确定所述多个网格的最近公共祖先网格的第一编码;determining a first encoding of a nearest common ancestor mesh of the plurality of meshes;
    根据所述多个网格的各边界坐标,通过第二空间网格编码算法确定所述多个网格对应的多个第二编码,其中,所述多个第二编码分别对应于所述多个网格的各边界坐标;According to the boundary coordinates of the plurality of grids, a plurality of second codes corresponding to the plurality of grids are determined through a second spatial grid encoding algorithm, wherein the plurality of second codes correspond to the plurality of grids respectively. The boundary coordinates of each grid;
    根据所述第一编码和所述多个第二编码,确定所述待编码区域的目标编码;determining a target code of the region to be coded according to the first code and the plurality of second codes;
    存储所述目标编码与所述车辆的车辆标识之间的对应关系。The corresponding relationship between the target code and the vehicle identification of the vehicle is stored.
  13. 根据权利要求12所述的方法,其中,所述方法还包括:The method according to claim 12, wherein said method further comprises:
    根据所述存储结果,确定所述车辆在所述目标编码对应的位置区域内的停留次数。According to the storage result, determine the number of stays of the vehicle in the location area corresponding to the target code.
  14. 根据权利要求12所述的方法,其中,所述方法还包括:The method according to claim 12, wherein said method further comprises:
    获取所述目标编码对应的区域功能信息;Acquiring regional function information corresponding to the target code;
    根据所述区域功能信息,确定所述车辆是否具有停靠在所述目标编码对应的位置区域内的权限;According to the area function information, determine whether the vehicle has the authority to park in the location area corresponding to the target code;
    若所述车辆不具有所述权限,则生成所述车辆的违停记录。If the vehicle does not have the authority, a parking violation record of the vehicle is generated.
PCT/CN2022/127510 2021-12-29 2022-10-26 Region coding method and apparatus, device and storage medium WO2023124470A1 (en)

Applications Claiming Priority (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
CN202111644026.6 2021-12-29

Publications (1)

Publication Number Publication Date
WO2023124470A1 true WO2023124470A1 (en) 2023-07-06

Family

ID=81017513

Family Applications (1)

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

Country Status (2)

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

Families Citing this family (1)

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

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140040215A1 (en) * 2011-04-12 2014-02-06 Thomson Licensing Method for encoding a mesh model, encoded mesh model and method for decoding a mesh model
CN110909093A (en) * 2019-10-11 2020-03-24 中国人民解放军战略支援部队信息工程大学 Method and device for constructing intelligent landmark control network
CN111475597A (en) * 2020-03-31 2020-07-31 中国人民解放军战略支援部队信息工程大学 Non-rigid grid coding, spatial object unique identification and query method and device
CN113536188A (en) * 2021-09-16 2021-10-22 统信软件技术有限公司 Data storage method, data query method, computing device and storage medium
CN113806456A (en) * 2020-06-16 2021-12-17 华为技术有限公司 Mesh coding method and device
CN114328788A (en) * 2021-12-29 2022-04-12 阿里云计算有限公司 Region coding method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140040215A1 (en) * 2011-04-12 2014-02-06 Thomson Licensing Method for encoding a mesh model, encoded mesh model and method for decoding a mesh model
CN110909093A (en) * 2019-10-11 2020-03-24 中国人民解放军战略支援部队信息工程大学 Method and device for constructing intelligent landmark control network
CN111475597A (en) * 2020-03-31 2020-07-31 中国人民解放军战略支援部队信息工程大学 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

Also Published As

Publication number Publication date
CN114328788A (en) 2022-04-12

Similar Documents

Publication Publication Date Title
WO2016095749A1 (en) Method and device for querying spatial object and establishing spatial index of electronic map
JP2004164596A (en) Method and system for traversing n-dimensional bi-tree
CN105160706B (en) Landform parallel constructing method is constrained under a kind of unit multi-core environment
WO2023124470A1 (en) Region coding method and apparatus, device and storage medium
CN116860905B (en) Space unit coding generation method of city information model
US10003946B2 (en) Enhanced spatial index for point in polygon operations
CN110134755A (en) Map updating method, device, equipment, server and medium
CN114238384B (en) Area positioning method, device, equipment and storage medium
CN109992640A (en) Determination method and device, equipment and the storage medium of position grid
CN112486987A (en) City inquiry method, device, equipment and storage medium based on longitude and latitude
CN114357313A (en) Data processing method and device
CN116036604A (en) Data processing method, device, computer and readable storage medium
CN115809360B (en) Real-time space connection query method for large-scale space-time data and related equipment
CN113722415B (en) Point cloud data processing method and device, electronic equipment and storage medium
CN111506576B (en) Land block coding method and device based on regional quadtree
US6850638B1 (en) System for naming faces and vertices in an adaptive hierarchical subdivision surface
CN113722317A (en) Storage method and device of space object and electronic equipment
CN113849495A (en) Point cloud dynamic hash partitioning method and device
CN114116925A (en) Spatio-temporal data query method and related device
CN114491307B (en) Equipment aggregation method and device
CN111090712B (en) Data processing method, device, equipment and computer storage medium
KR20200068901A (en) Method and apparatus for encoding map image based on condition
CN113157843B (en) Geographic spatial data management method based on spatial gridding index
CN114840629B (en) Resident position correction method and device, electronic equipment and readable storage medium
CN116450892A (en) Road network spatial index construction method based on learning index

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22913733

Country of ref document: EP

Kind code of ref document: A1