WO2020114273A1 - 商户查找方法、装置、电子设备和存储介质 - Google Patents

商户查找方法、装置、电子设备和存储介质 Download PDF

Info

Publication number
WO2020114273A1
WO2020114273A1 PCT/CN2019/120840 CN2019120840W WO2020114273A1 WO 2020114273 A1 WO2020114273 A1 WO 2020114273A1 CN 2019120840 W CN2019120840 W CN 2019120840W WO 2020114273 A1 WO2020114273 A1 WO 2020114273A1
Authority
WO
WIPO (PCT)
Prior art keywords
merchant
geographic location
circumscribed rectangle
user
index tree
Prior art date
Application number
PCT/CN2019/120840
Other languages
English (en)
French (fr)
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 拉扎斯网络科技(上海)有限公司
Priority to US17/311,576 priority Critical patent/US20220027427A1/en
Publication of WO2020114273A1 publication Critical patent/WO2020114273A1/zh

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9027Trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9537Spatial or temporal dependent retrieval, e.g. spatiotemporal queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0282Rating or review of business operators or products
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/0601Electronic shopping [e-shopping]

Definitions

  • This application relates to the technical field of e-commerce, and in particular to a merchant search method, device, electronic equipment, and storage medium.
  • LBS location services
  • the related technology is to use the spatial query function of the relational database management system (PostgreSQL).
  • PostgreSQL relational database management system
  • This solution uses a method of comparing all the merchant distribution areas one by one when searching for merchants, which is suitable for merchants. In the case of a small number of distribution areas, when the number of merchant distribution areas is tens of thousands, this solution is obviously unacceptable; the related technology is to use the search engine Lucene spatial query to divide the distribution area into several grids and use Indexing and querying the relationship between the grid and the user's location has a certain improvement in performance, but this solution increases the amount of spatial data. When the spatial data reaches the level of one million or ten million, the index is too large, which will cause There is an error in the query results.
  • the purpose of the embodiments of the present application is to provide a merchant search method, device, electronic equipment, and storage medium.
  • the spatial location search scheme based on an index tree and the idea of external rectangular filtering are used to aggregate merchants that are close to each other. When users search for merchants , You can quickly find businesses that meet the search criteria.
  • the embodiments of the present application provide a merchant search method, which includes: acquiring a user's geographic location, and using a pre-established index tree to find a circumscribed rectangle covering the geographic location, where the circumscribed rectangle is the coverage of the merchant's distribution area The smallest circumscribed rectangle; determine the target distribution area covered by the distribution area corresponding to the circumscribed rectangle; the merchant corresponding to the target distribution area is regarded as the deliverable merchant corresponding to the geographical position; where the index tree includes the circumscribed rectangle based on the merchant's distribution area The first index tree created by the lower left vertex position data and the second index tree established according to the upper right vertex position data of the circumscribed rectangle of the merchant distribution area.
  • An embodiment of the present application also provides a merchant search device, including: a search module for acquiring a user's geographic location, and using a pre-established index tree to find a circumscribed rectangle covering the geographic location, wherein the circumscribed rectangle is a coverage area of the merchant's distribution The minimum circumscribed rectangle of the target; the target distribution area determination module is used to determine the target distribution area covered by the distribution area corresponding to the circumscribed rectangle; the distributeable merchant determination module is used to determine the merchant corresponding to the target distribution area as the corresponding geographical location.
  • the index tree includes a first index tree established based on the position data of the lower left vertex of the circumscribed rectangle of the merchant distribution area and a second index tree established based on the position data of the upper right vertex of the circumscribed rectangle of the merchant distribution area.
  • An embodiment of the present application further provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are at least one
  • the processor executes to realize: obtaining the user's geographic location, using a pre-established index tree to find the circumscribed rectangle covering the geographic location, wherein the circumscribed rectangle is the smallest circumscribed rectangle covering the merchant's distribution area; the distribution area corresponding to the geographic location is determined by the circumscribed rectangle Covered target delivery area; the merchant corresponding to the target delivery area is regarded as a deliverable merchant corresponding to the geographic location; where the index tree includes the first index tree established based on the position data of the lower left vertex of the circumscribed rectangle of the merchant delivery area and the merchant delivery area The second index tree created by the position data of the upper right vertex of the circumscribed rectangle.
  • the embodiments of the present application also provide a non-volatile storage medium for storing a computer-readable program, and the computer-readable program is used for a computer to execute the above merchant search method.
  • the user's geographic location and delivery area are expressed in latitude and longitude coordinates.
  • the circumscribed rectangle is determined according to the following steps: determine the extreme values of latitude and longitude in the distribution area of the merchant.
  • the extreme values of longitude and latitude include maximum longitude, minimum longitude, maximum latitude, and minimum latitude; and determine the external rectangle according to the extreme values of longitude and latitude.
  • the method further includes: acquiring the geographic location of the user, and determining the business district to which the user belongs and the corresponding index tree according to the geographic location.
  • obtaining the geographic location of the user, and using the pre-established index tree to find the circumscribed rectangle covering the geographic location of the user including: using the first index tree to find the longitude value less than the longitude value of the user location and the latitude value less than the latitude value of the user location Set the lower left vertex to get the first set of circumscribed rectangles; use the second index tree to find the upper right set of vertices with a longitude value greater than the longitude value of the user's position and a latitude value greater than the latitude value of the user's position to obtain the second set of circumscribed rectangles; The intersection of one set and the second set yields a circumscribed rectangle covering the geographic location.
  • determining the target distribution area covered by the distribution area corresponding to the circumscribed rectangle includes: using a parallel calculation method, and at the same time determining whether the geographic location is covered by each of the geographic locations The delivery area corresponding to the circumscribed rectangle is covered. If so, the delivery area corresponding to the circumscribed rectangle is determined as the target delivery area.
  • the merchant corresponding to the target delivery area is regarded as a deliverable merchant corresponding to the geographic location, it also includes: sending the information of the deliverable merchant to the user's terminal device, and displaying the information of the deliverable merchant by the terminal device.
  • the cutting point of the first index tree or the second index tree adopts the vertex of the circumscribed rectangle.
  • FIG. 1 is a flowchart of a merchant search method according to the first embodiment of the present application
  • FIG. 2 is a flowchart of determining a circumscribed rectangle of a distribution area in a business circle according to the first embodiment of the present application
  • FIG. 3 is a schematic diagram of the circumscribed rectangle of the distribution area in the business circle according to the first embodiment of the present application;
  • FIG. 4(a) is a schematic diagram of constructing a first index tree according to the second embodiment of the present application.
  • 4(b) is a schematic diagram of the relationship between the first index tree and the user position in the second embodiment of the present application.
  • FIG. 5(a) is a schematic diagram of constructing a second index tree according to the second embodiment of the present application.
  • 5(b) is a schematic diagram of the positional relationship between the second index tree and the user according to the second embodiment of the present application;
  • 6(a) and 6(b) are schematic diagrams of the first index tree and the second index tree according to the second embodiment of the present application;
  • FIG. 7 is a schematic diagram of a merchant search device according to a third embodiment of the present application.
  • FIG. 8 is a schematic diagram of an electronic device according to a fourth embodiment of the present application.
  • the first embodiment of the present application relates to a merchant search method.
  • This embodiment can be applied to a terminal side, such as a terminal device such as a mobile phone, a tablet computer, or a server on a network side.
  • a business district is, for example, a city or a district.
  • the business circle contains several merchants, and each merchant has a fixed service delivery area, that is, the merchant only provides ordering and delivery services for users who are located within their own delivery area.
  • users place an order through the network, they will first search the list of merchants corresponding to the distribution area to which their location belongs, and then select the merchant to place the order.
  • FIG. 1 is a flowchart of a method for searching a merchant according to the first embodiment of the present application. The method includes the following steps.
  • the index tree is specifically a KD index tree, that is, k-Dimension tree (K-dimensional space index tree), which is a tree-like data structure used for spatial data storage, which utilizes point-to-space data in the K-dimensional space
  • K-dimensional space index tree k-Dimension tree
  • the split point takes the median value at each split, and the data is divided into two halves. Through multiple splits, the recursion is continued until there is no data on both sides of the split point.
  • the KD index tree improves the search efficiency of spatial data by dividing the spatial data in half.
  • the circumscribed rectangle is the smallest circumscribed rectangle covering the distribution area of a merchant.
  • the distribution area of the merchant corresponds to a certain geographical range.
  • the shape of the distribution area may be a regular rectangle or an irregular shape.
  • the geographic location information of the user's geographic location and the merchant's distribution area are latitude and longitude.
  • the circumscribed rectangle is determined according to the extreme value of the latitude and longitude of the merchant distribution area. latitude. It includes the following steps.
  • S1011 Extract the latitude and longitude information on the boundary of the merchant's distribution area.
  • the latitude and longitude information includes the latitude and longitude values of all points on the boundary of the merchant distribution area.
  • S1012. Extract longitude and latitude extreme values from the longitude and latitude information, that is, maximum longitude, minimum longitude, maximum latitude, and minimum latitude.
  • the maximum longitude and the minimum longitude are found; among all the extracted latitude values on the boundary of the distribution area, the maximum latitude and the minimum latitude are found.
  • the maximum longitude and minimum longitude are, for example, Wmax and Wmin, and the maximum latitude and minimum latitude are, for example, Nmax and Nmin, respectively.
  • S1013. Determine the lower left vertex of the circumscribed rectangle according to the minimum longitude and minimum latitude, and determine the upper right vertex of the circumscribed rectangle according to the maximum longitude and maximum latitude.
  • the coordinates of the lower left vertex of the circumscribed rectangle determined according to the minimum longitude Wmin and the minimum latitude are pa(Wmin, Nmin)
  • the coordinates of the upper right vertex of the circumscribed rectangle determined according to the maximum longitude Wmax and the maximum latitude Nmax are pb(Wmax, Nmax).
  • connection between the lower left vertex pa (Wmin, Nmin) and the upper right vertex pb (Wmax, Nmax) is used as the diagonal of the circumscribed rectangle to determine the circumscribed rectangle corresponding to the delivery area.
  • the circumscribed rectangles of the distribution areas of all merchants in the business circle are determined as shown in FIG. 3. For example, there are 6 merchants and their corresponding distribution areas in the business circle, and the corresponding circumscribed rectangles are p1, p2, p3, p4, p5, and p6.
  • a KD index tree is established in units of business districts, that is, a KD index tree corresponding to a business district is established for the number of merchants included in each business district and the distribution area of each merchant. Further, the KD index tree is pre-built according to the circumscribed rectangle of the distribution area of the merchants in the business circle. Specifically, the pre-constructed KD index tree includes a first KD index tree constructed based on the lower left vertex position data of the circumscribed rectangle and a second KD index tree constructed based on the upper right vertex position data of the circumscribed rectangle.
  • the first-level cutting line of the first KD index tree or the second KD index tree may select a vertical cutting line, such as a weft line, or a horizontal cutting line, such as a warp line.
  • the cutting point of each layer of the cutting line of the first KD index tree and the second KD index tree can select the vertex of the circumscribed rectangle or the coordinate point of the vertex of the circumscribed rectangle.
  • the business circle to which the user belongs and the index tree corresponding to the business circle are first determined according to the geographic location of the user, such as the first KD index tree and the second KD index tree. Then, the first KD index tree and the second KD index tree are used for searching, and a circumscribed rectangle covering the geographic location of the user can be obtained.
  • the corresponding merchant can be obtained according to the circumscribed rectangle covering the position of the user found in step S101. Because the geographic area covered by the merchant's circumscribed rectangle is different from the geographic area covered by the merchant's distribution area, the merchant's circumscribed rectangle contains the user's location, and does not mean that the geographic area covered by the merchant's distribution area also includes the user's location. Therefore, further, compare the latitude and longitude information of the user's location with the coverage of the delivery area corresponding to the circumscribed rectangle covering the user's location, and determine whether the user's location is within the coverage of the delivery area corresponding to the circumscribed rectangle, thereby determining the target of covering the user's location Delivery Area.
  • the latitude and longitude information of the user's location is within the coverage area of the delivery area corresponding to the circumscribed rectangle, it means that the merchant corresponding to the circumscribed rectangle can provide delivery services for the user, and the delivery area corresponding to the circumscribed rectangle is determined to be the target delivery area.
  • the latitude and longitude information of the user's location is not within the coverage area of the delivery area corresponding to the circumscribed rectangle, it means that the merchant corresponding to the circumscribed rectangle cannot provide delivery services for the user.
  • serial distribution can be used to sequentially determine the multiple distribution areas, or use
  • the parallel computing method simultaneously judges multiple distribution areas.
  • the serial calculation method refers to the distribution area of multiple merchants, and calculates and judges whether the distribution area of each merchant covers the user's position one by one
  • the parallel calculation method refers to the distribution area of multiple merchants, and simultaneously calculates and Determine whether the distribution area of each merchant covers the user's location.
  • the merchant corresponding to the target distribution area is regarded as a deliverable merchant corresponding to the geographic location of the user.
  • the target distribution area covers the geographic location of the user, that is, the merchant corresponding to the target distribution area can provide the distribution service for the user, and the merchant is determined as the user's distributable merchant, that is, the geographic location of the user Corresponding deliverable merchants.
  • the information of the distributable merchant is sent to the user's terminal device, and the terminal device displays the information of the distributable merchant.
  • the terminal device displays the information of the distributable merchant.
  • the display content can include the ID of the merchant, the name of the merchant, the distance from the merchant to the user, the delivery fee, Starting price and so on.
  • the merchant, the distribution area of the merchant, and the circumscribed rectangle of the distribution area are connected through the characteristic parameters of the merchant.
  • the characteristic parameter of the merchant is, for example, the ID of the merchant.
  • the embodiment of the present application adopts a spatial position search scheme based on an index tree, and uses the lower left vertex and upper right vertex of the circumscribed rectangle of the merchant to establish index trees respectively.
  • the amount of search data includes only the data of the two vertices of each distribution area, which greatly reduces the amount of calculation and can quickly find the merchant that meets the search conditions.
  • the circumscribed rectangle is determined according to the maximum latitude and longitude and minimum latitude and longitude on the boundary of the distribution area, and the minimum circumscribed rectangle including the merchant's distribution area can be obtained, reducing the calculation amount in the search process.
  • the second embodiment of the present application relates to a merchant search method.
  • This embodiment can be applied to a terminal side, such as a terminal device such as a mobile phone or a tablet computer, or a server on a network side.
  • the method for searching a merchant according to an embodiment of the present application includes the following steps.
  • the circumscribed rectangle is the smallest circumscribed rectangle covering the distribution area of a merchant.
  • the method of determining the circumscribed rectangle is the same as steps S1011-1014 in the first embodiment.
  • the schematic diagram is shown in FIG. 3. For example, there are 6 merchants in the business circle and their corresponding distribution areas.
  • the corresponding circumscribed rectangles are p1, p2, and p3, respectively. , P4, p5, p6.
  • the lower left vertex of p1 is pa1, the upper right vertex is pb1, and the diagonal is pa1-pb1; the lower left vertex of p2 is pa2, the upper right vertex is pb2, and the diagonal is pa2-pb2; the lower left vertex of p3 is pa3, upper right The vertex is pb3, the diagonal is pa3-pb3; the lower left vertex of p4 is pa4, the upper right vertex is pb4, and the diagonal is pa4-pb4; the lower left vertex of p5 is pa5, the upper right vertex is pb5, and the diagonal is pa5- pb5; the lower left vertex of p6 is pa6, the upper right vertex is pb6, and the diagonal is pa6-pb6.
  • the geographical location of a certain user A is located in the circumscribed rectangle p4, and also in the circumscribed rectangle p5.
  • a KD index tree is established in units of business districts, that is, a KD index tree corresponding to a business district is established for the number of merchants included in each business district and the distribution area of each merchant. Further, the KD index tree is pre-built according to the circumscribed rectangle of the distribution area of the merchants in the business circle. Specifically, the pre-constructed KD index tree includes a first KD index tree constructed based on position data of the lower left vertex of the circumscribed rectangle and a second KD index tree constructed based on position data of the upper right vertex of the circumscribed rectangle.
  • the first-level cutting line of the first KD index tree or the second KD index tree may select a vertical cutting line, such as a weft line, or a horizontal cutting line, such as a warp line.
  • the cutting point of each layer of the cutting line of the first KD index tree and the second KD index tree may select the vertex of the circumscribed rectangle, or may select the coordinate point of the vertex of the circumscribed rectangle.
  • the number of vertices to be divided in a certain layer is odd, select the vertices with the middle geographical position as the cutting points among the vertices to be divided; when the number of vertices in a layer is even, select Among the vertices to be divided, one of the two vertices in the middle position is used as the cutting point, or a certain coordinate point between the two vertices is selected as the cutting point.
  • the corresponding circumscribed rectangles are p1, p2, p3, p4, p5, and p6.
  • the latitude and longitude coordinates of the lower left vertex of the circumscribed rectangle are pa1 (120, 29.3), pa2 (120.5, 31.5), pa3 (121.5, 31.3), pa4 (122.8, 30.6), pa5 (122.2, 29.5), pa6 (124.5, 31.2) ;
  • the latitude and longitude coordinates of the upper right vertex of the six circumscribed rectangles are pb1 (121.5, 30.5), pb2 (122.5, 34.8), pb3 (125, 33), pb4 (124.3, 31.6), pb5 (125.4, 31), pb6 (125.8 , 32.2).
  • FIG. 4(a) is a schematic diagram of constructing a first KD index tree according to a second embodiment of the present application
  • FIG. 4(b) is a first KD index tree and user positions according to a second embodiment of the present application Schematic diagram of the relationship.
  • the process of constructing the first KD index tree is as follows.
  • the longitude value corresponding to the cutting line L0 is 122.
  • L0 divides the 6 lower left vertices into two parts, the first part contains 3 lower left vertices as pa1, pa2, pa3, and the second part contains 3 lower left vertices as pa4, pa5, pa6.
  • the cutting line L3 passes through the lower left vertex pa3 (121.5, 31.3), that is, the corresponding latitude value is 31.3.
  • L3 divides the three lower left vertices pa1, pa2, and pa3 into two parts, and sets the lower left vertex on the cutting line L3, namely pa3 (121.5, 31.3), which belongs to both the first part and the second part. Therefore, the first part contains 2 lower left vertices pa1 and pa3, and the second part contains 2 lower left vertices pa2 and pa3.
  • the cutting line L4 passes through the lower left vertex pa4 (122.8, 30.6), that is, the corresponding latitude value is 30.6.
  • L4 divides the three lower left vertices pa4, pa5, pa6 into two parts, where the lower left vertex pa4 belongs to both the first part and the second part. Therefore, the first part contains 2 lower left vertices as pa4 and pa5, and the second part contains 2 lower left vertices as pa4 and pa6.
  • the cutting line L1 passes through the lower left vertex pa1 (120, 29.3), that is, the corresponding longitude value is 120.
  • L1 divides the two lower left vertices pa1 and pa3 into two parts, where the lower left vertex pa1 belongs to both the first part and the second part. Therefore, the first part contains 1 lower left vertex as pa1, and the second part contains 2 lower left vertices as pa1 and pa3.
  • the cutting line L2 passes through the lower left vertex pa2 (120.5, 31.5), that is, the corresponding longitude value is 120.5.
  • L2 divides the two lower left vertices pa2 and pa3 into two parts, where the lower left vertex pa2 belongs to both the first part and the second part. Therefore, the first part contains 1 lower left vertex as pa2, and the second part contains 2 lower left vertices as pa2 and pa3.
  • the cutting line L5 passes through the lower left vertex pa5 (122.2, 29.5), that is, the corresponding longitude value is 122.2.
  • L5 divides the two lower left vertices pa4 and pa5 into two parts, where the lower left vertex pa5 belongs to both the first part and the second part. Therefore, the first part contains 1 lower left vertex as pa5, and the second part contains 2 lower left vertices as pa4 and pa5.
  • the cutting line L6 passes through the lower left vertex pa6 (124.5, 31.2), that is, the corresponding longitude value is 124.5.
  • L6 divides the two lower left vertices pa4 and pa6 into two parts, where the lower left vertex pa6 belongs to both the first part and the second part. Therefore, the first part contains 1 lower left vertex as pa6, and the second part contains 2 lower left vertices as pa4 and pa6.
  • FIG. 5(a) is a schematic diagram of constructing a second KD index tree according to the second embodiment of the present application
  • FIG. 5(b) is a second KD index tree and user location according to the second embodiment of the present application Schematic diagram of the relationship.
  • the process of constructing the second KD index tree is as follows.
  • L0 divides the 6 upper right vertices into two parts. The first part contains 3 upper right vertices pb1, pb2, pb4, and the second part contains 3 upper right vertices pb3, pb5, pb6.
  • the cutting line L4 passes through the upper right vertex pb4 (124.3, 31.6), that is, the corresponding latitude value is 31.6.
  • L4 divides the three upper-right vertices pb1, pb2, pb4 into two parts, and sets the upper-right vertex on the bisector L4, namely the upper-right vertex corresponding to pb4 (124.3, 31.6), which belongs to both the first part and the second part. Therefore, the first part contains two upper right vertices pb1 and pb4, and the second part contains two upper right vertices pb2 and pb4.
  • the cutting line L6 passes through the upper right vertex pb6 (125.8, 32.2), that is, the corresponding latitude value is 32.2.
  • L6 divides the three upper-right vertices pb3, pb5, and pb6 into two parts. Among them, the upper-right vertex pb6 belongs to both the first part and the second part. Therefore, the first part contains two upper right vertices pb3 and pb6, and the second part contains two upper right vertices pb5 and pb6.
  • the cutting line L1 passes through the upper right vertex pb1 (121.5, 30.5), that is, the corresponding longitude value is 121.5.
  • L1 divides the two upper right vertices pb1 and pb4 into two parts, where the upper right vertex pb1 belongs to both the first part and the second part. Therefore, the first part contains one upper right vertex pb1, and the second part contains two upper right vertex pb1, pb4.
  • the cutting line L2 passes through the upper right vertex pb2 (122.5, 34.8), that is, the corresponding longitude value is 122.5.
  • L2 divides the two upper-right vertices pb2 and pb4 into two parts, where the upper-right vertex pb2 belongs to both the first part and the second part. Therefore, the first part contains one upper right vertex pb2, and the second part contains two upper right vertex pb2, pb4.
  • the cutting line L3 passes through the upper right vertex pb3(125, 33), that is, the corresponding longitude value is 125.
  • L3 divides the two upper right vertices pb3 and pb6 into two parts, where the upper right vertex pb3 belongs to both the first part and the second part. Therefore, the first part contains one upper right vertex pb3, and the second part contains two upper right vertex pb3, pb6.
  • the cutting line L5 passes through the upper right vertex pb5 (125.4, 31), that is, the corresponding longitude value is 125.4.
  • L5 divides the two upper right vertices pb5 and pb6 into two parts, where the upper right vertex pb5 belongs to both the first part and the second part. Therefore, the first part contains one upper right vertex pb5, and the second part contains two upper right vertex pb5, pb6.
  • FIGS. 6(a) and 6(b) are the first KD index tree and the second KD index tree according to the second embodiment of the present application Schematic.
  • the business circle to which the user belongs and the index tree corresponding to the business circle are first determined according to the geographic location of the user, such as the first KD index tree and the second KD index tree. Then, the first KD index tree and the second KD index tree are used for searching, and a circumscribed rectangle covering the geographic location of the user can be obtained.
  • the search process includes the following steps.
  • the latitude and longitude coordinates of user A are obtained as A(124, 31), that is, the longitude is 124 and the latitude is 31.
  • the circumscribed rectangle covering the location of user A should satisfy that the lower left vertex is located in the shaded area in the figure, that is, the longitude value of the lower left vertex is less than or equal to 124, and the latitude value is less than or equal to 31. It is easy to know from FIG. 4(b) that the lower left vertex of the circumscribed rectangle that meets the conditions includes: pa3 (121.5, 31.3), pa4 (122.8, 30.6), pa5 (122.2, 29.5).
  • the steps are as follows.
  • the root node is longitude 122, and the longitude value of the lower left vertex in the set on the left side of the root node is all less than or equal to 122, which meets the longitude condition in the first search condition.
  • the longitude condition is that the longitude value is less than or equal to 124;
  • the longitude values of the lower left vertex in the set on the side are all greater than or equal to 122, which has an intersection with the longitude condition. That is, the next step is to continue searching in the left set and right set of the root node.
  • the two child nodes to be searched are latitude 31.3 and latitude 30.6.
  • latitude 31.3 the latitude value of the lower left vertex in its left set is less than or equal to 31.3, which has an intersection with the latitude condition in the first search condition.
  • the latitude condition is that the latitude value is less than or equal to 31; the latitude value of the lower left vertex in the right set is greater than or equal to 31.3, which does not meet the latitude condition.
  • Latitude 30.6 the latitude value of the lower left vertex in its left set is less than or equal to 30.6, which meets the latitude condition; the latitude value of the lower left vertex in its right set is greater than or equal to 30.6, which intersects with the latitude condition .
  • the lower left vertex on the severing line must meet the longitude and latitude conditions in the first search condition at the same time.
  • a lower left vertex that meets the first search condition is pa4 (122.8, 30.6).
  • next step is to continue searching in the left set of the child node latitude 31.3, the left set of the child node latitude 30.6 and the right set.
  • the third layer is the leaf nodes.
  • the three leaf nodes to be searched are the three longitudes of longitude 120, longitude 122.2, and longitude 124.5, and it is determined whether the longitude values of the three longitudes meet the longitude condition in the first search condition. For longitude 120, longitude conditions are met; for longitude 122.2, longitude conditions are met; for longitude 124.5, longitude conditions are not met. It is further obtained that the lower left vertex located on the meridian 120 and the meridian 122.2 must meet the latitude and longitude conditions in the first search condition at the same time. Therefore, in this step, the two lower left vertices that meet the first search condition are pa1 (120, 29.3) and pa5 (122.2, 29.5).
  • the three lower left vertices that meet the first search condition are: pa1 (120, 29.3), pa4 (122.8, 30.6), pa5 (122.2, 29.5).
  • the latitude and longitude coordinates of user A are obtained as A(124, 31), that is, the longitude is 124 and the latitude is 31.
  • the circumscribed rectangle covering the location of user A should satisfy that the upper right vertex is located in the shaded area in the figure, that is, the longitude value of the upper right vertex is greater than or equal to 124, and the latitude value is greater than or equal to 31. It is easy to know from FIG.
  • the root node is 124.5 longitude, and the longitude value of the upper right vertex in the set on the left side of the root node is less than or equal to 124.5, which has an intersection with the longitude condition in the second search condition, that is, the longitude value is greater than or equal to 124; located at the root.
  • the longitude values of the upper-right vertices in the set on the right of the nodes are all greater than or equal to 124.5, which meets the longitude condition. That is, the next step is to continue searching in the left set and right set of the root node.
  • the two child nodes to be searched are latitude 31.6 and latitude 32.2.
  • latitude 31.6 the latitude value of the upper right vertex in its left set is less than or equal to 31.6, which has an intersection with the latitude condition in the second search condition.
  • the latitude condition is that the latitude value is greater than or equal to 31; the latitude value of the upper right vertex in the right set is greater than or equal to 31.3, which meets the latitude condition.
  • the upper right vertex on the severing line must meet the longitude and latitude conditions in the second search condition at the same time.
  • the upper right vertex that meets the second search condition is pb4 (124.3, 31.6).
  • the latitude value of the upper right vertex in its left set is less than or equal to 32.2, which intersects with the latitude condition; the latitude value of the upper right vertex in its right set is greater than or equal to 32.2, which meets the latitude condition .
  • the upper right vertex located on the severing line must simultaneously meet the longitude and latitude conditions in the second search condition.
  • the upper right vertex that meets the second search condition is pb6 (125.8, 32.2).
  • next step is to continue searching in the left set and right set of the child node latitude 31.6, and the left set and right set of the child node latitude 32.2.
  • the third layer is leaf nodes.
  • the four leaf nodes to be searched are four longitudes of longitude 121.5, longitude 122.5, longitude 125.4, and longitude 125, respectively, and judge whether the longitude values of these four longitudes meet the longitude conditions in the second search condition.
  • For longitude 121.5 the longitude condition is not met; for longitude 122.5, the longitude condition is not met; for longitude 125.4, the longitude condition is met; for longitude 125, the longitude condition is met.
  • the upper right vertex located on the longitude 125.4 and the longitude 125 necessarily meets the longitude and latitude conditions in the second search condition at the same time. Therefore, in this step, the two upper-right vertices that meet the second search condition are pb3 (125, 33) and pb5 (125.4, 31).
  • the four upper right vertices that meet the second search condition are: pb3 (125, 33), pb4 (124.3, 31.6), pb5 (125.4, 31), pb6 (125.8, 32.2 ).
  • the circumscribed rectangles covering the user's geographic location include p4 and p5.
  • the method for determining the target delivery area is the same as step S102 in the first embodiment.
  • the merchant corresponding to the target distribution area is regarded as a deliverable merchant corresponding to the geographic location of the user.
  • the target distribution area covers the geographic location of the user, that is, the merchant corresponding to the target distribution area can provide the distribution service for the user, and the merchant is determined as the user's distributable merchant, that is, the geographic location of the user Corresponding deliverable merchants.
  • the embodiment of the present application adopts a spatial position search scheme based on an index tree, and uses the lower left vertex and upper right vertex of the circumscribed rectangle of the merchant to establish index trees respectively.
  • the amount of search data includes only the data of the two vertices of each distribution area, which greatly reduces the amount of calculation and can quickly find the merchant that meets the search conditions.
  • the lower left vertex or the upper right vertex of the circumscribed rectangle is used as the cutting point, which is helpful to reduce the depth of the tree and further improve the search speed.
  • FIG. 7 is a schematic diagram of a merchant search device according to a third embodiment of the present application.
  • the merchant search device 700 includes: a search module 701 for acquiring a user’s geographic location, Use the pre-established index tree to find the circumscribed rectangle that covers the geographic location, where the circumscribed rectangle is the smallest circumscribed rectangle that covers the merchant's distribution area; the user's geographic location and distribution area are represented by latitude and longitude information.
  • the target delivery area determination module 702 is used to determine the target delivery area whose geographic location is covered by the delivery area corresponding to the circumscribed rectangle.
  • the deliverable merchant determination module 703 is configured to use the merchant corresponding to the target delivery area as the deliverable merchant corresponding to the geographic location.
  • the index tree includes a first index tree created based on the position data of the lower left vertex of the circumscribed rectangle of the merchant distribution area in the business circle and a second index tree established based on the position data of the upper right vertex of the circumscribed rectangle of the merchant distribution area.
  • the search module 701 obtains the geographic location of the user before acquiring the geographic location of the user, using a pre-established index tree to find the circumscribed rectangle covering the geographic location, and determines the business district to which the user belongs based on the geographic location and The index tree corresponding to the business circle.
  • the search module 701 includes a first search module 7011, a second search module 7012, and a target circumscribed rectangle determination module 7013.
  • the first search module 7011 is used to search the lower left vertex set whose longitude value is less than the longitude value of the user's position and the latitude value is less than the latitude value of the user's position using the first index tree to obtain the first set of circumscribed rectangles;
  • the second search module 7012 Use the second index tree to find the upper right set of vertices with a longitude value greater than the longitude value of the user's location and a latitude value greater than the latitude value of the user's location to obtain a second set of circumscribed rectangles;
  • the target circumscribed rectangle determination module 7013 is used to calculate the first set At the intersection with the second set, a circumscribed rectangle covering the user's geographic location is obtained.
  • the distributable merchant determination module 703 adopts a parallel calculation method, and at the same time determines whether the geographic location of the user is covered by the distribution corresponding to each circumscribed rectangle of the geographic location of the user Area coverage, if it is, determine the delivery area corresponding to the circumscribed rectangle as the target delivery area.
  • the merchant search device 700 further includes an index tree creation module 704, which is used to create an index tree according to the distribution area of the merchant in the commercial circle.
  • the index tree creation module 704 includes a circumscribed rectangle determination module 7041, a first index tree creation module 7042, and a second index tree creation module 7043.
  • the circumscribed rectangle determination module 7041 is used to determine the circumscribed rectangle according to the distribution area of the merchant in the business circle, specifically: determining the extreme value of latitude and longitude in the distribution area of the merchant, the extreme value of the longitude and latitude includes the maximum longitude, the minimum longitude, the maximum latitude and the minimum latitude ; Determine the circumscribed rectangle according to the extreme value of latitude and longitude.
  • the first index tree creation module 7042 is used to build the first index tree according to the position data of the lower left vertex of the circumscribed rectangle of the merchant distribution area.
  • the second index tree creation module 7043 is used to create a second index tree according to the position data of the upper right vertex of the circumscribed rectangle of the merchant distribution area.
  • the cutting point of the first index tree or the second index tree adopts the vertex of the circumscribed rectangle.
  • FIG. 8 is a schematic diagram of an electronic device according to a fourth embodiment of the present application.
  • the electronic device includes: at least one processor 801; A memory 802; and, respectively, a communication component 803 that is communicatively connected to the processor 801 and the memory 802, and the communication component 803 receives and transmits data under the control of the processor 801; wherein, the memory 802 stores at least one processor 801
  • the executed instruction is executed by at least one processor 801 to achieve: obtain the user's geographic location, and use a pre-established index tree to find the circumscribed rectangle covering the geographic location, where the circumscribed rectangle is the smallest circumscribed rectangle covering the merchant's distribution area; determine The target distribution area covered by the distribution area corresponding to the circumscribed rectangle; the merchant corresponding to the target distribution area is regarded as a deliverable merchant corresponding to the geographical position; where the index tree includes data based on the position of the lower left vertex of the circumscribed rectangle of the merchant distribution area.
  • the electronic device includes: one or more processors 801 and a memory 802, and one processor 801 is taken as an example in FIG. 6.
  • the processor 801 and the memory 802 may be connected through a bus or other means. In FIG. 6, the connection through a bus is used as an example.
  • the memory 802 is a non-volatile computer-readable storage medium and can be used to store non-volatile software programs, non-volatile computer executable programs, and modules.
  • the processor 801 executes various functional applications and data processing of the device by running non-volatile software programs, instructions, and modules stored in the memory 802, that is, implementing the above merchant search method.
  • the memory 802 may include a storage program area and a storage data area, where the storage program area may store an operating system and application programs required by at least one function; the storage data area may store a merchant's ID, longitude and latitude information of the merchant's distribution area, and the like.
  • the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
  • the memory 802 may optionally include memories set remotely with respect to the processor 801, and these remote memories may be connected to an external device through a network. Examples of the above network include but are not limited to the Internet, intranet, local area network, mobile communication network, and combinations thereof.
  • One or more modules are stored in the memory 802, and when executed by one or more processors 801, execute the merchant search method in any of the above method embodiments.
  • the fifth embodiment of the present application relates to a non-volatile storage medium for storing a computer-readable program, and the computer-readable program is used for a computer to execute some or all of the above method embodiments.
  • a program which is stored in a storage medium and includes several instructions to make a device ( It may be a single chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods of the embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code .

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Strategic Management (AREA)
  • Development Economics (AREA)
  • Remote Sensing (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • General Business, Economics & Management (AREA)
  • Software Systems (AREA)
  • Game Theory and Decision Science (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种商户查找方法,包括:获取用户的地理位置,利用预先建立的索引树查找覆盖用户地理位置的外接矩形(101);确定用户地理位置被外接矩形对应的配送区域覆盖的目标配送区域(102);将目标配送区域对应的商户作为用户地理位置对应的可配送商户(103)。上述方法采用了基于索引树的空间位置搜索方法,利用商户的外接矩形建立索引树。

Description

商户查找方法、装置、电子设备和存储介质
交叉引用
本申请引用于2018年12月08日递交的名称为“商户查找方法、装置、电子设备和存储介质”的第201811498594.8号中国专利申请,其通过引用被全部并入本申请。
技术领域
本申请涉及电商技术领域,尤其涉及一种商户查找方法、装置、电子设备和存储介质。
背景技术
随着互联网的发展,网上购物越来越普遍,在餐饮、酒店等行业,用户通过网络便可实现快速下单。例如外卖行业,用户下单过程中,先定位到自己的位置,然后根据点餐需求选择商户进行下单。这个过程包含了基于位置服务(LBS)的空间位置搜索的过程,即根据用户定位的位置搜索到附近可以为用户提供配送服务的商家列表。
目前有关LBS空间搜索的实现方案,相关技术一是利用关系型数据库管理系统(PostgreSQL)的空间查询功能,这种方案在搜索商家时,采用的是对所有商户配送区域逐一比较的方式,适合商户配送区域数量较少的情况,当面对商户配送区域数量上万的情况,显然这种方案不能接受;相关技术二是利用搜索引擎Lucene空间查询,将配送区域划分为若干个网格之后,利用网格与用户位置的关系进行索引及查询,其在性能上有一定提升,但是此方案因为增加了空间数据量,当空间数据达到百万、千万级别的情况下,索引太大,会导致查询结果存在误差。
发明内容
本申请实施例的目的在于提供一种商户查找方法、装置、电子设备和存 储介质,采用基于索引树的空间位置搜索方案及外接矩形过滤的思想,将距离相近的商户进行聚合,当用户查找商户时,可快速找到符合搜索条件的商户。
为解决上述技术问题,本申请的实施例提供了一种商户查找方法,包括:获取用户的地理位置,利用预先建立的索引树查找覆盖地理位置的外接矩形,其中,外接矩形为覆盖商户配送区域的最小外接矩形;确定地理位置被外接矩形对应的配送区域覆盖的目标配送区域;将目标配送区域对应的商户作为地理位置对应的可配送商户;其中,索引树包括依据商户配送区域的外接矩形的左下顶点位置数据建立的第一索引树和依据商户配送区域的外接矩形的右上顶点位置数据建立的第二索引树。
本申请的实施例还提供了一种商户查找装置,包括:查找模块,用于获取用户的地理位置,利用预先建立的索引树查找覆盖地理位置的外接矩形,其中,外接矩形为覆盖商户配送区域的最小外接矩形;目标配送区域确定模块,用于确定地理位置被外接矩形对应的配送区域覆盖的目标配送区域;可配送商户确定模块,用于将目标配送区域对应的商户作为地理位置对应的可配送商户;其中,索引树包括依据商户配送区域的外接矩形的左下顶点位置数据建立的第一索引树和依据商户配送区域的外接矩形的右上顶点位置数据建立的第二索引树。
本申请的实施例还提供了一种电子设备,包括:至少一个处理器;以及与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行以实现:获取用户的地理位置,利用预先建立的索引树查找覆盖地理位置的外接矩形,其中,外接矩形为覆盖商户配送区域的最小外接矩形;确定地理位置被外接矩形对应的配送区域覆盖的目标配送区域;将目标配送区域对应的商户作为地理位置对应的可配送商户;其中,索引树包括依据商户配送区域的外接矩形的左下顶点位置数据建立的第一索引树和依据商户配送区域的外接矩形的右上顶点位置数据建立的第二索引树。
本申请的实施例还提供了一种非易失性存储介质,用于存储计算机可读程序,计算机可读程序用于供计算机执行如上的商户查找方法。
另外,用户的地理位置和配送区域用经纬度坐标表示。
另外,外接矩形根据如下步骤确定:确定商户配送区域内的经纬度极值, 经纬度极值包括最大经度、最小经度、最大纬度、最小纬度;根据经纬度极值确定外接矩形。
另外,获取用户的地理位置,利用预先建立的索引树查找覆盖地理位置的外接矩形之前,还包括:获取用户的地理位置,根据地理位置确定用户所属的商圈及商圈对应的索引树。
另外,获取用户的地理位置,利用预先建立的索引树查找覆盖用户的地理位置的外接矩形,包括:利用第一索引树查找经度值小于用户位置的经度值且纬度值小于用户位置的纬度值的左下顶点集合,得到外接矩形的第一集合;利用第二索引树查找经度值大于用户位置的经度值且纬度值大于用户位置的纬度值的右上顶点集合,得到外接矩形的第二集合;计算第一集合与第二集合的交集,得到覆盖地理位置的外接矩形。
另外,当覆盖地理位置的外接矩形为至少两个时,确定地理位置被外接矩形对应的配送区域覆盖的目标配送区域,包括:采用并行计算方式,同时判断地理位置是否被覆盖地理位置的每个外接矩形对应的配送区域覆盖,若是,则确定外接矩形对应的配送区域为目标配送区域。
另外,在将目标配送区域对应的商户作为地理位置对应的可配送商户之后,还包括:发送可配送商户的信息到用户的终端设备,由终端设备显示可配送商户的信息。
另外,第一索引树或第二索引树的切分点采用外接矩形的顶点。
附图说明
图1是根据本申请第一实施例提供的商户查找方法流程图;
图2是根据本申请第一实施例中的确定商圈内配送区域的外接矩形的流程图;
图3是根据本申请第一实施例中的商圈内配送区域的外接矩形的示意图;
图4(a)是根据本申请第二实施例中的构建第一索引树的示意图;
图4(b)是根据本申请第二实施例中的第一索引树与用户位置关系的示意图;
图5(a)是根据本申请第二实施例中的构建第二索引树的示意图;
图5(b)是根据本申请第二实施例中的第二索引树与用户位置关系的示意图;
图6(a)和图6(b)是根据本申请第二实施例中的第一索引树和第二索引树的示意图;
图7是根据本申请第三实施例提供的商户查找装置示意图;
图8是根据本申请第四实施例提供的电子设备示意图。
具体实施例
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图对本申请的各实施例进行详细的阐述。然而,本领域的普通技术人员可以理解,在本申请各实施例中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施例的种种变化和修改,也可以实现本申请所要求保护的技术方案。
本申请的第一实施例涉及一种商户查找方法,本实施例可以应用在终端侧,如应用在手机,平板电脑等终端设备中,也可以应用在网络侧的服务器中。
餐饮领域中,一个商圈例如是一个城市、一个区等。商圈内包含若干个商户,每个商户有固定服务的配送区域,即商户只为位于自己配送区域范围内的用户提供下单及配送服务。用户通过网络下单时,会先搜索到自己所在位置所属配送区域对应的商户列表,然后选择商户进行下单。
图1是根据本申请第一实施例提供的商户查找方法流程图,该方法包括以下步骤。
S101、获取用户的地理位置,利用预先构建的索引树查找覆盖用户的地理位置的外接矩形。
本实施例中,索引树具体为KD索引树,即k-Dimension tree(K维空间索引树),是用于做空间数据存储的树状数据结构,其利用K维空间中的点对空间数据进行分割,每次分割时分割点取中值,将数据分成两半,通过多次划分,不断递归,直到分割点两侧没有数据。KD索引树通过对空间数据的折半划分,提高对空间数据的查找效率。
具体地,外接矩形为覆盖一个商户的配送区域的最小外接矩形。商户的配送区域对应一定的地理范围,配送区域的形状可能是规则的矩形,也可能是不规则形状。
进一步地,用户的地理位置和商户的配送区域的地理位置信息为经纬度。根据本申请第一实施例中的确定商户配送区域的外接矩形的流程如图2所示,根据商户配送区域的经纬度极值确定外接矩形,经纬度极值包括最大经度、最小经度、最大纬度和最小纬度。具体包括以下步骤。
S1011、提取商户配送区域边界上的经纬度信息。
经纬度信息包括商户配送区域边界上所有点的经度值和纬度值。
S1012、从经纬度信息中提取经纬度极值,即最大经度、最小经度、最大纬度和最小纬度。
具体地,在提取到的配送区域边界上的所有经度值中,找到最大经度和最小经度;在提取到的配送区域边界上的所有纬度值中,找到最大纬度和最小纬度。最大经度和最小经度例如分别为Wmax和Wmin,最大纬度和最小纬度例如分别为Nmax和Nmin。
S1013、根据最小经度和最小纬度确定外接矩形的左下顶点,根据最大经度和最大纬度确定外接矩形的右上顶点。
例如,根据最小经度Wmin和最小纬度确定的外接矩形的左下顶点坐标为pa(Wmin,Nmin),根据最大经度Wmax和最大纬度Nmax确定的外接矩形的右上顶点坐标为pb(Wmax,Nmax)。
S1014、根据左下顶点和右上顶点确定外接矩形。
本实施例中,以左下顶点pa(Wmin,Nmin)和右上顶点pb(Wmax,Nmax)之间的连线作为外接矩形的对角线,确定出配送区域对应的外接矩形。具体地,根据如上步骤S1011-S1014,确定出商圈内所有商户的配送区域的外接矩形如图3所示。例如商圈内共有6个商户及其对应的配送区域,对应的外接矩形分别为p1、p2、p3、p4、p5、p6。
本实施例中,以商圈为单位建立KD索引树,即针对每一个商圈中包含的商户数量及每个商户的配送区域,建立起对应该商圈的KD索引树。进一步地,KD索引树是依据商圈内商户的配送区域的外接矩形预先构建的。具体地说,预先构建的KD索引树包括依据外接矩形的左下顶点位置数据构建的第一KD索引 树和依据外接矩形的右上顶点位置数据构建的第二KD索引树。第一KD索引树或第二KD索引树的第一层切分线可选择纵向切分线,例如纬线,也可以选择横向切分线,例如经线。第一KD索引树和第二KD索引树每一层切分线的的切分点可以选择外接矩形的顶点,也可以选择不属于外接矩形的顶点的坐标点。
本实施例中,当需要查找与用户位置匹配的商户时,首先根据用户的地理位置确定用户所属的商圈以及该商圈对应的索引树,例如第一KD索引树和第二KD索引树。再利用第一KD索引树和第二KD索引树进行搜索,可得到覆盖该用户地理位置的外接矩形。
S102、确定用户地理位置被外接矩形对应的配送区域覆盖的目标配送区域。
本实施例中,根据步骤S101中查找到的覆盖用户位置的外接矩形,进而可以得到对应的商户。因为商户的外接矩形覆盖的地理范围并不同于商户的配送区域覆盖的地理范围,因此该商户的外接矩形包含用户位置,并不代表该商户的配送区域覆盖的地理范围也包含用户位置。因此进一步地,将用户位置的经纬度信息与覆盖用户位置的外接矩形对应的配送区域的覆盖范围进行比较,判断用户位置是否在外接矩形对应的配送区域的覆盖范围内,从而确定覆盖用户位置的目标配送区域。
若用户位置的经纬度信息在该外接矩形对应的配送区域的覆盖范围内,说明该外接矩形对应的商户可为该用户提供配送服务,确定该外接矩形对应的配送区域为目标配送区域。
若用户位置的经纬度信息不在该外接矩形对应的配送区域的覆盖范围内,说明该外接矩形对应的商户不能为该用户提供配送服务。
进一步地,当覆盖用户位置的外接矩形数量有多个时,本步骤中判断该多个商户的配送区域是否覆盖用户位置时,可采用串行计算方式对多个配送区域依次进行判断,或者采用并行计算方式对多个配送区域同时进行判断。其中,串行计算方式是指对该多个商户的配送区域,逐个依次计算并判断每个商户的配送区域是否覆盖用户位置;并行计算方式是指对该多个商户的配送区域,同时计算并判断每个商户的配送区域是否覆盖用户位置。
S103、将目标配送区域对应的商户作为用户地理位置对应的可配送商户。
本实施例中,目标配送区域覆盖用户的地理位置,也就是说目标配送区 域对应的商户能够为该用户提供配送服务,将该商户确定为该用户的可配送商户,也即该用户的地理位置对应的可配送商户。
本实施例中,当确定了用户的可配送商户之后,发送可配送商户的信息到用户的终端设备,由该终端设备显示可配送商户的信息。例如发送可配送商户列表到用户的手机上,并在手机等移动终端屏幕上显示可配送商户列表中商户的信息,显示内容可包括商户的ID、商户名称、商户到用户的距离、配送费、起送价等。
本实施例中,商户、商户的配送区域、配送区域的外接矩形通过商户的特征参数建立联系,商户的特征参数例如为商户的ID。
本申请实施例采用了基于索引树的空间位置搜索方案,利用商户的外接矩形的左下顶点和右上顶点分别建立索引树。当用户查找商户时,查找数据量只包括每个配送区域的两个顶点的数据,大大降低了运算量,可快速找到符合搜索条件的商户。另外根据配送区域边界上的最大经纬度和最小经纬度确定外接矩形,可以得到包含商户配送区域在内的最小外接矩形,减少查找过程中的计算量。
本申请的第二实施例涉及一种商户查找方法,本实施例可以应用在终端侧,如应用在手机,平板电脑等终端设备中,也可以应用在网络侧的服务器中。本申请实施例的商户查找方法包括以下步骤。
S101、获取用户的地理位置,利用预先构建的索引树查找覆盖用户的地理位置的外接矩形。
本实施例中,外接矩形为覆盖一个商户的配送区域的最小外接矩形。外接矩形的确定方法如第一实施例中的步骤S1011-1014,示意图如图3所示,例如商圈内共有6个商户及其对应的配送区域,对应的外接矩形分别为p1、p2、p3、p4、p5、p6。其中,p1的左下顶点为pa1,右上顶点为pb1,对角线为pa1-pb1;p2的左下顶点为pa2,右上顶点为pb2,对角线为pa2-pb2;p3的左下顶点为pa3,右上顶点为pb3,对角线为pa3-pb3;p4的左下顶点为pa4,右上顶点为pb4,对角线为pa4-pb4;p5的左下顶点为pa5,右上顶点为pb5,对角线为pa5-pb5;p6的左下顶点为pa6,右上顶点为pb6,对角线为pa6-pb6。某一用户A的地理位置位于外接矩形p4中,同时还位于外接矩形p5中。
本实施例中,以商圈为单位建立KD索引树,即针对每一个商圈中包含的 商户数量及每个商户的配送区域,建立起对应该商圈的KD索引树。进一步地,KD索引树是依据商圈内商户的配送区域的外接矩形预先构建的。具体地说,预先构建的KD索引树包括依据外接矩形的左下顶点位置数据构建的第一KD索引树和依据外接矩形的右上顶点位置数据构建的第二KD索引树。第一KD索引树或第二KD索引树的第一层切分线可选择纵向切分线,例如纬线,也可以选择横向切分线,例如经线。第一KD索引树和第二KD索引树每一层切分线的切分点可以选择外接矩形的顶点,也可以选择不属于外接矩形的顶点的坐标点。例如,当某一层待切分的顶点数为奇数时,选择待切分的顶点中,具有中间地理位置的顶点作为切分点;当某一层待切分的顶点数为偶数时,选择待切分的顶点中,居于中间位置的两个顶点中的其中一个作为切分点,或者选择居于该两个顶点之间的某一坐标点作为切分点。
在本申请的一个具体实施例中,结合图3所示,商圈内共有6个商户及其对应的配送区域,对应的外接矩形分别为p1、p2、p3、p4、p5、p6。6个外接矩形左下顶点的经纬度坐标分别为pa1(120,29.3),pa2(120.5,31.5),pa3(121.5,31.3),pa4(122.8,30.6),pa5(122.2,29.5),pa6(124.5,31.2);6个外接矩形右上顶点的经纬度坐标分别为pb1(121.5,30.5),pb2(122.5,34.8),pb3(125,33),pb4(124.3,31.6),pb5(125.4,31),pb6(125.8,32.2)。依据以上6个外接矩形的左下顶点和右上顶点构建第一KD索引树和第二KD索引树的步骤如下。
S1015、依据外接矩形的左下顶点构建第一KD索引树。
进一步地,图4(a)是根据本申请第二实施例中的构建第一KD索引树的示意图,图4(b)是根据本申请第二实施例中的第一KD索引树与用户位置关系的示意图。具体地,如图4(a),构建第一KD索引树的过程如下。
(1)、选择经线L0作为第一KD索引树第一层的切分线。
切分线L0对应的经度值为122。L0将6个左下顶点划分为两部分,第一部分包含3个左下顶点为pa1、pa2、pa3,第二部分包含3个左下顶点为pa4、pa5、pa6。
(2)、选择纬线L3和纬线L4作为第一KD索引树第二层的切分线。
切分线L3经过左下顶点pa3(121.5,31.3),即对应的纬度值为31.3。L3将3个左下顶点pa1、pa2、pa3划分为两部分,设定位于切分线L3上的左下 顶点,即pa3(121.5,31.3),既属于第一部分,又属于第二部分。因此,第一部分包含2个左下顶点为pa1、pa3,第二部分包含2个左下顶点为pa2、pa3。
切分线L4经过左下顶点pa4(122.8,30.6),即对应的纬度值为30.6。L4将3个左下顶点pa4、pa5、pa6划分为两部分,其中,左下顶点pa4既属于第一部分,又属于第二部分。因此,第一部分包含2个左下顶点为pa4、pa5,第二部分包含2个左下顶点为pa4、pa6。
(3)、选择经线L1、L2、L5、L6作为第一KD索引树第三层的切分线。
切分线L1经过左下顶点pa1(120,29.3),即对应的经度值为120。L1将2个左下顶点pa1、pa3划分为两部分,其中,左下顶点pa1既属于第一部分,又属于第二部分。因此,第一部分包含1个左下顶点为pa1,第二部分包含2个左下顶点为pa1、pa3。
切分线L2经过左下顶点pa2(120.5,31.5),即对应的经度值为120.5。L2将2个左下顶点pa2、pa3划分为两部分,其中,左下顶点pa2既属于第一部分,又属于第二部分。因此,第一部分包含1个左下顶点为pa2,第二部分包含2个左下顶点为pa2、pa3。
切分线L5经过左下顶点pa5(122.2,29.5),即对应的经度值为122.2。L5将2个左下顶点pa4、pa5划分为两部分,其中,左下顶点pa5既属于第一部分,又属于第二部分。因此,第一部分包含1个左下顶点为pa5,第二部分包含2个左下顶点为pa4、pa5。
切分线L6经过左下顶点pa6(124.5,31.2),即对应的经度值为124.5。L6将2个左下顶点pa4、pa6划分为两部分,其中,左下顶点pa6既属于第一部分,又属于第二部分。因此,第一部分包含1个左下顶点为pa6,第二部分包含2个左下顶点为pa4、pa6。
此时,所有的左下顶点都作为切分点位于各层切分线上,即第三层切分线两侧已没有左下顶点数据,第一KD索引树构建完成。当利用第一KD索引树查找覆盖用户位置的外接矩形时,如图4(b)所示,A用户的经纬度坐标为A(124,31)。覆盖A用户位置的外接矩形的左下顶点应当位于如图4(b)中所示的阴影区域中。
S1016、依据外接矩形的右上顶点构建第二KD索引树。
进一步地,图5(a)是根据本申请第二实施例中的构建第二KD索引树的 示意图,图5(b)是根据本申请第二实施例中的第二KD索引树与用户位置关系的示意图。具体地,如图5(a),构建第二KD索引树的过程如下。
(1)、选择经线L0作为第二KD索引树第一层的切分线。
切分线L0对应的经度值为124.5。L0将6个右上顶点划分为两部分,第一部分包含3个右上顶点为pb1、pb2、pb4,第二部分包含3个右上顶点为pb3、pb5、pb6。
(2)、选择纬线L4和纬线L6作为第二KD索引树第二层的切分线。
切分线L4经过右上顶点pb4(124.3,31.6),即对应的纬度值为31.6。L4将3个右上顶点pb1、pb2、pb4划分为两部分,设定位于切分线L4上的右上顶点即pb4(124.3,31.6)对应的右上顶点,既属于第一部分,又属于第二部分。因此,第一部分包含2个右上顶点为pb1、pb4,第二部分包含2个右上顶点为pb2、pb4。
切分线L6经过右上顶点pb6(125.8,32.2),即对应的纬度值为32.2。L6将3个右上顶点pb3、pb5、pb6划分为两部分,其中,右上顶点pb6既属于第一部分,又属于第二部分。因此,第一部分包含2个右上顶点为pb3、pb6,第二部分包含2个右上顶点为pb5、pb6。
(3)、选择经线L1、L2、L3、L5作为第二KD索引树第三层的切分线。
切分线L1经过右上顶点pb1(121.5,30.5),即对应的经度值为121.5。L1将2个右上顶点pb1、pb4划分为两部分,其中,右上顶点pb1既属于第一部分,又属于第二部分。因此,第一部分包含1个右上顶点为pb1,第二部分包含2个右上顶点为pb1、pb4。
切分线L2经过右上顶点pb2(122.5,34.8),即对应的经度值为122.5。L2将2个右上顶点pb2、pb4划分为两部分,其中,右上顶点pb2既属于第一部分,又属于第二部分。因此,第一部分包含1个右上顶点为pb2,第二部分包含2个右上顶点为pb2、pb4。
切分线L3经过右上顶点pb3(125,33),即对应的经度值为125。L3将2个右上顶点pb3、pb6划分为两部分,其中,右上顶点pb3既属于第一部分,又属于第二部分。因此,第一部分包含1个右上顶点为pb3,第二部分包含2个右上顶点为pb3、pb6。
切分线L5经过右上顶点pb5(125.4,31),即对应的经度值为125.4。L5 将2个右上顶点pb5、pb6划分为两部分,其中,右上顶点pb5既属于第一部分,又属于第二部分。因此,第一部分包含1个右上顶点为pb5,第二部分包含2个右上顶点为pb5、pb6。
此时,所有的右上顶点都作为切分点位于各层切分线上,即第三层切分线两侧已没有右上顶点数据,第二KD索引树构建完成。当利用第二KD索引树查找覆盖用户位置的外接矩形时,如图5(b)所示,A用户的位置对应的经纬度坐标为A(124,31)。覆盖A用户位置的外接矩形的右上顶点应当位于如图5(b)中所示的阴影区域中。
综上,第一KD索引树和第二KD索引树构建完成,如图6(a)和图6(b)是根据本申请第二实施例中的第一KD索引树和第二KD索引树的示意图。
本实施例中,当需要查找与用户位置匹配的商户时,首先根据用户的地理位置确定用户所属的商圈以及该商圈对应的索引树,例如第一KD索引树和第二KD索引树。再利用第一KD索引树和第二KD索引树进行搜索,可得到覆盖该用户地理位置的外接矩形。具体地,查找过程包括以下步骤。
S1017、利用第一KD索引树查找经度值小于用户位置的经度值且纬度值小于用户位置的纬度值的左下顶点集合,得到外接矩形的第一集合。
一并参见图4(b)和图6(a),获取到A用户的经纬度坐标为A(124,31),即经度为124,纬度为31。根据图4(b),覆盖A用户位置的外接矩形应当满足:左下顶点位于图中的阴影区域中,即该左下顶点的经度值小于或等于124,纬度值小于或等于31。从图4(b)容易知道,符合条件的外接矩形的左下顶点包括:pa3(121.5,31.3),pa4(122.8,30.6),pa5(122.2,29.5)。要找到pa3、pa4、pa5,利用图6(a)所示的第一KD索引树进行查找时,从根节点开始向下逐层查找,第一查找条件为:左下顶点的经度值小于或等于124,纬度值小于或等于31。具体地如以下步骤。
(1)、查找第一KD索引树的第一层。
根节点为经度122,位于根节点左侧的集合中的左下顶点的经度值都小于或等于122,符合第一查找条件中的经度条件,经度条件即经度值小于或等于124;位于根节点右侧的集合中的左下顶点的经度值均大于或等于122,与经度条件有交集。即下一步分别在根节点的左侧集合与右侧集合中继续查找。
(2)、查找第一KD索引树的第二层。
要查找的两个子节点分别为纬度31.3和纬度30.6,对于子节点:纬度31.3,其左侧集合中的左下顶点的纬度值都小于或等于31.3,与第一查找条件中的纬度条件有交集,纬度条件即纬度值小于或等于31;其右侧集合中的左下顶点的纬度值都大于或等于31.3,不符合纬度条件。
对于子节点:纬度30.6,其左侧集合中的左下顶点的纬度值都小于或等于30.6,符合纬度条件;其右侧集合中的左下顶点的纬度值都大于或等于30.6,与纬度条件有交集。此时说明位于该切分线上的左下顶点必然同时符合第一查找条件中的经度条件和纬度条件。本步骤中得到一个符合第一查找条件的左下顶点为pa4(122.8,30.6)。
如上,下一步分别在子节点纬度31.3的左侧集合、子节点纬度30.6的左侧集合与右侧集合中继续查找。
(3)、查找第一KD索引树的第三层。
第三层为叶子节点,要查找的三个叶子节点分别为经度120、经度122.2、经度124.5的三条经线,分别判断这三条经线的经度值是否符合第一查找条件中的经度条件。对于经线120,符合经度条件;对于经线122.2,符合经度条件;对于经线124.5,不符合经度条件。则进一步得到,位于经线120和经线122.2上的左下顶点必然同时符合第一查找条件中的经度条件和纬度条件。因此本步骤中得到两个符合第一查找条件的左下顶点为pa1(120,29.3)和pa5(122.2,29.5)。
根据以上步骤(1)-(3),得到符合第一查找条件的三个左下顶点为:pa1(120,29.3)、pa4(122.8,30.6)、pa5(122.2,29.5)。根据查找到的三个左下顶点,得到对应的第一外接矩形的第一集合为S1={p1、p4、p5}。
S1018、利用第二KD索引树查找经度值大于用户位置的经度值且纬度值小于用户位置的纬度值的右上顶点集合,得到外接矩形的第二集合。
一并参见图5(b)和图6(b),获取到A用户的经纬度坐标为A(124,31),即经度为124,纬度为31。根据图5(b),覆盖A用户位置的外接矩形应当满足:右上顶点位于图中的阴影区域中,即该右上顶点的经度值大于或等于124,纬度值大于或等于31。从图5(b)容易知道,符合条件的外接矩形的右上顶点包括:pb3(125,33),pb4(124.3,31.6),pb5(125.4,31),pb6(125.8,32.2)。要找到pb3,pb4,pb5,pb6,利用图6(b)所示的第二KD索引树进行查找时,从 根节点开始向下逐层查找,第二查找条件为:右上顶点的经度值大于或等于124,纬度值大于或等于31。具体地如以下步骤。
(1)、查找第二KD索引树的第一层。
根节点为经度124.5,位于根节点左侧的集合中的右上顶点的经度值都小于或等于124.5,与第二查找条件中的经度条件有交集,经度条件即经度值大于或等于124;位于根节点右侧的集合中的右上顶点的经度值均大于或等于124.5,符合经度条件。即下一步分别在根节点的左侧集合与右侧集合中继续查找。
(2)、查找第二KD索引树的第二层。
要查找的两个子节点分别为纬度31.6和纬度32.2,对于子节点:纬度31.6,其左侧集合中的右上顶点的纬度值都小于或等于31.6,与第二查找条件中的纬度条件有交集,纬度条件即纬度值大于或等于31;其右侧集合中的右上顶点的纬度值都大于或等于31.3,符合纬度条件。此时说明位于该切分线上的右上顶点必然同时符合第二查找条件中的经度条件和纬度条件。本步骤中得到一个符合第二查找条件的右上顶点为pb4(124.3,31.6)。
对于子节点:纬度32.2,其左侧集合中的右上顶点的纬度值都小于或等于32.2,与纬度条件有交集;其右侧集合中的右上顶点的纬度值都大于或等于32.2,符合纬度条件。此时说明位于该切分线上的右上顶点必然同时符合第二查找条件中的经度条件和纬度条件。本步骤中得到一个符合第二查找条件的右上顶点为pb6(125.8,32.2)。
如上,下一步分别在子节点纬度31.6的左侧集合与右侧集合、子节点纬度32.2的左侧集合与右侧集合中继续查找。
(3)、查找第二KD索引树的第三层。
第三层为叶子节点,要查找的四个叶子节点分别为经度121.5、经度122.5、经度125.4、经度125的四条经线,分别判断这四条经线的经度值是否符合第二查找条件中的经度条件。对于经线121.5,不符合经度条件;对于经线122.5,不符合经度条件;对于经线125.4,符合经度条件;对于经线125,符合经度条件。则进一步得到,位于经线125.4和经线125上的右上顶点必然同时符合第二查找条件中的经度条件和纬度条件。因此本步骤中得到两个符合第二查找条件的右上顶点为pb3(125,33)和pb5(125.4,31)。
根据以上步骤(1)-(3),得到符合第二查找条件的四个右上顶点为:pb3(125,33)、pb4(124.3,31.6)、pb5(125.4,31)、pb6(125.8,32.2)。根据查找到的四个右上顶点,得到对应的外接矩形的第二集合为S2={p3、p4、p5、p6}。
S1019、计算第一集合与第二集合的交集,得到覆盖用户地理位置的外接矩形。
根据步骤S1017得到的外接矩形的第一集合S1和步骤S1018得到的外接矩形的第二集合S2,计算两个集合的交集,即
S=S1∩S2={p4、p5}
因此,得到覆盖用户地理位置的外接矩形包括p4和p5。
S102、确定用户地理位置被外接矩形对应的配送区域覆盖的目标配送区域。
本实施例中,目标配送区域的确定方法如第一实施例中的步骤S102。
S103、将目标配送区域对应的商户作为用户地理位置对应的可配送商户。
本实施例中,目标配送区域覆盖用户的地理位置,也就是说目标配送区域对应的商户能够为该用户提供配送服务,将该商户确定为该用户的可配送商户,也即该用户的地理位置对应的可配送商户。
本申请实施例采用了基于索引树的空间位置搜索方案,利用商户的外接矩形的左下顶点和右上顶点分别建立索引树。当用户查找商户时,查找数据量只包括每个配送区域的两个顶点的数据,大大降低了运算量,可快速找到符合搜索条件的商户。另外建立索引树时,以外接矩形的左下顶点或右上顶点作为切分点,有利于减小树的深度,进一步提高了查找的速度。
本申请的第三实施例涉及一种商户查找装置,图7是根据本申请第三实施例提供的商户查找装置示意图,该商户查找装置700包括:查找模块701,用于获取用户的地理位置,利用预先建立的索引树查找覆盖地理位置的外接矩形,其中,外接矩形为覆盖商户配送区域的最小外接矩形;用户的地理位置和配送区域用经纬度信息表示。目标配送区域确定模块702,用于确定地理位置被外接矩形对应的配送区域覆盖的目标配送区域。可配送商户确定模块703,用于将目标配送区域对应的商户作为地理位置对应的可配送商户。
其中,索引树包括依据商圈内商户配送区域的外接矩形的左下顶点位置 数据建立的第一索引树和依据商户配送区域的外接矩形的右上顶点位置数据建立的第二索引树。
进一步地,查找模块701在获取用户的地理位置,利用预先建立的索引树查找覆盖所述地理位置的外接矩形之前,获取用户的地理位置,根据所述地理位置确定所述用户所属的商圈及所述商圈对应的所述索引树。
本申请实施例中,查找模块701包括第一查找模块7011、第二查找模块7012、目标外接矩形确定模块7013。其中,第一查找模块7011用于利用第一索引树查找经度值小于用户位置的经度值且纬度值小于用户位置的纬度值的左下顶点集合,得到外接矩形的第一集合;第二查找模块7012用于利用第二索引树查找经度值大于用户位置的经度值且纬度值大于用户位置的纬度值的右上顶点集合,得到外接矩形的第二集合;目标外接矩形确定模块7013用于计算第一集合与第二集合的交集,得到覆盖用户地理位置的外接矩形。
进一步地,当覆盖用户的地理位置的外接矩形为至少两个时,可配送商户确定模块703采用并行计算方式,同时判断用户的地理位置是否被覆盖用户的地理位置的每个外接矩形对应的配送区域覆盖,若是,则确定外接矩形对应的配送区域为目标配送区域。
本申请实施例中,该商户查找装置700还包括索引树创建模块704,用于根据商圈内商户的配送区域创建索引树。具体地,索引树创建模块704包括外接矩形确定模块7041、第一索引树创建模块7042和第二索引树创建模块7043。
具体地,外接矩形确定模块7041用于根据商圈内商户的配送区域确定外接矩形,具体为:确定商户配送区域内的经纬度极值,经纬度极值包括最大经度、最小经度、最大纬度和最小纬度;根据经纬度极值确定外接矩形。
更为具体地,第一索引树创建模块7042用于依据商户配送区域的外接矩形的左下顶点位置数据建立第一索引树。
更为具体地,第二索引树创建模块7043用于依据商户配送区域的外接矩形的右上顶点位置数据建立第二索引树。
进一步地,第一索引树或第二索引树的切分点采用外接矩形的顶点。
本申请第四实施例涉及一种电子设备,图8是根据本申请第四实施例提供的电子设备示意图,该电子设备包括:至少一个处理器801;以及,与至少一 个处理器801通信连接的存储器802;以及,分别与处理器801和存储器802均为通信连接的通信组件803,通信组件803在处理器801的控制下接收和发送数据;其中,存储器802存储有可被至少一个处理器801执行的指令,指令被至少一个处理器801执行以实现:获取用户的地理位置,利用预先建立的索引树查找覆盖地理位置的外接矩形,其中,外接矩形为覆盖商户配送区域的最小外接矩形;确定地理位置被外接矩形对应的配送区域覆盖的目标配送区域;将目标配送区域对应的商户作为地理位置对应的可配送商户;其中,索引树包括依据商户配送区域的外接矩形的左下顶点位置数据建立的第一索引树和依据所商户配送区域的外接矩形的右上顶点位置数据建立的第二索引树。
该电子设备包括:一个或多个处理器801以及存储器802,图6中以一个处理器801为例。处理器801、存储器802可以通过总线或者其他方式连接,图6中以通过总线连接为例。存储器802作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。处理器801通过运行存储在存储器802中的非易失性软件程序、指令以及模块,从而执行设备的各种功能应用以及数据处理,即实现上述商户查找方法。
存储器802可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储商户的ID、商户的配送区域的经纬度信息等。此外,存储器802可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器802可选包括相对于处理器801远程设置的存储器,这些远程存储器可以通过网络连接至外接设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
一个或者多个模块存储在存储器802中,当被一个或者多个处理器801执行时,执行上述任意方法实施例中的商户查找方法。
上述产品可执行本申请实施例所提供的方法,具备执行方法相应的功能模块和有益效果,未在本实施例中详尽描述的技术细节,可参见本申请实施例所提供的方法。
本申请的第五实施例涉及一种非易失性存储介质,用于存储计算机可读程序,计算机可读程序用于供计算机执行上述部分或全部的方法实施例。
即,本领域技术人员可以理解,实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
本领域的普通技术人员可以理解,上述各实施例是实现本申请的具体实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本申请的精神和范围。

Claims (18)

  1. 一种商户查找方法,包括:
    获取用户的地理位置,利用预先建立的索引树查找覆盖所述地理位置的外接矩形,其中,所述外接矩形为覆盖商户配送区域的最小外接矩形;
    确定所述地理位置被所述外接矩形对应的配送区域覆盖的目标配送区域;
    将所述目标配送区域对应的商户作为所述地理位置对应的可配送商户;
    其中,所述索引树包括依据商户配送区域的外接矩形的左下顶点位置数据建立的第一索引树和依据所述商户配送区域的外接矩形的右上顶点位置数据建立的第二索引树。
  2. 根据权利要求1所述的方法,其中,所述用户的地理位置和所述配送区域用经纬度坐标表示。
  3. 根据权利要求2所述的方法,其中,所述外接矩形根据如下步骤确定:
    确定商户配送区域内的经纬度极值,所述经纬度极值包括最大经度、最小经度、最大纬度、最小纬度;
    根据所述经纬度极值确定所述外接矩形。
  4. 根据权利要求1所述的方法,其中,所述获取用户的地理位置,利用预先建立的索引树查找覆盖所述地理位置的外接矩形之前,还包括:
    获取用户的地理位置,根据所述地理位置确定所述用户所属的商圈及所述商圈对应的所述索引树。
  5. 根据权利要求2-4任一项所述的方法,其中,所述获取用户的地理位置,利用预先建立的索引树查找覆盖所述用户的地理位置的外接矩形,包括:
    利用第一索引树查找经度值小于所述用户位置的经度值且纬度值小于所述用户位置的纬度值的左下顶点集合,得到外接矩形的第一集合;
    利用第二索引树查找经度值大于所述用户位置的经度值且纬度值大于所述用户位置的纬度值的右上顶点集合,得到外接矩形的第二集合;
    计算所述第一集合与所述第二集合的交集,得到覆盖所述地理位置的外接矩形。
  6. 根据权利要求5所述的方法,其中,当覆盖所述地理位置的外接矩形为至少两个时,所述确定所述地理位置被所述外接矩形对应的配送区域覆盖的目标配送区域,包括:
    采用并行计算方式,同时判断所述地理位置是否被覆盖所述地理位置的每个所述外接矩形对应的配送区域覆盖,若是,则确定所述外接矩形对应的配送区域为目标配送区域。
  7. 根据权利要求1所述的方法,其中,在所述将所述目标配送区域对应的商户作为所述地理位置对应的可配送商户之后,还包括:
    发送所述可配送商户的信息到所述用户的终端设备,由所述终端设备显示所述可配送商户的信息。
  8. 根据权利要求1所述的方法,其中,所述第一索引树或所述第二索引树的切分点采用所述外接矩形的顶点。
  9. 一种商户查找装置,其中,包括:
    查找模块,用于获取用户的地理位置,利用预先建立的索引树查找覆盖所述地理位置的外接矩形,其中,所述外接矩形为覆盖商户配送区域的最小外接矩形;
    目标配送区域确定模块,用于确定所述地理位置被所述外接矩形对应的配送区域覆盖的目标配送区域;
    可配送商户确定模块,用于将所述目标配送区域对应的商户作为所述地理位置对应的可配送商户;
    其中,所述索引树包括依据商户配送区域的外接矩形的左下顶点位置数据建立的第一索引树和依据所述商户配送区域的外接矩形的右上顶点位置数据建立的第二索引树。
  10. 一种电子设备,其中,包括:至少一个处理器;以及
    与所述至少一个处理器通信连接的存储器;
    其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行以实现:获取用户的地理位置,利用预先建立的索引树查找覆盖所述地理位置的外接矩形,其中,所述外接矩形为覆盖商户配送区域的最小外接矩形;确定所述地理位置被所述外接矩形对应的配送区域覆盖的目标配送区域;将所述目标配送区域对应的商户作为所述地理位置对应的可配送商户;其中,所述索引树包括依据商户配送区域的外接矩形的左下顶点位置数据建立的第一索引树和依据所述商户配送区域的外接矩形的右上顶点位置数据建立的第二索引树。
  11. 根据权利要求10所述的电子设备,其中,所述用户的地理位置和所述配送区域用经纬度坐标表示。
  12. 根据权利要求11所述的电子设备,其中,所述外接矩形根据如下步骤确定:
    确定商户配送区域内的经纬度极值,所述经纬度极值包括最大经度、最小经度、最大纬度、最小纬度;
    根据所述经纬度极值确定所述外接矩形。
  13. 根据权利要求10所述的电子设备,其中,所述获取用户的地理位置,利用预先建立的索引树查找覆盖所述地理位置的外接矩形之前,还包括:
    获取用户的地理位置,根据所述地理位置确定所述用户所属的商圈及所述商圈对应的所述索引树。
  14. 根据权利要求11-13任一项所述的电子设备,其中,所述获取用户的地理位置,利用预先建立的索引树查找覆盖所述用户的地理位置的外接矩形,包括:
    利用第一索引树查找经度值小于所述用户位置的经度值且纬度值小于所述用户位置的纬度值的左下顶点集合,得到外接矩形的第一集合;
    利用第二索引树查找经度值大于所述用户位置的经度值且纬度值大于所述用户位置的纬度值的右上顶点集合,得到外接矩形的第二集合;
    计算所述第一集合与所述第二集合的交集,得到覆盖所述地理位置的外接矩形。
  15. 根据权利要求14所述的电子设备,其中,当覆盖所述地理位置的外接矩形为至少两个时,所述确定所述地理位置被所述外接矩形对应的配送区域覆盖的目标配送区域,包括:
    采用并行计算方式,同时判断所述地理位置是否被覆盖所述地理位置的每个所述外接矩形对应的配送区域覆盖,若是,则确定所述外接矩形对应的配送区域为目标配送区域。
  16. 根据权利要求10所述的电子设备,其中,在所述将所述目标配送区域对应的商户作为所述地理位置对应的可配送商户之后,还包括:
    发送所述可配送商户的信息到所述用户的终端设备,由所述终端设备显示所述可配送商户的信息。
  17. 根据权利要求10所述的电子设备,其中,所述第一索引树或所述第二索引树的切分点采用所述外接矩形的顶点。
  18. 一种非易失性存储介质,用于存储计算机可读程序,其中,所述计算机可读程序用于供计算机执行如权利要求1至8中任一项所述的商户查找方法。
PCT/CN2019/120840 2018-12-08 2019-11-26 商户查找方法、装置、电子设备和存储介质 WO2020114273A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/311,576 US20220027427A1 (en) 2018-12-08 2019-11-26 Business searching methods and apparatuses, electronic devices and storage media

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811498594.8A CN109657022B (zh) 2018-12-08 2018-12-08 商户查找方法、装置、电子设备和存储介质
CN201811498594.8 2018-12-08

Publications (1)

Publication Number Publication Date
WO2020114273A1 true WO2020114273A1 (zh) 2020-06-11

Family

ID=66113885

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/120840 WO2020114273A1 (zh) 2018-12-08 2019-11-26 商户查找方法、装置、电子设备和存储介质

Country Status (3)

Country Link
US (1) US20220027427A1 (zh)
CN (1) CN109657022B (zh)
WO (1) WO2020114273A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109657022B (zh) * 2018-12-08 2020-06-30 拉扎斯网络科技(上海)有限公司 商户查找方法、装置、电子设备和存储介质
CN110389994A (zh) * 2019-07-17 2019-10-29 拉扎斯网络科技(上海)有限公司 数据处理方法、装置、定位方法、存储介质和电子设备
CN112862951A (zh) * 2021-01-28 2021-05-28 晟通科技集团有限公司 配件建模方法、计算机装置及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080133484A1 (en) * 2004-11-30 2008-06-05 Hewlett-Packard Development Company, L.P. Device, Method and Program for Managing Area Information
CN103258007A (zh) * 2013-04-16 2013-08-21 中国科学院地理科学与资源研究所 一种利用冲突检测机制的地图标注方法及装置
CN107908722A (zh) * 2017-11-14 2018-04-13 华东师范大学 基于距离的逆向k排名查询方法
CN108090150A (zh) * 2017-12-11 2018-05-29 厦门亿力吉奥信息科技有限公司 Gis空间对象存储方法及其系统
CN109657022A (zh) * 2018-12-08 2019-04-19 拉扎斯网络科技(上海)有限公司 商户查找方法、装置、电子设备和存储介质

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7287002B1 (en) * 2000-02-18 2007-10-23 National Systems Corporation System for placing product delivery orders through the internet
CN101459569B (zh) * 2008-12-12 2011-08-10 华为技术有限公司 建立路由索引树的方法、装置和查找路由索引树的方法、装置
JP5237837B2 (ja) * 2009-01-07 2013-07-17 株式会社日立製作所 空間データ管理装置、空間データ管理方法、および、空間データ管理プログラム
JP6167531B2 (ja) * 2013-01-24 2017-07-26 富士通株式会社 領域検索方法、領域インデックス構築方法および領域検索装置
US9087091B2 (en) * 2013-08-07 2015-07-21 Sap Se Determination of differences in hierarchical data
CN104424189B (zh) * 2013-08-20 2019-03-26 中国电信集团公司 基于云平台的定位解算方法和系统
CN104268243B (zh) * 2014-09-29 2017-11-17 华为技术有限公司 一种位置数据处理方法及装置
US20180253445A1 (en) * 2015-10-02 2018-09-06 Entit Software Llc Geo-positioning information indexing
CN105338492B (zh) * 2015-11-18 2018-07-31 南京大学 一种基于地理围栏技术的智能电子导游系统
CN106599129B (zh) * 2016-12-02 2019-06-04 山东科技大学 一种顾及地形特点的多波束点云数据去噪方法
CN108171357B (zh) * 2016-12-08 2020-12-22 北京京东振世信息技术有限公司 物流信息系统中的信息处理方法和装置
CN107423373A (zh) * 2017-07-04 2017-12-01 东南大学 一种城市级三维建筑模型索引方法
CN107562895A (zh) * 2017-09-06 2018-01-09 上海享骑电动车服务有限公司 地理围栏
CN108038118B (zh) * 2017-11-01 2021-10-15 华东师范大学 一种位置优先并维护最小外接矩形的kd树构建方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080133484A1 (en) * 2004-11-30 2008-06-05 Hewlett-Packard Development Company, L.P. Device, Method and Program for Managing Area Information
CN103258007A (zh) * 2013-04-16 2013-08-21 中国科学院地理科学与资源研究所 一种利用冲突检测机制的地图标注方法及装置
CN107908722A (zh) * 2017-11-14 2018-04-13 华东师范大学 基于距离的逆向k排名查询方法
CN108090150A (zh) * 2017-12-11 2018-05-29 厦门亿力吉奥信息科技有限公司 Gis空间对象存储方法及其系统
CN109657022A (zh) * 2018-12-08 2019-04-19 拉扎斯网络科技(上海)有限公司 商户查找方法、装置、电子设备和存储介质

Also Published As

Publication number Publication date
CN109657022B (zh) 2020-06-30
CN109657022A (zh) 2019-04-19
US20220027427A1 (en) 2022-01-27

Similar Documents

Publication Publication Date Title
US11740102B2 (en) Method, apparatus, device and storage medium for determining point of interest area
WO2020114273A1 (zh) 商户查找方法、装置、电子设备和存储介质
WO2020192027A1 (zh) 一种嵌入式城市设计场景仿真方法及系统
CN110321443B (zh) 三维实景模型数据库构建方法、装置及数据服务系统
WO2020114272A1 (zh) 商户查找方法、装置、电子设备和存储介质
JP2019512668A (ja) ルート逸脱認識方法、端末、および記憶媒体
CN110069840B (zh) 室内三维语义模型的构建方法及装置
CN108269304B (zh) 一种多地理信息平台下的场景融合可视化方法
US9734162B2 (en) Geospatial queries using associated distribution data
WO2016095682A1 (zh) 一种处理数字地面模型接缝的方法及装置
WO2021168989A1 (zh) 一种输电线路廊道多源空间数据库构建方法和装置
WO2022247165A1 (zh) 地理位置区域的编码方法、建立编码模型的方法及装置
CN102193996B (zh) 基于移动设备的可视Web对象搜索引擎方法
CN111859187B (zh) 基于分布式图数据库的poi查询方法、装置、设备及介质
CN113111487A (zh) 一种智慧城市规划仿真动态模拟系统及其运行方法
US9811539B2 (en) Hierarchical spatial clustering of photographs
JP2015132539A (ja) 日照量計算装置、経路提案装置および日照量計算方法
She et al. 3D building model simplification method considering both model mesh and building structure
CN114595302A (zh) 空间要素的多层级空间关系构建方法、装置、介质及设备
TW201445341A (zh) 基於範圍選取的搜索系統及方法
CN104392035B (zh) 一种基于Web的城市三维建模方法
CN104090945B (zh) 一种地理空间实体构建方法及系统
WO2015192716A1 (zh) 一种基于电子地图的划线搜索方法和装置
Bi et al. Research on CIM basic platform construction
CN105677843A (zh) 一种自动获取宗地四至属性的方法

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: 19894263

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19894263

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 26.01.2022)