CN116776010A - Query method, device, equipment and storage medium for target position user - Google Patents
Query method, device, equipment and storage medium for target position user Download PDFInfo
- Publication number
- CN116776010A CN116776010A CN202310007475.2A CN202310007475A CN116776010A CN 116776010 A CN116776010 A CN 116776010A CN 202310007475 A CN202310007475 A CN 202310007475A CN 116776010 A CN116776010 A CN 116776010A
- Authority
- CN
- China
- Prior art keywords
- user
- grid
- location
- target area
- users
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9537—Spatial or temporal dependent retrieval, e.g. spatiotemporal queries
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/29—Geographical information databases
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Remote Sensing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请实施例公开了一种目标位置用户的查询方法、装置、设备及存储介质,其中,查询方法包括:获取待查询的目标区域范围;将所述目标区域范围通过S2网格覆盖算法转换为多段一维取值区间;从预设的网格数据库中查找位置编码满足所述多段一维取值区间的候选用户集;所述网格数据库中存储有多个用户的标识以及与每一所述用户关联的位置编码;利用所述目标区域范围对所述候选用户集进行筛选,确定出位于所述目标区域范围内的目标用户。通过对用户位置统一编码处理,将目标区域范围转换为多段一维取值区间,无需根据查询区域不同调整用户位置存储逻辑,可以针对任意查询区域进行区间值一维查找,极大改善了处理效率。
The embodiment of the present application discloses a query method, device, equipment and storage medium for target location users. The query method includes: obtaining the target area range to be queried; converting the target area range into Multiple one-dimensional value intervals; search for candidate user sets whose location codes satisfy the multiple one-dimensional value intervals from a preset grid database; the grid database stores multiple user identifiers and information about each user The location code associated with the user is used; the candidate user set is filtered using the target area range to determine the target user located within the target area range. By uniformly encoding the user location, the target area range is converted into multiple one-dimensional value intervals. There is no need to adjust the user location storage logic according to different query areas. One-dimensional search of interval values can be performed for any query area, which greatly improves the processing efficiency. .
Description
技术领域Technical Field
本申请涉及但不限于大数据处理技术领域,尤其涉及一种目标位置用户的查询方法、装置、设备及存储介质。The present application relates to, but is not limited to, the field of big data processing technology, and in particular to a method, device, equipment and storage medium for querying users at a target location.
背景技术Background Art
在LBS(Location-Based Service,基于位置的服务)中,通常系统要处理大量用户的位置,并且用户的位置还处于动态更新的状态。根据位置范围查找目标位置用户作为一个常见需求,由于用户位置的变化、区域范围的不确定性,在海量用户基础下,如何高效检索出目标结果成为棘手的难题。运营商的位置信令大数据就面临这样的挑战。In LBS (Location-Based Service), the system usually has to process the locations of a large number of users, and the user locations are also in a state of dynamic update. Finding the target location user according to the location range is a common demand. Due to the changes in user locations and the uncertainty of the area range, how to efficiently retrieve the target results under the massive user base has become a difficult problem. The operator's location signaling big data faces such a challenge.
现有的Google S2网格编码进行范围查找的技术存在以下缺点:采用Level-15和Level-22两级遍历,在网格数较多时,效率低下;以时间+网格为键(key),以用户集为值(value)的K-V结构无法增量更新用户的位置,每个时间片需要全量记录全部用户位置。The existing Google S2 grid coding range search technology has the following disadvantages: it uses Level-15 and Level-22 two-level traversal, which is inefficient when the number of grids is large; the K-V structure with time + grid as the key and user set as the value cannot incrementally update the user's location, and all user locations need to be fully recorded in each time slice.
发明内容Summary of the invention
有鉴于此,本申请实施例提供一种目标位置用户的查询方法、装置、设备及存储介质,至少解决了由于用户位置的变化、区域范围的不确定性,在海量用户中查找目标区域范围内的用户效率低下的问题。In view of this, the embodiments of the present application provide a method, device, equipment and storage medium for querying users at a target location, which at least solves the problem of inefficiency in searching for users within a target area among a large number of users due to changes in user locations and uncertainty in area ranges.
本申请实施例的技术方案是这样实现的:The technical solution of the embodiment of the present application is implemented as follows:
第一方面,本申请实施例提供一种目标位置用户的查询方法,所述方法包括:In a first aspect, an embodiment of the present application provides a method for querying a user at a target location, the method comprising:
获取待查询的目标区域范围;将所述目标区域范围通过S2网格覆盖算法转换为多段一维取值区间;从预设的网格数据库中查找位置编码满足所述多段一维取值区间的候选用户集;所述网格数据库中存储有多个用户的标识以及与每一所述用户关联的位置编码;利用所述目标区域范围对所述候选用户集进行筛选,确定出位于所述目标区域范围内的目标用户。Obtain the target area range to be queried; convert the target area range into multiple one-dimensional value intervals through the S2 grid coverage algorithm; search for a candidate user set whose position codes satisfy the multiple one-dimensional value intervals from a preset grid database; the grid database stores identifiers of multiple users and position codes associated with each of the users; use the target area range to screen the candidate user set and determine the target users within the target area range.
在一些实施方式中,所述将所述目标区域范围的范围通过S2网格覆盖算法转换为多段一维取值区间,包括:利用所述S2网格覆盖算法确定所述目标区域范围所覆盖的N个网格;其中,N小于或等于预设的最大网格数,每一所述网格的级别在预设的最小级别至最大级别之间;将每一所述网格的S2网格编码转换为一维的取值区间;对所述N个网格中相邻网格的所述取值区间进行首尾相连,得到合并后的M段一维取值区间;其中M为小于N的自然数。In some embodiments, the range of the target area is converted into multiple one-dimensional value intervals through the S2 grid coverage algorithm, including: using the S2 grid coverage algorithm to determine the N grids covered by the target area; wherein N is less than or equal to a preset maximum number of grids, and the level of each of the grids is between a preset minimum level and a maximum level; converting the S2 grid code of each of the grids into a one-dimensional value interval; connecting the value intervals of adjacent grids in the N grids end to end to obtain a merged M one-dimensional value interval; wherein M is a natural number less than N.
在一些实施方式中,所述方法还包括:利用S2地理位置编码体系对每一所述用户的二维坐标进行编码,得到相应所述用户的位置编码;将每一所述用户的标识为键,且相应所述用户的位置编码为值存储在所述网格数据库。In some embodiments, the method further includes: using the S2 geographic location coding system to encode the two-dimensional coordinates of each of the users to obtain the location code of the corresponding user; using the identifier of each of the users as a key and the location code of the corresponding user as a value and storing it in the grid database.
在一些实施方式中,所述位置编码为第一级网格精度,所述网格数据库为Redis的有序集合结构,所述有序集合结构的值为双精度浮点类型,所述方法还包括:针对每一所述用户,将所述第一级网格精度的位置编码转换为,与所述双精度浮点类型匹配的第二级网格精度的位置编码;以所述第二级网格精度的位置编码作为与相应所述用户关联的值存入所述有序集合结构;其中,所述第二级网格精度对应的网格为所述第一级网格精度对应网格的父网格。In some embodiments, the position code is a first-level grid precision, the grid database is an ordered set structure of Redis, and the value of the ordered set structure is a double-precision floating point type. The method also includes: for each of the users, converting the position code of the first-level grid precision into a position code of the second-level grid precision matching the double-precision floating point type; storing the position code of the second-level grid precision in the ordered set structure as a value associated with the corresponding user; wherein the grid corresponding to the second-level grid precision is the parent grid of the grid corresponding to the first-level grid precision.
在一些实施方式中,所述方法还包括:响应于第一用户的二维坐标更新,对更新后的所述二维坐标进行编码,得到新的位置编码;利用所述新的位置编码更新所述网格数据库中与所述第一用户关联的值。In some implementations, the method further includes: in response to the first user's two-dimensional coordinate update, encoding the updated two-dimensional coordinate to obtain a new position code; and updating the value associated with the first user in the grid database using the new position code.
在一些实施方式中,所述从设定的网格数据库中查找位置编码满足所述多段一维取值区间的候选用户集,包括:针对每一段所述一维取值区间,从所述网格数据库中查找位置编码属于相应所述一维取值区间内的用户,得到查询结果;所述查询结果包括所述用户的标识及关联的位置编码;对所述多段一维取值区间的查询结果进行合并,得到所述候选用户集。In some embodiments, searching from a set grid database for a set of candidate users whose position codes satisfy the multiple one-dimensional value intervals includes: for each one-dimensional value interval, searching from the grid database for users whose position codes belong to the corresponding one-dimensional value interval to obtain a query result; the query result includes an identifier of the user and an associated position code; and merging the query results of the multiple one-dimensional value intervals to obtain the candidate user set.
在一些实施方式中,所述利用所述目标区域范围对所述候选用户集进行筛选,确定出位于所述目标区域范围内的目标用户,包括:针对所述候选用户集中每一候选用户,在所述目标区域范围的边界完整包含相应所述候选用户所在位置所属的最小网格的情况下,确定相应所述候选用户为所述目标用户。In some implementations, the using the target area range to screen the candidate user set to determine the target user within the target area range includes: for each candidate user in the candidate user set, when the boundary of the target area range completely includes the minimum grid to which the location of the corresponding candidate user belongs, determining the corresponding candidate user as the target user.
第二方面,本申请实施例提供一种目标位置用户的查询装置,所述装置包括:In a second aspect, an embodiment of the present application provides a device for querying a user at a target location, the device comprising:
获取模块,用于获取待查询的目标区域范围;An acquisition module is used to obtain the target area range to be queried;
转换模块,用于将所述目标区域范围通过S2网格覆盖算法转换为多段一维取值区间;A conversion module, used to convert the target area range into multiple one-dimensional value intervals through an S2 grid coverage algorithm;
查找模块,用于从预设的网格数据库中查找位置编码满足所述多段一维取值区间的候选用户集;所述网格数据库中存储有多个用户的标识以及与每一所述用户关联的位置编码;A search module, used to search for a set of candidate users whose position codes satisfy the multiple one-dimensional value intervals from a preset grid database; the grid database stores multiple user identifiers and position codes associated with each of the users;
筛选模块,用于利用所述目标区域范围对所述候选用户集进行筛选,确定出位于所述目标区域范围内的目标用户。The screening module is used to screen the candidate user set using the target area range to determine the target users within the target area range.
第三方面,本申请实施例提供一种计算机设备,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述方法中的部分或全部步骤。In a third aspect, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program that can be executed on the processor, and when the processor executes the program, some or all of the steps in the above method are implemented.
第四方面,本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述方法中的部分或全部步骤。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements some or all of the steps in the above method when executed by a processor.
本申请实施例至少具有以下技术效果:The embodiments of the present application have at least the following technical effects:
本申请实施例中,利用S2网格覆盖算法将待查询的目标区域范围处理为网格下的多段一维取值区间,同时将用户的标识及位置编码关联存储在网格数据库中,以实现使用多段值区间对用户位置进行一维值的范围查找,得到在区域覆盖网格下的用户位置,进而筛选出位于目标区域范围内的目标用户实。这样,通过对用户位置统一编码处理,将目标区域范围转换为多段一维取值区间,无需根据查询区域不同调整用户位置存储逻辑,可以针对任意查询区域进行区间值一维查找,极大改善了处理效率。In the embodiment of the present application, the S2 grid coverage algorithm is used to process the target area range to be queried into multiple one-dimensional value intervals under the grid, and the user's identification and position code are stored in the grid database in association, so as to use the multiple value intervals to perform a one-dimensional value range search on the user position, obtain the user position under the regional coverage grid, and then screen out the target user within the target area. In this way, by uniformly encoding the user position, the target area range is converted into multiple one-dimensional value intervals, and there is no need to adjust the user position storage logic according to different query areas. One-dimensional search of interval values can be performed for any query area, which greatly improves processing efficiency.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开的技术方案。It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of the present disclosure.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本申请的实施例,并与说明书一起用于说明本申请的技术方案。The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.
图1为本申请实施例提供的目标位置用户的查询方法的流程示意图;FIG1 is a schematic diagram of a flow chart of a method for querying a target location user provided by an embodiment of the present application;
图2为本申请实施例提供的目标位置用户的查询方法的流程示意图;FIG2 is a schematic diagram of a flow chart of a method for querying a target location user provided by an embodiment of the present application;
图3为本申请实施例提供的目标位置用户的查询方法的流程示意图;FIG3 is a schematic diagram of a flow chart of a method for querying a target location user provided by an embodiment of the present application;
图4为本申请实施例提供的按区域范围查找位置目标用户的系统框架图;FIG4 is a system framework diagram for searching for a target user by location based on a regional range provided by an embodiment of the present application;
图5A为本申请实施例提供的提供的网格覆盖图形化效果示意图;FIG5A is a schematic diagram of a grid coverage graphical effect provided in an embodiment of the present application;
图5B为本申请实施例提供的提供的网格覆盖图形化效果示意图;FIG5B is a schematic diagram of a grid coverage graphical effect provided in an embodiment of the present application;
图5C为本申请实施例提供的提供的网格覆盖图形化效果示意图;FIG5C is a schematic diagram of a grid coverage graphical effect provided in an embodiment of the present application;
图5D为本申请实施例提供的提供的网格覆盖图形化效果示意图;FIG5D is a schematic diagram of a grid coverage graphical effect provided in an embodiment of the present application;
图6为本申请实施例提供的一种目标位置用户的查询装置的组成结构示意图;FIG6 is a schematic diagram of the structure of a query device for a target location user provided in an embodiment of the present application;
图7为本申请实施例提供的一种计算机设备的硬件实体示意图。FIG. 7 is a schematic diagram of a hardware entity of a computer device provided in an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
为了使本申请的目的、技术方案和优点更加清楚,下面结合附图和实施例对本申请的技术方案进一步详细阐述,所描述的实施例不应视为对本申请的限制,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions of the present application are further elaborated in detail below in conjunction with the drawings and embodiments. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
所涉及的术语“第一/第二/第三”仅仅是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一/第二/第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。The terms "first/second/third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that "first/second/third" can be interchanged with a specific order or sequence where permitted so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本申请的目的,不是旨在限制本申请。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing this application and are not intended to limit this application.
在对本申请实施例进行进一步详细说明之前,先对本申请实施例中涉及的名词和术语进行说明,本申请实施例中涉及的名词和术语适用于如下的解释。Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained first. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
一种相关技术中提到一种网格化处理方式,根据注册用户的密度,动态调整GeoHash的网格大小,将用户关联到网格,筛选网格一致的用户作为附近的目标用户。但是,使用Geo Hash网格编码进行范围查找的技术存在以下缺点:1)需要根据各种维度参数,提前确定好网格精度,在计算时遍历周围的网格,以实现一定范围内的查找;2)适用于从一个种子位置,查找周围一定范围内的相近元素,如“附近的人”的功能,不能针对任意边界的区域范围进行范围查找;3)当用户数过多,分布较广时,网格数和网格下人数均多,遍历网格再遍历网格内用户的效率低下。A related technology mentions a grid processing method, which dynamically adjusts the GeoHash grid size according to the density of registered users, associates users to the grid, and selects users with the same grid as nearby target users. However, the technology of using Geo Hash grid coding for range search has the following disadvantages: 1) It is necessary to determine the grid accuracy in advance according to various dimensional parameters, and traverse the surrounding grids during calculation to achieve a search within a certain range; 2) It is suitable for searching for similar elements within a certain range around a seed position, such as the "nearby people" function, and cannot perform range search for areas with arbitrary boundaries; 3) When the number of users is too large and widely distributed, the number of grids and the number of people under the grids are both large, and traversing the grids and then traversing the users in the grids is inefficient.
另一种相关技术一种使用S2对位置进行编码构建索引进行区域查询的方法,其构建K-V结构,其中key使用时间+Level-15的网格+Level-22的网格作为索引,使用S2区域覆盖算法,针对得到的覆盖网格,分别进行Level-15和Level-25的二级索引进行匹配,进而命中相应网格中的轨迹数据。但是,使用Google S2网格编码进行范围查找的技术存在以下缺点:1)采用Level-15(306米精度)和Level-22;(2米精度)固定级别作为二级索引,所有用户、区域均需要处理为这2个级别进行依次匹配;2)未使用到S2编码在相邻空间下值相近的特性,而是采用Level-15和Level-22两级遍历,在网格数较多时,效率低下;3)以时间+网格为key,以用户集为value的K-V结构无法增量更新用户的位置,每个时间片需要全量记录全部用户位置。Another related technology is a method for using S2 to encode the location to build an index for regional query, which constructs a K-V structure, in which the key uses time + Level-15 grid + Level-22 grid as the index, uses the S2 area coverage algorithm, and matches the Level-15 and Level-25 secondary indexes for the obtained coverage grid, thereby hitting the trajectory data in the corresponding grid. However, the technology of using Google S2 grid coding for range search has the following disadvantages: 1) Level-15 (306-meter accuracy) and Level-22 (2-meter accuracy) fixed levels are used as secondary indexes, and all users and regions need to be processed as these two levels for sequential matching; 2) The characteristic of S2 coding that the values are similar in adjacent spaces is not used, but Level-15 and Level-22 are used for two-level traversal, which is inefficient when the number of grids is large; 3) The K-V structure with time + grid as the key and user set as the value cannot incrementally update the user's location, and all user locations need to be fully recorded in each time slice.
本申请实施例提供一种目标位置用户的查询方法,该方法可以由计算机设备的处理器执行。其中,计算机设备指的可以是服务器、笔记本电脑、平板电脑、台式计算机、智能电视、机顶盒、移动设备(例如移动电话、便携式视频播放器、个人数字助理、专用消息设备、便携式游戏设备)等具备目标位置用户的查询能力的设备。图1为本申请实施例提供的目标位置用户的查询方法的流程示意图,如图1所示,该方法包括如下步骤S110至步骤S140:The embodiment of the present application provides a method for querying users at a target location, which can be executed by a processor of a computer device. The computer device may refer to a server, a laptop, a tablet computer, a desktop computer, a smart TV, a set-top box, a mobile device (such as a mobile phone, a portable video player, a personal digital assistant, a dedicated messaging device, a portable gaming device), and other devices that have the ability to query users at a target location. FIG. 1 is a flow chart of a method for querying users at a target location provided by an embodiment of the present application. As shown in FIG. 1 , the method includes the following steps S110 to S140:
步骤S110,获取待查询的目标区域范围。Step S110, obtaining the target area range to be queried.
这里,本申请实施例旨在通过用户给定一个目标区域范围即地理空间区域作为查询条件,旨在查询出该区域所包含的用户数据。描述地理上任意区域范围最常用的方式为多边形,特别地,圆形也可以采用多边形进行近似。Here, the embodiment of the present application aims to query the user data contained in a target area range, i.e., a geographic space area, by using the user as a query condition. The most common way to describe any geographical area range is a polygon, and in particular, a circle can also be approximated by a polygon.
步骤S120,将所述目标区域范围通过S2网格覆盖算法转换为多段一维取值区间。Step S120: convert the target area range into multiple one-dimensional value intervals through the S2 grid coverage algorithm.
这里,在实施中,将输入的目标区域范围建模为S2Polygon,根据S2提供的区域最优覆盖方法(S2RegionCover)得到S2Polygon覆盖的多个大小不一的网格,然后取每一网格下S2编码的取值区间进行处理得到多段一维取值区间。Here, in the implementation, the input target area range is modeled as S2Polygon, and multiple grids of different sizes covered by S2Polygon are obtained according to the regional optimal coverage method (S2RegionCover) provided by S2. Then, the value interval of S2 code under each grid is processed to obtain multiple one-dimensional value intervals.
需要说明的是,Google S2是基于空间填充曲线实现了对地球表面空间的降维表示。Google S2的网格精度分为30级,并且低一级(更大)的网格总是能正好覆盖4个高一级(更小)的网格,所有网格采用64位定长整数进行表示,一个网格具有固定的一段取值区间,称为最小范围至最大范围(rangeMin~rangeMax),取值区间与同级别的其他网格互不重合,而父一级的网格取值区间与其覆盖的子网格取值区间的并集完全一致。It should be noted that Google S2 achieves a dimensionality reduction representation of the earth's surface space based on space filling curves. The grid accuracy of Google S2 is divided into 30 levels, and a lower level (larger) grid can always cover exactly 4 higher level (smaller) grids. All grids are represented by 64-bit fixed-length integers. A grid has a fixed value range, called the minimum range to the maximum range (rangeMin~rangeMax). The value range does not overlap with other grids of the same level, and the value range of the parent level grid is completely consistent with the union of the value ranges of the sub-grids it covers.
步骤S130,从预设的网格数据库中查找位置编码满足所述多段一维取值区间的候选用户集。Step S130, searching a preset grid database for a set of candidate users whose position codes satisfy the multiple one-dimensional value intervals.
这里,所述网格数据库中存储有多个用户的标识以及与每一所述用户关联的位置编码。即网格数据库具有K-V(键值映射)结构,且支持按值的范围进行查找,返回符合条件的键值对记录,即返回位置编码在指定范围内的用户及其位置编码。Here, the grid database stores multiple user identifiers and location codes associated with each user. That is, the grid database has a K-V (key-value mapping) structure and supports searching by value range, returning key-value pair records that meet the conditions, that is, returning users and their location codes whose location codes are within the specified range.
在实施中,预先将各个用户对应的用户位置例如经纬度坐标统一进行S2编码,得到每一用户一维的位置编码,存储在具有K-V结构的网格数据库中,其中键(key)为用户唯一标识,值(value)为相应用户的位置编码,即S2最高精度的一维表示值。这样便于后续进行按照区域的取值区间进行一维线性查找。In the implementation, the user locations corresponding to each user, such as longitude and latitude coordinates, are uniformly S2-encoded in advance to obtain a one-dimensional location code for each user, which is stored in a grid database with a K-V structure, where the key is the user's unique identifier and the value is the location code of the corresponding user, i.e., the highest precision one-dimensional representation value of S2. This facilitates subsequent one-dimensional linear search according to the value interval of the region.
步骤S140,利用所述目标区域范围对所述候选用户集进行筛选,确定出位于所述目标区域范围内的目标用户。Step S140: screening the candidate user set by using the target area range to determine the target users within the target area range.
这里,由于网格覆盖范围相比实际的目标区域范围有所扩大,因此对网格查找出的候选用户集中每个用户进行筛选,判断网格查询出的用户所在的位置是否位于目标区域范围之内,进而保留目标区域范围包含的用户为目标用户。Here, since the coverage of the grid is larger than the actual target area, each user in the candidate user set found by the grid is screened to determine whether the location of the user found by the grid is within the target area, and then the users included in the target area are retained as target users.
本申请实施例中,利用S2网格覆盖算法将待查询的目标区域范围处理为网格下的多段一维取值区间,同时将用户的标识及位置编码关联存储在网格数据库中,以实现使用多段值区间对用户位置进行一维值的范围查找,得到在区域覆盖网格下的用户位置,进而筛选出位于目标区域范围内的目标用户。这样,通过对用户位置统一编码处理,将目标区域范围转换为多段一维取值区间,无需根据查询区域不同调整用户位置存储逻辑,可以针对任意查询区域进行区间值一维查找,极大改善了处理效率。In the embodiment of the present application, the S2 grid coverage algorithm is used to process the target area range to be queried into multiple one-dimensional value intervals under the grid, and the user's identification and position code are stored in the grid database in association, so as to use the multiple value intervals to perform a one-dimensional value range search on the user position, obtain the user position under the regional coverage grid, and then filter out the target user within the target area. In this way, by uniformly encoding the user position, the target area range is converted into multiple one-dimensional value intervals, and there is no need to adjust the user position storage logic according to different query areas. One-dimensional search of interval values can be performed for any query area, which greatly improves processing efficiency.
在一些实施例中,在所述步骤S130之前所述方法还包括步骤101和步骤102:In some embodiments, before step S130, the method further includes steps 101 and 102:
步骤101,利用S2地理位置编码体系对每一所述用户的二维坐标进行编码,得到相应所述用户的位置编码;Step 101, using the S2 geographic location coding system to encode the two-dimensional coordinates of each user to obtain the location code of the corresponding user;
这里,每个用户的二维坐标即由纬度、经度构成的位置坐标,如用户u1的位置坐标为(31.36529787524528,120.43801146916059),使用Google S2地理位置编码体系,将其转换为S2网格编码,得到其64位整数的编码值,如3869610778954949709(对应十六进制编码为35b39e805aa1e44d)。根据S2的编码规则,此时为Level-30级别的网格,该级别在地球表面定位精度约为9毫米(mm)。即该用户位置的编码精度在9mm。Here, the two-dimensional coordinates of each user are the location coordinates composed of latitude and longitude. For example, the location coordinates of user u1 are (31.36529787524528, 120.43801146916059). Using the Google S2 geographic location coding system, it is converted into the S2 grid code to obtain its 64-bit integer code value, such as 3869610778954949709 (corresponding hexadecimal code is 35b39e805aa1e44d). According to the S2 coding rules, this is a Level-30 grid, and the positioning accuracy of this level on the earth's surface is about 9 millimeters (mm). That is, the coding accuracy of the user's location is 9mm.
步骤102,将每一所述用户的标识为键,且相应所述用户的位置编码为值存储在所述网格数据库。Step 102: The identifier of each user is used as a key, and the position of the corresponding user is encoded as a value and stored in the grid database.
这里,每个用户对应唯一的键,用户的位置可以实时更新,实现增量更新并便于即时反馈查询。Here, each user corresponds to a unique key, and the user's location can be updated in real time, achieving incremental updates and facilitating instant feedback queries.
在一些实施方式中,所述位置编码为第一级网格精度,所述网格数据库为Redis的有序集合结构,所述有序集合结构的值为双精度浮点类型,所述方法还包括:针对每一所述用户,将所述第一级网格精度的位置编码转换为,与所述双精度浮点类型匹配的第二级网格精度的位置编码;以所述第二级网格精度的位置编码作为与相应所述用户关联的值存入所述有序集合结构;其中,所述第二级网格精度对应的网格为所述第一级网格精度对应网格的父网格。In some embodiments, the position code is a first-level grid precision, the grid database is an ordered set structure of Redis, and the value of the ordered set structure is a double-precision floating point type. The method also includes: for each of the users, converting the position code of the first-level grid precision into a position code of the second-level grid precision matching the double-precision floating point type; storing the position code of the second-level grid precision in the ordered set structure as a value associated with the corresponding user; wherein the grid corresponding to the second-level grid precision is the parent grid of the grid corresponding to the first-level grid precision.
这里,根据S2的编码规则,所述第一级网格精度为Level-30级别的网格对应的定位精度即9mm,所述第二级网格精度度为Level-25级别的网格对应的定位精度即30厘米(cm)。其中Redis的有序集合结构(Sorted Set)的K-V分别被称为成员(member)和分值(score)。因其score部分被设计为双精度浮点数类型(double),使用其存储8字节整数时,只能保留52(尾数)+1(符号位)+1(最高位隐藏)=54Bit有效位。因此,根据S2编码规则,以用户唯一标识作为成员,以该用户的Level-25的S2编码作为分值,存入用户集合结构。Here, according to the coding rules of S2, the first-level grid accuracy is the positioning accuracy corresponding to the grid of Level-30, that is, 9mm, and the second-level grid accuracy is the positioning accuracy corresponding to the grid of Level-25, that is, 30 centimeters (cm). The K-V of the ordered set structure (Sorted Set) of Redis is respectively called member and score. Because its score part is designed as a double-precision floating point type (double), when it is used to store 8-byte integers, only 52 (mantissa) + 1 (sign bit) + 1 (highest bit hidden) = 54Bit valid bits can be retained. Therefore, according to the S2 coding rules, the user's unique identifier is used as a member, and the user's Level-25 S2 code is used as the score, which is stored in the user set structure.
在一些实施方式中,在所述步骤102之后,所述方法还包括:响应于第一用户的二维坐标更新,对更新后的所述二维坐标进行编码,得到新的位置编码;利用所述新的位置编码更新所述网格数据库中与所述第一用户关联的值。In some embodiments, after step 102, the method further includes: in response to the update of the two-dimensional coordinates of the first user, encoding the updated two-dimensional coordinates to obtain a new position code; and updating the value associated with the first user in the grid database using the new position code.
上述实施例中,当用户位置刷新时,将新位置的经纬度坐标转换为位置编码后,更新该用户在K-V结构中关联的值。这样,在海量用户中,允许用户位置增量更新,快速实时命中目标。In the above embodiment, when the user's location is refreshed, the latitude and longitude coordinates of the new location are converted into a location code, and the value associated with the user in the K-V structure is updated. In this way, the user's location is incrementally updated among a large number of users, and the target is hit quickly and in real time.
基于图1,图2为本申请实施例提供的目标位置用户的查询方法的流程示意图,如图2所示,上述步骤S120“将所述目标区域范围通过S2网格覆盖算法转换为多段一维取值区间”包括以下步骤S210至步骤S230:Based on FIG. 1 , FIG. 2 is a flow chart of a method for querying a target location user provided in an embodiment of the present application. As shown in FIG. 2 , the above step S120 “converting the target area range into multiple one-dimensional value intervals by using the S2 grid coverage algorithm” includes the following steps S210 to S230:
步骤S210,利用所述S2网格覆盖算法确定所述目标区域范围所覆盖的N个网格。Step S210: using the S2 grid coverage algorithm to determine the N grids covered by the target area.
这里,N小于或等于预设的最大网格数,每一所述网格的级别在预设的最小级别至最大级别之间;Google S2的网格精度分为30级,并且低一级(更大)的网格总是能正好覆盖4个高一级(更小)的网格。Here, N is less than or equal to the preset maximum number of grids, and the level of each grid is between the preset minimum level and the maximum level; the grid accuracy of Google S2 is divided into 30 levels, and a lower level (larger) grid can always cover exactly 4 higher level (smaller) grids.
步骤S220,将每一所述网格的S2网格编码转换为一维的取值区间。Step S220, converting the S2 grid code of each of the grids into a one-dimensional value interval.
这里,所有网格采用64位定长整数进行表示,一个网格具有固定的一段取值区间,称为rangeMin~rangeMax,该网格下S2编码的取值区间。Here, all grids are represented by 64-bit fixed-length integers. A grid has a fixed value range, called rangeMin~rangeMax, which is the value range of the S2 code under the grid.
步骤S230,对所述N个网格中相邻网格的所述取值区间进行首尾相连,得到合并后的M段一维取值区间。Step S230, connecting the value intervals of adjacent grids in the N grids end to end to obtain M merged one-dimensional value intervals.
这里,其中M为小于N的自然数,例如N为8,M为6。合并后的M段一维取值区间与原来N个取值区间所包含的有效值相同。结合S2编码的特点,取值区间的两个端点(即rangeMin和rangeMax)均为30级编码,最后(最右)一个Bit固定为1,所以上述值的范围可以扩展2个无效值,分别为rangeMin-1和rangeMax+1,从而优化后使相邻网格的值区间首尾相连从而减少片段数,便于分段后续检索查询。Here, M is a natural number less than N, for example, N is 8 and M is 6. The merged M segments of one-dimensional value intervals are the same as the valid values contained in the original N value intervals. Combined with the characteristics of S2 coding, the two endpoints of the value interval (i.e., rangeMin and rangeMax) are both 30-level codes, and the last (rightmost) bit is fixed to 1, so the range of the above values can be extended by 2 invalid values, namely rangeMin-1 and rangeMax+1, so that the value intervals of adjacent grids are connected end to end after optimization, thereby reducing the number of fragments and facilitating subsequent segmented retrieval queries.
图3为本申请实施例提供的目标位置用户的查询方法的流程示意图,如图3所示,所述方法包括以下步骤S310至步骤S350:FIG3 is a flow chart of a method for querying a target location user provided by an embodiment of the present application. As shown in FIG3 , the method includes the following steps S310 to S350:
步骤S310,获取待查询的目标区域范围。Step S310, obtaining the target area range to be queried.
步骤S320,将所述目标区域范围通过S2网格覆盖算法转换为多段一维取值区间。Step S320: convert the target area range into multiple one-dimensional value intervals through the S2 grid coverage algorithm.
这里,上述步骤S310至步骤S320分别对应于前述步骤S110至步骤S120,在实施时可以参照前述步骤S110至步骤S120的具体实施方式。Here, the above steps S310 to S320 correspond to the above steps S110 to S120 respectively, and the specific implementation of the above steps S110 to S120 may be referred to during implementation.
步骤S330,针对每一段所述一维取值区间,从所述网格数据库中查找位置编码属于相应所述一维取值区间内的用户,得到查询结果。Step S330: for each one-dimensional value interval, searching the grid database for users whose location codes belong to the corresponding one-dimensional value interval to obtain a query result.
这里,所述查询结果包括所述用户的标识及关联的位置编码。Here, the query result includes the user's identifier and the associated location code.
步骤S340,对所述多段一维取值区间的查询结果进行合并,得到所述候选用户集。Step S340: merging the query results of the multiple one-dimensional value intervals to obtain the candidate user set.
示例地,查找到编码位置满足a1≤x≤b1的用户A及A的实际编码位置L1,查找到满足a2≤x≤b2的用户B及A的实际编码位置L2,以及用户C以及C的实际编码位置L3,从而得到在区域覆盖网格下的候选用户集有{用户A,用户B,用户C}。For example, user A whose coding position satisfies a1≤x≤b1 and A's actual coding position L1 are found, user B and A's actual coding position L2 and user C and C's actual coding position L3 are found, thereby obtaining the candidate user set {user A, user B, user C} under the regional coverage grid.
步骤S350,针对所述候选用户集中每一候选用户,在所述目标区域范围的边界完整包含相应所述候选用户所在位置所属的最小网格的情况下,确定相应所述候选用户为目标用户。Step S350 : for each candidate user in the candidate user set, if the boundary of the target area completely includes the smallest grid to which the location of the corresponding candidate user belongs, determine the corresponding candidate user as a target user.
这里,所述最小网格为Level-30网格,且精度为9mm,也就是说,用户位置对应的最小网格在目标区域范围的边界内时,确定用户位置确实位于目标区域范围内部。Here, the minimum grid is a Level-30 grid, and the accuracy is 9 mm, that is, when the minimum grid corresponding to the user position is within the boundary of the target area, it is determined that the user position is indeed within the target area.
上述实施例中,将目标区域范围处理为多段取值区间,进而从存储的网格数据库中查找满足多段取值区间条件的位置编码,得到在区域覆盖网格下的用户;同时针对网格筛出的候选用户集中的每个用户,判断目标区域范围是否包括用户所在位置所属的最小网格,从而保留位于目标区域范围内的目标用户为最终的查询结果。In the above embodiment, the target area range is processed into multiple value intervals, and then the location codes that meet the conditions of the multiple value intervals are searched from the stored grid database to obtain users under the regional coverage grid; at the same time, for each user in the candidate user set screened out by the grid, it is determined whether the target area range includes the smallest grid to which the user's location belongs, thereby retaining the target users within the target area range as the final query results.
下面结合一个具体实施例对上述目标位置用户的查询方法进行说明,然而值得注意的是,该具体实施例仅是为了更好地说明本申请,并不构成对本申请的不当限定。The query method for the target location user is described below in conjunction with a specific embodiment. However, it should be noted that the specific embodiment is only for better illustrating the present application and does not constitute an improper limitation on the present application.
本申请实施例提出了一种按区域范围查找位置目标用户的系统,如图4所示,所述系统包括用户位置存储模块41、区域范围处理模块42、范围查找用户模块43、位置区域匹配模块44,The embodiment of the present application proposes a system for searching for a target user by location according to an area range. As shown in FIG4 , the system includes a user location storage module 41, an area range processing module 42, a range search user module 43, and a location area matching module 44.
用户位置存储模块41用于利用谷歌S2地理位置编码体系将所有用户的位置坐标转换为S2网格编码,并以键为用户唯一标识,值为所述S2网格编码中最高精度的一维位置编码,存储在数据库中。相比于相关技术中以time_c15_c22作为键,相同网格位置的用户集作为值,本申请实施例将用户位置进行编码,键为用户唯一标识,值为S2最高精度的一维表示值。The user location storage module 41 is used to convert the location coordinates of all users into S2 grid codes using the Google S2 geographic location coding system, and store them in the database with the key being the user's unique identifier and the value being the one-dimensional location code with the highest accuracy in the S2 grid code. Compared with the related art that uses time_c15_c22 as the key and the user set at the same grid location as the value, the embodiment of the present application encodes the user location, with the key being the user's unique identifier and the value being the one-dimensional representation value with the highest accuracy in S2.
每个用户位置的表示为经纬度,即由纬度、经度构成的二维坐标,如用户u1的位置坐标为(31.36529787524528,120.43801146916059),使用Google S2地理位置编码体系,将其转换为S2网格编码,得到其64位整数的编码值,如3869610778954949709(对应十六进制编码为35b39e805aa1e44d)。这个过程采用Java SDK的编码如下:Each user's location is represented as longitude and latitude, that is, a two-dimensional coordinate consisting of latitude and longitude. For example, the location coordinates of user u1 are (31.36529787524528, 120.43801146916059). Using the Google S2 geographic location coding system, it is converted into an S2 grid code to obtain its 64-bit integer code value, such as 3869610778954949709 (the corresponding hexadecimal code is 35b39e805aa1e44d). This process uses the Java SDK coding as follows:
1.S2CellId s2CellId=S2CellId.fromLatLng(1.S2CellId s2CellId=S2CellId.fromLatLng(
S2LatLng.fromDegrees(31.36529787524528,120.43801146916059));2.System.out.println(s2CellId.id());S2LatLng.fromDegrees(31.36529787524528,120.43801146916059)); 2.System.out.println(s2CellId.id());
根据S2的编码规则,此时为第30级(Level-30)级别的网格,该级别在地球表面定位精度约为9mm。将所有用户的位置坐标,做此转换,例如10个用户的数据如下表1:According to the coding rules of S2, this is the Level-30 grid, and the positioning accuracy of this level on the earth's surface is about 9mm. The location coordinates of all users are converted in this way. For example, the data of 10 users are as follows in Table 1:
表1 10个用户的经纬度坐标与对应的位置编码Table 1 The latitude and longitude coordinates of 10 users and their corresponding location codes
选择具有以下特性的数据库对用户及其位置编码进行存储:一方面,具有键值映射结构,即以用户作为键,每个用户对应一个唯一键,以位置编码作为值,与用户进行关联;另一方面,支持按值的范围进行查找,返回符合条件的键值对记录,即返回位置编码在指定范围内的用户及其位置编码。Select a database with the following characteristics to store users and their location codes: on the one hand, it has a key-value mapping structure, that is, the user is used as the key, each user corresponds to a unique key, and the location code is used as the value to associate with the user; on the other hand, it supports searching by value range and returns key-value pair records that meet the conditions, that is, returns users and their location codes whose location codes are within the specified range.
一种满足上述条件的已知的数据库实现为Redis的有序集合(Sorted Set),其K-V分别被称为member(成员)和score(分值)。因其score部分被设计为double(双精度浮点数类型),即使用其存储8字节整数时,只能保留52(尾数)+1(符号位)+1(最高位隐藏)=54Bit有效位,根据S2编码规则,使用54Bit为Level-25级,需要将30级的网格降低精度,转换为其25级的父网格,如30级网格3869610778954949709的25级父网格编码为3869613036593792000(对应十六进制编码为35b3a08e0064c400)。这个过程采用Java SDK的编码如:A known database that meets the above conditions is implemented as a Redis ordered set (Sorted Set), whose K-V is called member and score respectively. Because its score part is designed as double (double-precision floating point type), when it is used to store an 8-byte integer, only 52 (mantissa) + 1 (sign bit) + 1 (highest bit hidden) = 54 bits of valid bits can be retained. According to the S2 encoding rule, 54 bits are used for Level-25. The precision of the 30-level grid needs to be reduced and converted to its 25-level parent grid. For example, the 25-level parent grid of the 30-level grid 3869610778954949709 is encoded as 3869613036593792000 (corresponding hexadecimal encoding is 35b3a08e0064c400). This process uses the Java SDK encoding such as:
1.S2CellId pCellId=s2CellId.parent(25);1.S2CellId pCellId=s2CellId.parent(25);
2.System.out.println(pCellId.id());2.System.out.println(pCellId.id());
根据S2的编码规则,此时为Level-25级别的网格,该级别在地球表面定位精度约为30厘米(cm)。以用户唯一标识作为member,以该用户的Level-25的S2编码作为score,存入用户集合结构,如使用如下ZADD命令“ZADD users3869613036593792000u1”,将用户u1及其位置编码存入Redis名为users的有序集合结构中。According to the S2 encoding rules, this is a Level-25 grid, which has a positioning accuracy of about 30 cm on the earth's surface. The user's unique identifier is used as the member, and the user's Level-25 S2 code is used as the score, which is stored in the user set structure. For example, the following ZADD command "ZADD users3869613036593792000u1" is used to store user u1 and its location code in the ordered set structure named users in Redis.
将所有用户及位置编码(视数据库实现的限制,可能采用了不同的精度)存储到数据库K-V结构中,每个用户存在唯一一条记录。当用户位置刷新时,将新位置的经纬度转换为位置编码后,更新该用户在K-V结构中关联的值。存储后的结构形如下表2:All users and location codes (depending on the limitations of the database implementation, different precisions may be used) are stored in the database K-V structure, and each user has a unique record. When the user's location is refreshed, the longitude and latitude of the new location are converted to the location code, and the value associated with the user in the K-V structure is updated. The structure after storage is as shown in Table 2:
表2数据库K-V结构中存储的用户及位置编码Table 2 User and location codes stored in the database K-V structure
区域范围处理模块42用于将区域范围处理为多段值区间。本申请实施例使用S2网格覆盖区域,得到多个大小不一的网格,取每个网格的rangeMin~rangeMax范围,即该网格下S2编码的取值区间,并进行首尾连接压缩,得到多段一维数值区间。The area range processing module 42 is used to process the area range into multiple value intervals. The embodiment of the present application uses the S2 grid to cover the area, obtains multiple grids of different sizes, takes the rangeMin to rangeMax range of each grid, that is, the value interval of the S2 code under the grid, and performs head-to-tail connection compression to obtain multiple one-dimensional value intervals.
描述地理上任意区域范围最常用的方式为多边形。特别地,圆形也可以采用多边形进行近似。多边形可以采用顶点序列的方式来描述,每个顶点是一个由纬度、经度组成的二维坐标,如一个矩形将其4个顶点按顺时针排列,可以表示为如下序列:(31.365309728100144,120.43889177031652),(31.365309728100144,120.44315111823217),(31.361660168572687,120.44315111823217),(31.361660168572687,120.43889177031652)。The most common way to describe any geographical area is with a polygon. In particular, a circle can also be approximated by a polygon. A polygon can be described by a sequence of vertices, where each vertex is a two-dimensional coordinate consisting of latitude and longitude. For example, a rectangle can be represented by the following sequence if its four vertices are arranged clockwise: (31.365309728100144, 120.43889177031652), (31.365309728100144, 120.44315111823217), (31.361660168572687, 120.44315111823217), (31.361660168572687, 120.43889177031652).
使用S2提供的网格覆盖算法(RegionConverer),输入一个地理多边形,选取合适的最小级别(minLevel)、最大级别(maxLevel)、最大网格(maxCells)参数,输出的结果为覆盖该多边形的S2网格集合,每个网格的级别在最小级别至最大级别之间,网格总个数在最大小区以内。这个过程采用Java SDK的编码如:Use the grid coverage algorithm (RegionConverer) provided by S2, input a geographic polygon, select the appropriate minimum level (minLevel), maximum level (maxLevel), and maximum grid (maxCells) parameters, and the output result is a set of S2 grids covering the polygon. The level of each grid is between the minimum level and the maximum level, and the total number of grids is within the maximum cell. This process uses the Java SDK code such as:
1.S2RegionCoverer s2RegionCoverer=new S2RegionCoverer();1.S2RegionCoverer s2RegionCoverer=new S2RegionCoverer();
2.s2RegionCoverer.setMinLevel(2);2.s2RegionCoverer.setMinLevel(2);
3.s2RegionCoverer.setMaxLevel(20);3.s2RegionCoverer.setMaxLevel(20);
4.s2RegionCoverer.setMaxCells(10);4.s2RegionCoverer.setMaxCells(10);
5.List<S2CellId>s2CellIds=5.List<S2CellId>s2CellIds=
s2RegionCoverer.getInteriorCovering(s2Region).cellIds();s2RegionCoverer.getInteriorCovering(s2Region).cellIds();
6.for(S2CellId s2CellId:s2CellIds)6.for(S2CellId s2CellId:s2CellIds)
7.{System.out.println(s2CellId.id());7.{System.out.println(s2CellId.id());
8.}8.}
图5A至图5D均为本申请实施例提供的网格覆盖图形化效果示意图,其中,图5A示意出了最多使用5个网格进行覆盖时的情况,图5B示意出了最多使用10个网格进行覆盖时的情况,图5C示意出了最多使用20个网格进行覆盖时的情况,图5D示意出了最多使用50个网格进行覆盖时的情况,可以看出最大网格参数(max cells)对覆盖效果的作用,使用更多的网格51将能更细致地贴合多边形52(例如矩形)的边界,使这些网格51的覆盖范围溢出在多边形52外的部分更小。但更多的网格,会使这些网格的取值区间更加片段化离散。Figures 5A to 5D are schematic diagrams of the graphical effect of grid coverage provided by the embodiments of the present application, wherein Figure 5A illustrates the situation when a maximum of 5 grids are used for coverage, Figure 5B illustrates the situation when a maximum of 10 grids are used for coverage, Figure 5C illustrates the situation when a maximum of 20 grids are used for coverage, and Figure 5D illustrates the situation when a maximum of 50 grids are used for coverage. It can be seen that the maximum grid parameter (max cells) has an effect on the coverage effect. Using more grids 51 will be able to fit the boundaries of polygons 52 (such as rectangles) more finely, making the coverage range of these grids 51 overflowing outside the polygon 52 smaller. However, more grids will make the value intervals of these grids more fragmented and discrete.
假定使用10个网格进行覆盖,将每个网格转换为一维的取值区间,即取每个网格对应的rangeMin~rangeMax。这个过程采用Java SDK编码如下:Assume that 10 grids are used for coverage, and each grid is converted into a one-dimensional value interval, that is, the rangeMin to rangeMax corresponding to each grid is taken. This process is coded using the Java SDK as follows:
1.S2CellId rangeMin=s2CellId.rangeMin();1.S2CellId rangeMin=s2CellId.rangeMin();
2.S2CellId rangeMax=s2CellId.rangeMax();2.S2CellId rangeMax=s2CellId.rangeMax();
3.System.out.println(rangeMin.id()+"~"+rangeMax.id());3.System.out.println(rangeMin.id()+"~"+rangeMax.id());
对这10个网格处理得到如下结果如下表3:The following results are obtained by processing these 10 grids as shown in Table 3:
表3 10个网格对应的取值区间信息Table 3 The value interval information corresponding to the 10 grids
结合S2编码的特点,rangeMin和rangeMax均为30级编码,最后(最右)一个位(Bit)固定为1,所以上述值的范围可以扩展2个无效值,分别为rangeMin-1和rangeMax+1,使相邻网格的值范围首尾相连从而减少片段数,但其包含的有效值则完全不变。扩展之后结果如下表4:Combined with the characteristics of S2 coding, rangeMin and rangeMax are both 30-level codes, and the last (rightmost) bit is fixed to 1, so the range of the above value can be extended by 2 invalid values, namely rangeMin-1 and rangeMax+1, so that the value ranges of adjacent grids are connected end to end to reduce the number of fragments, but the valid values they contain remain completely unchanged. The results after expansion are as follows in Table 4:
表4扩展的10个网格对应的取值区间信息Table 4 The value interval information corresponding to the 10 expanded grids
经此优化,取值区间可合并为5段,如下表5所示:After this optimization, the value range can be combined into 5 segments, as shown in Table 5 below:
表5合并后的5段取值区间Table 5 The five value intervals after merging
至此,输入的区域范围被处理为多段取值区间,上述10个网格覆盖的区域范围转换为如下5段取值区间:At this point, the input area range is processed into multiple value intervals. The area range covered by the above 10 grids is converted into the following 5 value intervals:
[3869610766831190016,3869610766965407745] ∪[3869610768307585024,3869610770455068672] ∪[3869610779581874176,3869610781729357824] ∪[3869610782266228736,3869610782803099648] ∪[3869610806425419776,3869610809646645248][3869610766831190016,3869610766965407745] ∪[3869610768307585024,3869610770455068672] ∪[3869610779581874176,386961078172 9357824] ∪[3869610782266228736,3869610782803099648] ∪[3869610806425419776,3869610809646645248]
范围查找用户模块43用于使用多段值区间对用户位置进行一维值的范围查找,形如查找满足a1≤x≤b1或a2≤x≤b2或……或an≤x≤bn条件的x,得到在区域覆盖网格下的用户。The range search user module 43 is used to perform a one-dimensional range search on the user position using multiple value intervals, such as searching for x that satisfies the conditions a1≤x≤b1 or a2≤x≤b2 or ... or an≤x≤bn, to obtain users in the area coverage grid.
根据值范围查找匹配的记录是“用户位置存储模块”所要求支持K-V结构数据库所具备的运算。前述的一种满足要求的数据库实现,即Redis的有序集合结构可以通过zrangeByScore命令,如输入取值区间[3869610779581874176,3869610781729357824],则可通过此命令“ZRANGEBYSCORE users 38696107795818741763869610781729357824WITHSCORES”获取用户及其位置。上述命令对前述10条用户记录匹配的结果为如下表6:Searching for matching records based on the value range is an operation required by the "user location storage module" to support the K-V structure database. The aforementioned database implementation that meets the requirements, that is, the ordered set structure of Redis, can be implemented through the zrangeByScore command. For example, if the value range [3869610779581874176,3869610781729357824] is entered, the user and his location can be obtained through this command "ZRANGEBYSCORE users 38696107795818741763869610781729357824WITHSCORES". The results of the above command matching the above 10 user records are as follows in Table 6:
表6根据1段取值区间查找到的3条匹配记录Table 6 Three matching records found based on 1 value range
对5段取值区间分别查询范围内的用户及其位置,对5个结果取并集,最终在任一取值区间内的用户集合如下表7:The users and their locations within the five value intervals are queried respectively, and the five results are combined. The final set of users within any value interval is as shown in Table 7:
表7所有取值区间查找到的用户集合Table 7 User sets found in all value ranges
位置区域匹配模块44用于对网格筛出的每个用户,判断区域多边界是否包含用户位置,保留包含的用户为处于区域边界内的最终结果。The location area matching module 44 is used to determine whether the area multi-boundary contains the user location for each user screened out by the grid, and retain the contained users as the final result within the area boundary.
由于网格覆盖范围超过了区域真正的范围,根据网格范围查找出来的用户可能处于区域边界以外,此模块需要判断区域多边形是否包含用户所在位置(S2网格),以确认用户位置是否确实位于区域范围内部。当多边形边界完整包含用户位置所在极小网格(Level-30网格精度为9毫米)时,计算结果为真。这个过程采用Java SDK的编码如:Since the grid coverage exceeds the true range of the region, the user found according to the grid range may be outside the region boundary. This module needs to determine whether the region polygon contains the user's location (S2 grid) to confirm whether the user's location is indeed within the region. When the polygon boundary completely contains the tiny grid where the user's location is located (Level-30 grid accuracy is 9 mm), the calculation result is true. This process uses the Java SDK code such as:
1.S2Cell s2Cell=new S2Cell(new S2CellId(3869610806528482041L));1.S2Cell s2Cell=new S2Cell(new S2CellId(3869610806528482041L));
2.//多边形是否完整包含网格2. // Whether the polygon completely contains the grid
3.boolean contained=s2Polygon.contains(s2Cell);3.boolean contained=s2Polygon.contains(s2Cell);
4.System.out.println(contained);4.System.out.println(contained);
对前述5个网格覆盖范围下的用户计算的结果为:The calculation results for users in the coverage areas of the above five grids are:
表7所有取值区间查找到的用户集合Table 7 User sets found in all value ranges
根据结果,求解出位置位于区域范围内的用户,最终结果为:{u6,u7,u9},即u6、u7、u9三个用户位于目标区域下。According to the results, the users whose locations are within the area are solved, and the final result is: {u6,u7,u9}, that is, users u6, u7, and u9 are located in the target area.
由于网格覆盖范围相比实际目标区域有所扩大,本申请实施例对网格筛出的每个用户,判断区域多边界(建模为S2Polygon)是否包含用户位置(建模为S2Cell),保留包含的用户,为处于区域边界内的最终结果,过程中用户位置最高为30级编码,故整体精度最高可达9毫米。Since the grid coverage is larger than the actual target area, the embodiment of the present application determines whether the multi-boundary of the area (modeled as S2Polygon) contains the user location (modeled as S2Cell) for each user screened out by the grid, and retains the included users, which is the final result within the area boundary. In the process, the user position is coded at up to level 30, so the overall accuracy can reach up to 9 mm.
本申请实施例中,一方面用户编码位置固定,与用户密度、用户量、用户分布的面积,均没有关系;另一方面,同一份用户位置数据,不用调整预处理机制,可以支持任意边界的区域范围查找;第三方面,在海量用户中,允许用户位置增量更新,快速实时命中目标。In the embodiments of the present application, on the one hand, the user coding position is fixed and has nothing to do with the user density, the number of users, and the area where the users are distributed; on the other hand, the same user location data can support area range searches with arbitrary boundaries without adjusting the preprocessing mechanism; thirdly, among a large number of users, incremental updates of user locations are allowed to quickly hit the target in real time.
本申请实施例至少具有以下技术效果:1)用户位置统一处理,而任意区域范围均转换为一维值的区间,无需根据查询区域不同调整用户位置存储逻辑;2)相对已知的GeoHash网格和Google S2网格化处理中用到的依次遍历网格的操作,本申请实施例中针对一维区间值进行查找,极大改善了处理效率;3)不同于相关技术将网格作为索引,用户集合存为值的结构,本申请实施例将用户作为key,每个用户的位置均可以实时更新,实现增量更新并即时反馈查询;4)用户位置编码精度在9毫米(采用Redis存储时精度为30厘米),优于相关技术中Level-15+Level-22两级索引的2米精度,实际运用的适用性广泛。The embodiments of the present application have at least the following technical effects: 1) user locations are processed uniformly, and any area range is converted into an interval of one-dimensional values, and there is no need to adjust the user location storage logic according to different query areas; 2) relative to the operation of traversing the grid in sequence used in the known GeoHash grid and Google S2 gridding processing, the embodiments of the present application search for one-dimensional interval values, which greatly improves the processing efficiency; 3) different from the related art that uses the grid as an index and stores the user set as a value structure, the embodiments of the present application use the user as the key, and the location of each user can be updated in real time, realizing incremental updates and instant feedback queries; 4) the user location encoding accuracy is 9 mm (the accuracy is 30 cm when using Redis storage), which is better than the 2-meter accuracy of the Level-15+Level-22 two-level index in the related art, and has a wide range of applicability in practical applications.
本申请实施例提供的目标用户的查询方法可以应用在海量用户位置动态更新场景下,无需提前维护用户和区域的关系,仅针对即时输入的区域范围,迅速查找出局部范围内的用户。可应用于运营商位置大数据下,实时圈选用户进行洞察或触达的产品中。The target user query method provided in the embodiment of the present application can be applied in the scenario of dynamic update of massive user locations. It does not need to maintain the relationship between users and regions in advance. It can quickly find users in the local area based on the area range input immediately. It can be applied to products that select users in real time for insight or contact under the big data of operator location.
基于前述的实施例,本申请实施例提供一种目标位置用户的查询装置,该装置包括所包括的各模块、以及各模块所包括的各子模块,可以通过计算机设备中的处理器来实现;当然也可通过具体的逻辑电路实现;在实施的过程中,处理器可以为中央处理器(Central Processing Unit,CPU)、微处理器(Microprocessor Unit,MPU)、数字信号处理器(Digital Signal Processor,DSP)或现场可编程门阵列(Field Programmable GateArray,FPGA)等。Based on the foregoing embodiments, an embodiment of the present application provides a query device for target location users, which includes the modules included and the sub-modules included in each module, which can be implemented by a processor in a computer device; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), etc.
图6为本申请实施例提供的一种目标位置用户的查询装置的组成结构示意图,如图6所示,所述查询装置600包括:获取模块610、转换模块620、查找模块630和筛选模块640,其中:FIG6 is a schematic diagram of the composition structure of a query device for a target location user provided in an embodiment of the present application. As shown in FIG6 , the query device 600 includes: an acquisition module 610, a conversion module 620, a search module 630, and a screening module 640, wherein:
获取模块610,用于获取待查询的目标区域范围;An acquisition module 610 is used to acquire the target area range to be queried;
转换模块620,用于将所述目标区域范围通过S2网格覆盖算法转换为多段一维取值区间;A conversion module 620, configured to convert the target area range into multiple one-dimensional value intervals through an S2 grid covering algorithm;
查找模块630,用于从预设的网格数据库中查找位置编码满足所述多段一维取值区间的候选用户集;所述网格数据库中存储有多个用户的标识以及与每一所述用户关联的位置编码;A search module 630 is used to search for a set of candidate users whose position codes satisfy the multiple one-dimensional value intervals from a preset grid database; the grid database stores multiple user identifiers and position codes associated with each of the users;
筛选模块640,用于利用所述目标区域范围对所述候选用户集进行筛选,确定出位于所述目标区域范围内的目标用户。The screening module 640 is used to screen the candidate user set using the target area range to determine the target users within the target area range.
在一些可能的实施例中,所述转换模块620包括:第一确定子模块,用于利用所述S2网格覆盖算法确定所述目标区域范围所覆盖的N个网格;其中,N小于或等于预设的最大网格数,每一所述网格的级别在预设的最小级别至最大级别之间;转换子模块,用于将每一所述网格的S2网格编码转换为一维的取值区间;合并子模块,用于对所述N个网格中相邻网格的所述取值区间进行首尾相连,得到合并后的M段一维取值区间;其中M为小于N的自然数。In some possible embodiments, the conversion module 620 includes: a first determination submodule, used to determine the N grids covered by the target area range using the S2 grid coverage algorithm; wherein N is less than or equal to a preset maximum number of grids, and the level of each of the grids is between a preset minimum level and a maximum level; a conversion submodule, used to convert the S2 grid code of each of the grids into a one-dimensional value interval; a merging submodule, used to connect the value intervals of adjacent grids in the N grids end to end to obtain M merged one-dimensional value intervals; wherein M is a natural number less than N.
在一些可能的实施例中,所述装置还包括:编码模块,用于利用S2地理位置编码体系对每一所述用户的二维坐标进行编码,得到相应所述用户的位置编码;存储模块,用于将每一所述用户的标识为键,且相应所述用户的位置编码为值存储在所述网格数据库。In some possible embodiments, the device also includes: an encoding module, used to encode the two-dimensional coordinates of each of the users using the S2 geographic location coding system to obtain the location code of the corresponding user; a storage module, used to store the identifier of each of the users as a key and the location code of the corresponding user as a value in the grid database.
在一些可能的实施例中,所述位置编码为第一级网格精度,所述网格数据库为Redis的有序集合结构,所述有序集合结构的值为双精度浮点类型,所述存储模块还用于针对每一所述用户,将所述第一级网格精度的位置编码转换为,与所述双精度浮点类型匹配的第二级网格精度的位置编码;以所述第二级网格精度的位置编码作为与相应所述用户关联的值存入所述有序集合结构;其中,所述第二级网格精度对应的网格为所述第一级网格精度对应网格的父网格。In some possible embodiments, the position code is a first-level grid precision, the grid database is an ordered set structure of Redis, the value of the ordered set structure is a double-precision floating point type, and the storage module is also used to convert the position code of the first-level grid precision into a second-level grid precision position code matching the double-precision floating point type for each of the users; the position code of the second-level grid precision is stored in the ordered set structure as a value associated with the corresponding user; wherein the grid corresponding to the second-level grid precision is the parent grid of the grid corresponding to the first-level grid precision.
在一些可能的实施例中,所述装置还包括更新模块,用于响应于第一用户的二维坐标更新,对更新后的所述二维坐标进行编码,得到新的位置编码;利用所述新的位置编码更新所述网格数据库中与所述第一用户关联的值。In some possible embodiments, the device further includes an updating module for encoding the updated two-dimensional coordinates in response to the update of the two-dimensional coordinates of the first user to obtain a new position code; and using the new position code to update the value associated with the first user in the grid database.
在一些可能的实施例中,所述查找模块包括:查找子模块,用于针对每一段所述一维取值区间,从所述网格数据库中查找位置编码属于相应所述一维取值区间内的用户,得到查询结果;所述查询结果包括所述用户的标识及关联的位置编码;合并子模块,用于对所述多段一维取值区间的查询结果进行合并,得到所述候选用户集。In some possible embodiments, the search module includes: a search submodule, used to search from the grid database for users whose position codes belong to the corresponding one-dimensional value interval for each segment of the one-dimensional value interval, to obtain a query result; the query result includes the user's identifier and the associated position code; and a merging submodule, used to merge the query results of the multiple one-dimensional value intervals to obtain the candidate user set.
在一些可能的实施例中,所述筛选模块,还用于针对所述候选用户集中每一候选用户,在所述目标区域范围的边界完整包含相应所述候选用户所在位置所属的最小网格的情况下,确定相应所述候选用户为所述目标用户。In some possible embodiments, the screening module is further used to determine, for each candidate user in the candidate user set, that the corresponding candidate user is the target user when the boundary of the target area completely includes the minimum grid to which the location of the corresponding candidate user belongs.
以上装置实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。在一些实施例中,本公开实施例提供的装置具有的功能或包含的模块可以用于执行上述方法实施例描述的方法,对于本申请装置实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
需要说明的是,本申请实施例中,如果以软件功能模块的形式实现上述的目标位置用户的查询方法,并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本申请实施例不限制于任何特定的硬件、软件或固件,或者硬件、软件、固件三者之间的任意结合。It should be noted that in the embodiment of the present application, if the query method of the target location user is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific hardware, software or firmware, or any combination of hardware, software, and firmware.
本申请实施例提供一种计算机设备,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述方法中的部分或全部步骤。An embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, some or all of the steps in the above method are implemented.
本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述方法中的部分或全部步骤。所述计算机可读存储介质可以是瞬时性的,也可以是非瞬时性的。The embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, some or all of the steps in the above method are implemented. The computer-readable storage medium can be transient or non-transient.
本申请实施例提供一种计算机程序,包括计算机可读代码,在所述计算机可读代码在计算机设备中运行的情况下,所述计算机设备中的处理器执行用于实现上述方法中的部分或全部步骤。An embodiment of the present application provides a computer program, including a computer-readable code. When the computer-readable code is run in a computer device, a processor in the computer device executes some or all of the steps for implementing the above method.
本申请实施例提供一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序被计算机读取并执行时,实现上述方法中的部分或全部步骤。该计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一些实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一些实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。The embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, some or all of the steps in the above method are implemented. The computer program product can be implemented specifically by hardware, software or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium, and in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK) and the like.
这里需要指出的是:上文对各个实施例的描述倾向于强调各个实施例之间的不同之处,其相同或相似之处可以互相参考。以上设备、存储介质、计算机程序及计算机程序产品实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请设备、存储介质、计算机程序及计算机程序产品实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。It should be noted here that the description of the various embodiments above tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. The description of the above device, storage medium, computer program and computer program product embodiments is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the embodiments of the device, storage medium, computer program and computer program product of this application, please refer to the description of the method embodiment of this application for understanding.
需要说明的是,图7为本申请实施例中计算机设备的一种硬件实体示意图,如图7所示,该计算机设备700的硬件实体包括:处理器701、通信接口702和存储器703,其中:It should be noted that FIG. 7 is a schematic diagram of a hardware entity of a computer device in an embodiment of the present application. As shown in FIG. 7 , the hardware entity of the computer device 700 includes: a processor 701, a communication interface 702, and a memory 703, wherein:
处理器701通常控制计算机设备700的总体操作。Processor 701 generally controls the overall operation of computer device 700 .
通信接口702可以使计算机设备通过网络与其他终端或服务器通信。The communication interface 702 enables the computer device to communicate with other terminals or servers through a network.
存储器703配置为存储由处理器701可执行的指令和应用,还可以缓存待处理器701以及计算机设备700中各模块待处理或已经处理的数据(例如,图像数据、音频数据、语音通信数据和视频通信数据),可以通过闪存(FLASH)或随机访问存储器(Random AccessMemory,RAM)实现。处理器701、通信接口702和存储器703之间可以通过总线704进行数据传输。The memory 703 is configured to store instructions and applications executable by the processor 701, and can also cache data to be processed or processed by the processor 701 and each module in the computer device 700 (for example, image data, audio data, voice communication data, and video communication data), which can be implemented by flash memory (FLASH) or random access memory (Random Access Memory, RAM). Data transmission between the processor 701, the communication interface 702 and the memory 703 can be carried out through the bus 704.
应理解,说明书通篇中提到的“一个实施例”或“一实施例”意味着与实施例有关的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”未必一定指相同的实施例。此外,这些特定的特征、结构或特性可以任意适合的方式结合在一个或多个实施例中。应理解,在本申请的各种实施例中,上述各步骤/过程的序号的大小并不意味着执行顺序的先后,各步骤/过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the serial number of each step/process mentioned above does not mean the order of execution, and the execution order of each step/process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The serial numbers of the embodiments of the present application mentioned above are for description only and do not represent the advantages and disadvantages of the embodiments.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元;既可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
另外,在本申请各实施例中的各功能单元可以全部集成在一个处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: a mobile storage device, a read-only memory (ROM), a magnetic disk or an optical disk, and other media that can store program codes.
或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光盘等各种可以存储程序代码的介质。Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
以上所述,仅为本申请的实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310007475.2A CN116776010B (en) | 2023-01-04 | 2023-01-04 | Target location user query method, device, equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310007475.2A CN116776010B (en) | 2023-01-04 | 2023-01-04 | Target location user query method, device, equipment and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN116776010A true CN116776010A (en) | 2023-09-19 |
| CN116776010B CN116776010B (en) | 2025-08-26 |
Family
ID=88008787
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310007475.2A Active CN116776010B (en) | 2023-01-04 | 2023-01-04 | Target location user query method, device, equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116776010B (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2025060401A1 (en) * | 2023-09-21 | 2025-03-27 | 中国银联股份有限公司 | Regional user searching method and apparatus, device, and storage medium |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20040225665A1 (en) * | 2003-05-09 | 2004-11-11 | Microsoft Corporation | System and method for employing a grid index for location and precision encoding |
| US20160091319A1 (en) * | 2014-09-25 | 2016-03-31 | United States Postal Service | Methods and systems for creating and using a location identification grid |
| CN114238384A (en) * | 2022-02-24 | 2022-03-25 | 阿里云计算有限公司 | Area positioning method, device, equipment and storage medium |
| WO2022111609A1 (en) * | 2020-11-26 | 2022-06-02 | 华为技术有限公司 | Grid encoding method and computer system |
| CN114880350A (en) * | 2022-05-07 | 2022-08-09 | 高德软件有限公司 | Spatial data retrieval method, device, electronic device and storage medium |
-
2023
- 2023-01-04 CN CN202310007475.2A patent/CN116776010B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20040225665A1 (en) * | 2003-05-09 | 2004-11-11 | Microsoft Corporation | System and method for employing a grid index for location and precision encoding |
| US20160091319A1 (en) * | 2014-09-25 | 2016-03-31 | United States Postal Service | Methods and systems for creating and using a location identification grid |
| WO2022111609A1 (en) * | 2020-11-26 | 2022-06-02 | 华为技术有限公司 | Grid encoding method and computer system |
| CN114238384A (en) * | 2022-02-24 | 2022-03-25 | 阿里云计算有限公司 | Area positioning method, device, equipment and storage medium |
| CN114880350A (en) * | 2022-05-07 | 2022-08-09 | 高德软件有限公司 | Spatial data retrieval method, device, electronic device and storage medium |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2025060401A1 (en) * | 2023-09-21 | 2025-03-27 | 中国银联股份有限公司 | Regional user searching method and apparatus, device, and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN116776010B (en) | 2025-08-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US7634465B2 (en) | Indexing and caching strategy for local queries | |
| US10034141B2 (en) | Systems and methods to identify home addresses of mobile devices | |
| Lee et al. | Efficient spatial query processing for big data | |
| US20090083275A1 (en) | Method, Apparatus and Computer Program Product for Performing a Visual Search Using Grid-Based Feature Organization | |
| WO2021000826A1 (en) | Information search method and apparatus, terminal and storage medium | |
| Rahman et al. | Hdbscan: Density based clustering over location based services | |
| CN103942221B (en) | Search method and equipment | |
| CN113360586B (en) | Address aggregation degree query method, device, equipment and computer readable storage medium | |
| CN111353012B (en) | Spatial text data caching processing method, device, electronic equipment and storage medium | |
| CN104539750A (en) | IP locating method and device | |
| CN118708590B (en) | Astronomical data indexing method, astronomical data indexing device, astronomical data indexing equipment and astronomical data indexing medium | |
| CN116776010A (en) | Query method, device, equipment and storage medium for target position user | |
| CN116010677B (en) | Spatial indexing method, device and electronic equipment thereof | |
| US12259863B2 (en) | Retrieval apparatus, methods, and storage medium | |
| CN104156475B (en) | Geography information read method and device | |
| CN112866992B (en) | Method and system for protecting location privacy | |
| CN108345607B (en) | Searching method and device | |
| CN113407576A (en) | Data association method and system based on dimension reduction algorithm | |
| CN116680468A (en) | Fingerprint library generating method and electronic device | |
| CN119106662A (en) | Reverse geocoding method and device | |
| CN104866535A (en) | Compression method and device of number segment records | |
| US20170147604A1 (en) | Database index for the optimization of distance related queries | |
| CN112257109B (en) | Data processing method and device | |
| CN114896240A (en) | A data retrieval method, device, storage medium and electronic device | |
| CN117194331B (en) | Index construction and retrieval method and device supporting hidden query |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |