CN114116931A - Data acquisition method and device, electronic equipment and readable storage medium - Google Patents

Data acquisition method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN114116931A
CN114116931A CN202111323082.XA CN202111323082A CN114116931A CN 114116931 A CN114116931 A CN 114116931A CN 202111323082 A CN202111323082 A CN 202111323082A CN 114116931 A CN114116931 A CN 114116931A
Authority
CN
China
Prior art keywords
target
area
data
longitude
sub
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111323082.XA
Other languages
Chinese (zh)
Inventor
司建珂
常计南
杨坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN202111323082.XA priority Critical patent/CN114116931A/en
Publication of CN114116931A publication Critical patent/CN114116931A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Remote Sensing (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a data acquisition method, a data acquisition device, electronic equipment and a readable storage medium, wherein in the method, the current geographic position of a target user is acquired under the condition of receiving a target data acquisition request sent by the target user; determining a target data fragment corresponding to a target area to which the current geographic position belongs based on the current geographic position; the target data fragment is stored with a target area and related data in a boundary area, and the boundary area is adjacent to the target area; and inquiring the target data in the related data in the target data fragment and returning the target data to the target user based on the target data acquisition request. Therefore, when the user searches the merchant data based on the geographic position, the embodiment of the invention only needs to search and query in the same target data fragment, thereby reducing the search request amount of the user, saving network resources and improving the data acquisition efficiency.

Description

Data acquisition method and device, electronic equipment and readable storage medium
Technical Field
The present invention belongs to the field of network technologies, and in particular, to a data acquisition method, an apparatus, an electronic device, and a readable storage medium.
Background
With the continuous development of internet technology, intelligent electronic devices have been widely used in the work and life of users. In a local life scenario, a user may search for and obtain nearby online merchant data for consumption based on an application of an electronic device.
In the prior art, when a developer stores merchant data, the data of a fixed number of merchants (for example, a group of 10 merchants) is stored in the same data server after the merchants are sorted in a specific order, for example, according to a certain serial number.
The online storage mode of the merchant data leads to that data searching needs to be carried out in a plurality of nearby data servers aiming at the searching request of the same user when searching is carried out subsequently, the searching request of the user is amplified, more network resources are occupied, and the data acquisition efficiency is low.
Disclosure of Invention
The invention provides a data acquisition method, a data acquisition device, electronic equipment and a readable storage medium, which are used for solving the problems that a data acquisition mode in the prior art amplifies a search request of a user, occupies more network resources and has lower data acquisition efficiency.
In a first aspect, the present invention provides a data acquisition method, including:
under the condition of receiving a target data acquisition request sent by a target user, acquiring the current geographic position of the target user;
determining a target data fragment corresponding to a target area to which the current geographic position belongs based on the current geographic position; the target data fragment stores the target area and related data in a boundary area, and the boundary area is adjacent to the target area;
and inquiring target data in related data in the target data fragment based on the target data acquisition request, and returning the target data to the target user.
In a second aspect, the present invention provides a data acquisition apparatus, comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring the current geographic position of a target user under the condition of receiving a target data acquisition request sent by the target user;
a first determination module, configured to determine, based on the current geographic location, a target data segment corresponding to a target area to which the current geographic location belongs; the target data fragment stores the target area and related data in a boundary area, and the boundary area is adjacent to the target area;
and the query module is used for querying the target data in the related data in the target data fragment based on the target data acquisition request and returning the target data to the target user.
In a third aspect, the present invention provides an electronic device comprising: a processor, a memory and a computer program stored on the memory and executable on the processor, the processor implementing the above data acquisition method when executing the program.
In a fourth aspect, the present invention provides a readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform the above-mentioned data acquisition method.
According to the data acquisition method provided by the embodiment of the invention, under the condition that a target data acquisition request sent by a target user is received, the current geographic position of the target user is acquired; determining a target data fragment corresponding to a target area to which the current geographic position belongs based on the current geographic position; the target data fragment is stored with a target area and related data in a boundary area, and the boundary area is adjacent to the target area; and inquiring the target data in the related data in the target data fragment and returning the target data to the target user based on the target data acquisition request. Compared with the mode of grouping the merchant data according to the serial number and storing the merchant data on line, the method and the device for searching the merchant data in the geographic area have the advantages that the merchant data in the same geographic area are stored in the same data server, and the merchant data in the boundary area are stored in a redundant mode, so that a user only needs to search and inquire in the same target data fragment when searching the merchant data based on the geographic position, search request quantity of the user is reduced, network resources are saved, and data acquisition efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a flow chart illustrating steps of a data acquisition method according to an embodiment of the present invention;
FIG. 2 is a prior art data recall method;
FIG. 3 is a diagram illustrating a data acquisition method according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a target area and a boundary area according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a storage range of a target data slice according to an embodiment of the present invention;
fig. 6 is a schematic diagram of grouping target areas according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating sub-packet partitioning according to an embodiment of the present invention;
FIG. 8 is a block diagram of a data acquisition device according to an embodiment of the present invention;
fig. 9 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of steps of a data acquisition method according to an embodiment of the present invention, where the method may be applied to an electronic device, where the electronic device may specifically be a smart phone, a tablet computer, a notebook, a vehicle-mounted computer, and the like. As shown in fig. 1, the method may include:
step 101, acquiring a current geographic position of a target user when receiving a target data acquisition request sent by the target user.
In the embodiment of the present invention, the target user may refer to a user who needs to acquire data currently. The target data may refer to online merchant data such as merchant lists, merchant activities, merchandise information, and the like. The target data acquisition request may refer to an operation instruction of a user on the electronic device, specifically, may refer to a touch operation of the user on a search query control in the display interface, and may also refer to an operation instruction of voice input of the user, and the like. The current geographic location may refer to a real-time location at which the target user is located, which may be expressed in terms of latitude and longitude.
In a local lifestyle service scenario, recalling nearby offers (merchants or goods) to engage in online activities is a fundamental function of lifestyle service-like applications. The electronic device may obtain a current geographic location of the target user through a Global Positioning System (GPS) module built in the electronic device based on a target data obtaining request of the user, and may subsequently perform data query based on the current geographic location.
Step 102, determining target data fragments corresponding to a target area to which the current geographic position belongs based on the current geographic position; the target data slice stores the target area and the related data in a boundary area, and the boundary area is adjacent to the target area.
In the embodiment of the present invention, the target area may refer to an area to which a current geographic location where the target user is located belongs, and the target area may be a pre-divided area. The target data shards may refer to distributed cache shards, the target data shards may be stored in data servers, and one target data shard corresponding to one target area may correspond to one data server separately. The related data may refer to online merchant data such as merchant lists, merchant activities, merchandise information, and the like. The boundary area may refer to a geographical area adjacent to the target area. The size of the boundary area may refer to a maximum recall range Based on Location Based Services (LBS), for example, may refer to a longitude and latitude, and the specific size of the boundary area is not limited in the embodiment of the present invention. The location based service LBS may be a service for acquiring the current location of the location device using various types of location technologies and providing information resources to the location device through the mobile internet.
In the embodiment of the invention, in a local life service scene, a large amount of activity, merchant or commodity data is generated under the background that an operation scene is continuously subdivided and an operation means is continuously refined. In order to improve user experience and guarantee merchant rights and interests, providing high-performance, high-availability and high-precision activity supply recall capability is a common challenge for local life service application developers. Fig. 2 illustrates a data recall method in the prior art. Referring to FIG. 2, in this implementation, the general flow of recalling an offer (merchant or merchandise) for a nearby participation event is as follows:
first, the supply serial number (ID) of merchants (or commodities) is used as a key value (key), and the merchants are grouped according to the ID. For example, merchant activity data for store 1 through store n in fig. 2 is stored in data slice 1; merchant activity data of stores 3 to n-1 are stored in the data fragment 2; merchant activity data for stores 5 through n-2 are stored in data slice 3. Then, when a user (Actor) searches based on a client (Consumer, C-side), based on the location of the user, it is necessary to request data from all data fragments corresponding to a nearby area, that is, to request data from data fragment 1, data fragment 2, and data fragment 3, respectively, for example, as shown in fig. 2, when the user obtains a delivery activity of an accessory area, it is necessary to request data from data fragments 1 to 3 through Remote Procedure Call (RPC), respectively. And finally, taking and collecting the data requested in the plurality of data fragments, and displaying the data to the user.
In the data search recall method, because the nearby supply IDs are irregular, when key-indexed (key-indexed) based on a hash algorithm is stored, it cannot be guaranteed that the nearby supplies are all distributed in the same fragment, and one request of a user is amplified to F times (F is the number of fragments). Therefore, for the same data search request of a user, data query needs to be carried out in a plurality of data fragments, the user request is amplified, a large amount of CPU calculation is brought, a large amount of network resources are occupied, and the search efficiency is not high. If a new fragment cluster is expanded, more server resources are occupied, specifically, a group of clusters capable of loading the current C-side traffic need to be applied for expanding one data fragment, and server resources are consumed greatly.
In the embodiment of the invention, the related data of the merchants in the same target area and the adjacent boundary areas thereof are stored in the same target data fragment, so that a user can only request data from one target data fragment when searching, the searching efficiency is improved, excessive network resources and CPU resources are not occupied, and the fragment cluster is not required to be expanded.
It is to be noted that, in responding to a search request of a user based on area division and based on a geographical area, there is a case where the user searches near a boundary between target areas. When a user searches merchant data near the boundaries of a plurality of target areas, due to the fact that the user is located in a special real-time geographic location, surrounding merchants may be distributed in two, three or more target areas, and at this time, if a storage mode that only relevant data in the target areas are stored in the same target data fragment is adopted, the electronic device still needs to perform data requests in the plurality of target data fragments, so that the comprehensiveness of user search is ensured.
The embodiment of the invention adopts a 'data redundancy concept' when storing the relevant data of the merchants, namely, the relevant data in the boundary area adjacent to the target area is also stored while the relevant data of the merchants in the target area is stored by the target data fragment. Therefore, when the user searches near the boundary of the target area, only one target data fragment needs to be determined, and the efficiency of data query is further improved.
Step 103, based on the target data acquisition request, querying target data in related data in the target data fragment and returning the target data to the target user.
In the embodiment of the present invention, the target data may refer to merchant-related data that satisfies the user acquisition request. After the target data fragment corresponding to the target area to which the current geographic position of the user belongs is determined, the target data required by the user can be determined based on data query, and the target data is returned to and displayed on the user, so that the subsequent operation of the user is facilitated.
Exemplarily, fig. 3 is a schematic diagram of a data acquisition method provided by an embodiment of the present invention. As shown in fig. 3, the target user sends a target data acquisition request to acquire the merchant store of the attachment and the various merchant activities placed in the area. And then, the electronic equipment performs area routing according to the real-time geographic position of the target user, namely, determines the target data fragment corresponding to the target area to which the real-time position belongs. And then, performing data query in the determined target data fragment, determining target data and returning the target data to the user. Therefore, for the search request of the user, data query and data access in a plurality of data fragments are not needed, and only one target data fragment is needed to be queried, so that network resources are saved, and the data acquisition efficiency is improved.
According to the data acquisition method provided by the embodiment of the invention, under the condition that a target data acquisition request sent by a target user is received, the current geographic position of the target user is acquired; determining a target data fragment corresponding to a target area to which the current geographic position belongs based on the current geographic position; the target data fragment is stored with a target area and related data in a boundary area, and the boundary area is adjacent to the target area; and inquiring the target data in the related data in the target data fragment and returning the target data to the target user based on the target data acquisition request. Compared with the mode of grouping the merchant data according to the serial number and storing the merchant data on line, the method and the device for searching the merchant data in the geographic area have the advantages that the merchant data in the same geographic area are stored in the same data server, and the merchant data in the boundary area are stored in a redundant mode, so that a user only needs to search and inquire in the same target data fragment when searching the merchant data based on the geographic position, search request quantity of the user is reduced, network resources are saved, and data acquisition efficiency is improved.
Optionally, in this embodiment of the present invention, before step 101, the data obtaining method may further include the following steps S21 to S23:
step S21, determining the geographic position of each target object, and dividing each target object into a plurality of target areas according to the geographic position.
In the embodiment of the present invention, the target object may refer to each merchant store. In this step, the plurality of target objects may be divided into a plurality of target areas based on the geographical position relationship among the target objects, so as to ensure the instant delivery problem in the local life scene and ensure that the services such as the rapid delivery of the target users can be realized within the range covered by the delivery.
Step S22, aiming at any target area, determining a neighbor area adjacent to the target area and determining a boundary area in the neighbor area; the boundary area is an area which is directly adjacent to the target area in the neighbor area and occupies a preset proportion of the neighbor area.
In the embodiment of the present invention, the neighbor area may refer to a geographical area adjacent to the target area. The preset proportion may be a preset proportion of the boundary region, and the preset proportion may be flexibly set based on the maximum recall range, which is not limited in the embodiment of the present invention.
Specifically, in this step, after the target areas are divided based on the geographic locations of the target objects, for any one of the target areas, a boundary area directly adjacent to the target area is determined, and the related data of the target object in the boundary area is stored in the target data slice corresponding to the target area as redundant data.
Exemplarily, fig. 4 is a schematic diagram of a target area and a boundary area provided in an embodiment of the present invention. As shown in fig. 4, based on the geographic location, the plurality of target objects may be divided into 4 target areas, target area 1, target area 2, target area 3, and target area 4, respectively. For target area 1, the neighbor areas adjacent to target area 1 include target area 2, target area 3, and target area 4. Based on the maximum recall range 402 of a nearby store, a preset proportion of the boundary area to the neighbor area may be determined, or the size of the boundary area may be determined directly based on the maximum recall range 402, in fig. 4, a boundary area 401 is shown in a form of a dashed line frame, where an area formed by four points of an ABCD is a boundary area of a target area 1 and the target area 1, and then related data of a target object in the area formed by the ABCD may be stored in the same target data slice, so as to implement redundant storage of boundary merchant data. Therefore, when the user is near the boundary between the target areas, only one target data fragment is required to be accessed for inquiring and acquiring data, the problem of data integrity requested by the boundary user can be perfectly solved, and meanwhile, the adjacent areas do not need to be processed for two times or more times, so that the system performance requirement of a large amount of data and a high concurrency scene is met.
And step S23, storing the related data of each target object in the target area and the related data of each target object in the boundary area into the same target data slice.
In the embodiment of the invention, after the target area and the boundary area corresponding to the target area are determined, the related data of each target object in the target area and the boundary area can be stored in the same target data fragment, so that redundant storage of the data of the boundary area is realized.
In the embodiment of the invention, the geographic position of each target object is determined, and each target object is divided into a plurality of target areas according to the geographic position; for any one target area, determining a neighbor area adjacent to the target area, and determining a boundary area in the neighbor area; the boundary area is an area which is directly adjacent to the target area in the neighbor area and occupies a preset proportion of the neighbor area; and storing the related data of each target object in the target area and the related data of each target object in the boundary area into the same target data fragment. Therefore, by redundantly storing the boundary data, the problem of incomplete data when a user searches nearby the boundary can be solved, access to a plurality of data fragments is avoided, and the data acquisition efficiency is improved.
Illustratively, fig. 5 is a schematic diagram of a storage range of a target data slice according to an embodiment of the present invention. As shown in the left side of fig. 5, if a target area corresponds to a storage manner of area data fragments, when a user (black solid circles in fig. 5) sends a target data acquisition request near a boundary between target areas, since the LBS maximum recall range 501 searched by the user spans multiple areas, namely, area fragment 1, area fragment 2, and area fragment 3, if a data query is performed on only one area fragment, there is obviously a problem of incomplete data. Therefore, when performing area routing for a target data acquisition request of a user, multiple processes need to be performed on adjacent areas, that is, data query processing is performed in area segment 1, area segment 2, and area segment 3, and then a union set of result data acquired in 3 area segments is returned to the user as final target data. This approach obviously requires two or more processes to the adjacent areas, and the data query efficiency is not high.
In the embodiment of the present invention, as shown in the right side of fig. 5, the storage range of the target data slice 502 includes the target area 1 and a boundary area around the target area 1. The target area 1 may be used as a data query use area of a user side, that is, a target data obtaining request with a current geographic location in the target area 1 may be routed to the target data segment 502 via an area. The boundary of the target area 1 may also be referred to as a data query boundary, i.e. a target data acquisition request within this target area boundary will be routed to the server storing the target area merchant-related data. The data storage boundary of target data shard 502 may be used to characterize entities (merchant stores) within the data storage boundary to be stored in the same server, i.e., the same target data shard. As is apparent from fig. 5, the range of data storage boundaries is greater than the range of data query boundaries. Therefore, the data range stored by the data query boundary is the data in the data storage boundary region larger than the boundary, so that the problem of data integrity requested by a boundary user can be solved, and meanwhile, the adjacent target region does not need to be processed for two times or more, the data acquisition efficiency is improved, and the system resources are saved.
Optionally, in the embodiment of the present invention, step S21 may specifically include the following steps S211 to S212:
step S211, determining a region to which each target object belongs based on a preset region classification level.
In the embodiment of the present invention, the region classification level may refer to various preset region classes of region classification. The higher the region classification level is, the higher the fineness of the region classification is, and the smaller the geographical range covered by the region corresponding to the region classification level is. For example, the geographical division levels may be cells, streets, administrative districts and the like from low to high. Of course, the region classification level may also include other types of classification levels, which is not limited in the embodiment of the present invention.
And step S212, dividing the target objects with the same region into the same target area.
In the embodiment of the invention, after the region to which each target object belongs is determined, a plurality of target objects in the same region can be divided into the same target region, so that the geographic positions of the target objects in the same target region are ensured to be close.
In one implementation, when a merchant is partitioned and online data storage is performed, one data fragmentation mode is packet storage based on sequence numbers. For example, assuming that there are 100 stores, the relevant data of the merchants with serial numbers 1 to 10 are stored in data segment 1, the relevant data of the merchants with serial numbers 11 to 20 are stored in data segment 2, the relevant data of the merchants with serial numbers 21 to 30 are stored in data segment 3, and so on. If it is determined that 2, 15, 25 merchant-related data needs to be obtained based on the geographic location of the user, three data fragments need to be read and then aggregated and combined. The data fragmentation has a single division mode and low data acquisition efficiency.
In the embodiment of the invention, the regions to which the target objects belong are determined based on the preset region division levels, then the target objects with the same regions to which the target objects belong are divided into the same target area, then the merchant related data of the target area and the boundary area of the target area are stored in the same target data fragment, and then after a target data acquisition request of a user is received, only one target data fragment is needed to inquire and acquire the data, so that the data acquisition efficiency is improved, and the waiting time of the user is reduced to a certain extent.
Optionally, before the step 101, the data acquiring method may include the following steps S31 to S32:
step S31, determining the latitude and longitude of each target area boundary point for an area set composed of a plurality of target areas.
In this embodiment of the present invention, the region set may refer to a region set composed of a plurality of target regions. The boundary point may refer to an end point corresponding to the target area.
In this step, after the plurality of target areas are obtained by division, for an area set composed of the plurality of target areas, the longitude and latitude of each boundary point may be determined with the boundary point of each target area as an anchor point, and then grouping may be performed based on the longitude and latitude.
Step S32, grouping each target area according to the longitude and latitude of the target area boundary point, respectively, to establish M longitude groups in the longitude direction and N latitude groups in the latitude direction; the M, N are all positive integers greater than 1.
In the embodiment of the present invention, the longitude grouping may refer to grouping of target areas in the longitude direction. The latitude grouping may refer to grouping of target areas in a latitude direction. The process of determining a target area and determining target data segments based on the current geographic location of the target user may be simplified to a given point determining which plane of the scene the point belongs to. In this step, after the boundary points of each target area are determined, the target area sets may be grouped from the directions of longitude and latitude by using the longitude and latitude of the boundary points as anchor points. In this way, compared with the determination of the target area based on the two-dimensional coordinate composed of two points of longitude and latitude, the embodiment of the present invention simplifies the problem of determining which plane the point belongs to by giving one point in the longitude and latitude to the problem of determining which interval the value belongs to, and does not need to perform overall calculation on the two-dimensional coordinate, and only needs to determine in which group the longitude and the latitude respectively fall, thereby realizing the dimension reduction processing of the query process and facilitating the subsequent search process.
Illustratively, fig. 6 is a schematic diagram of grouping target areas according to an embodiment of the present invention. As illustrated in fig. 6, the region set 601 is composed of target regions 1 to 8. For the area set 601, the boundary points of the target areas include 6 anchor points X1 to X6 in the longitudinal direction, and therefore, the target areas may be grouped based on the 6 anchor points. As shown in fig. 6, the area set is divided into 5 groups in the longitudinal direction, and each longitudinal group includes a plurality of target areas therein. Similarly, the boundary points of the target areas include 5 anchor points Y1 to Y5 in the longitudinal direction, and therefore, the target areas may be grouped based on the 5 anchor points. As shown in fig. 6, the region set is divided into 4 groups in the latitudinal direction. Therefore, in the subsequent searching process, the longitude group and the latitude group which the real-time geographic position belongs to can be respectively determined based on the longitude and the latitude of the real-time geographic position, and then the target area and the target data fragment corresponding to the target area are determined, so that the query efficiency is obviously improved.
In the embodiment of the invention, for an area set consisting of a plurality of target areas, determining the longitude and latitude of each boundary point of the target areas; and grouping the target areas according to the longitudes and latitudes of the boundary points of the target areas respectively so as to establish M longitude groups in the longitudinal direction and N latitude groups in the latitudinal direction. In this way, by performing longitude grouping and latitude grouping, two-dimensional coordinate operation can be simplified into one-dimensional numerical operation, dimension reduction processing on two-dimensional coordinates is realized, and the speed of subsequent data query can be increased.
Optionally, in the embodiment of the present invention, after the step S32, the data acquiring method may further include the following steps S42 to S43:
step S42 determines, as the index unit distance, the distance between two boundary points that are closest to each other for the longitude direction and the latitude direction, respectively.
In the embodiment of the present invention, the index unit distance may refer to a step size of data search. In the longitudinal direction, the index unit distance may refer to the longitudinal distance between two nearest boundary points; in the dimension direction, the index unit distance may refer to the latitudinal distance between the two closest boundary points. Indexes can be added to the longitude groups and the latitude groups based on the index unit distance, namely, the groups are further refined, the data query speed is further improved, and the query complexity is reduced.
Step S43, taking the index unit distance as a step, establishing P longitude sub-groups with the same step in the longitude direction and Q latitude sub-groups with the same step in the latitude direction; wherein P is a positive integer greater than M, and Q is a positive integer greater than N.
In the embodiment of the present invention, the longitude sub-packet may refer to each packet in the longitude direction after the secondary packet. The dimension sub-grouping may refer to each grouping in the latitudinal direction after the secondary grouping. After grouping based on index unit distance, the number of longitude sub-packets is significantly greater than the number of longitude packets, i.e., P is greater than M, and likewise, the number of latitude sub-packets is significantly greater than the number of latitude packets, i.e., Q is greater than N.
In this step, after dividing a plurality of target areas in an area set into M longitude groups and N latitude groups based on the longitudes and latitudes of the boundary points, since the values of the longitudes and latitudes of the boundary points are uncertain, the data length of each group, i.e., the size of the grouped interval, is not uniform, so that in the subsequent search, the search can be performed only based on the existing longitude points and latitude points, and cannot cover all the values of the longitudes and latitudes, and the search efficiency is low.
In the embodiment of the present invention, the longitude distance between two nearest boundary points in the longitude direction is used as the index unit distance, and the index unit distance is used as the step length to further divide the M longitude groups into P longitude sub-groups; and taking the latitude distance of two nearest boundary points in the latitude direction as an index unit distance, taking the index unit distance as a step length, and further dividing the N latitude groups into Q latitude sub-groups. Therefore, the longitude grouping and the latitude grouping with uneven numerical distribution can be divided into the longitude sub-grouping and the latitude sub-grouping with even numerical distribution, all longitude and latitude numerical values can be covered, and the query speed is higher.
It should be noted that, if the index unit distance cannot be too large or too small, and if the index unit distance is too small, the number of sub-packets obtained by division is large, and the data storage capacity is large; index unit distances are too large and may occur across multiple packets. According to the embodiment of the invention, the distance between the nearest boundary points is taken as the distance of the index unit, so that the data processing amount and the storage amount can be reduced while the accuracy is ensured.
In the embodiment of the invention, aiming at the longitude direction and the latitude direction, the distance between two boundary points which are nearest to each other is respectively determined and used as the index unit distance; and establishing P longitude sub-groups with the same step size in the longitude direction and Q latitude sub-groups with the same step size in the latitude direction by taking the index unit distance as a step size. In this way, by adding indexes to the longitude and latitude groups, that is, dividing the sub-groups based on the index unit distance, the query complexity can be reduced, and the query efficiency can be improved.
Accordingly, in the embodiment of the present invention, after the step 101, the data acquiring method may include the following steps S51 to S54:
and step S51, determining the current longitude and the current latitude corresponding to the current geographic position.
In the embodiment of the present invention, the current longitude and the current latitude may refer to specific values of the longitude and latitude of the current geographic location where the target user is located. The value may be obtained based on a GPS module of the electronic device.
And step S52, determining a target longitude sub-packet from the P longitude sub-packets according to the current longitude.
In this embodiment of the present invention, the target longitude sub-packet may refer to a longitude sub-packet corresponding to the current geographic location of the target user. Specifically, in the determination, the target longitude sub-group in which the current longitude is located may be determined based on a magnitude relationship between the current longitude and the index unit distance.
And step S53, determining a target latitude sub-group from the Q latitude sub-groups according to the current latitude.
In the embodiment of the present invention, the target latitude sub-group may refer to a latitude sub-group corresponding to the current geographic location of the target user. Specifically, in the determination, the target latitude sub-group at which the current latitude is located may be determined based on a magnitude relationship between the current latitude and the index unit distance.
And step S54, determining a target area to which the current geographic position belongs based on the target longitude sub-group and the target latitude sub-group.
In the embodiment of the present invention, after the target longitude sub-packet and the target latitude sub-packet are determined, based on the target longitude sub-packet and the target latitude sub-packet, and based on the correspondence between the target longitude sub-packet and the target latitude sub-packet and the target area, the target area to which the current geographic position belongs is determined, and then the target data segment is determined.
Exemplarily, fig. 7 is a schematic diagram of a sub-packet division provided by an embodiment of the present invention. As shown in fig. 7, for a specific scenario in which interval a number is found, if the search is performed with a conventional binary query for longitude and latitude packets, the time complexity is o (logn). This temporal complexity can be used to qualitatively describe the runtime of the query algorithm, usually represented by a large O symbol. Taking the longitude direction as an example, after the longitude packet 701 is marked off by the longitude anchor based on the boundary point, 4 longitude packets of 0 to 3, 3 to 5, 5 to 10, and 10 to 14 (all of which are left-closed and right-open intervals) can be obtained, and when performing binary query, the query process is as follows:
firstly, judging whether the current longitude is greater than a middle longitude numerical value of 5, if so, searching in two longitude groups of 5-10 and 10-14, and if not, searching in two longitude groups of 0-3 and 3-5. And then, judging whether the current longitude is larger than the middle longitude numerical value 10 or not for the two longitude groups of 5-10 and 10-14, if so, determining that the current longitude belongs to the longitude group of 10-14, and if not, determining that the current longitude belongs to the longitude group of 5-10. And judging whether the current longitude is larger than the middle longitude numerical value 3 or not for the two longitude groups of 0-3 and 3-5, if so, determining that the current longitude belongs to the longitude groups of 3-5, and if not, determining that the current longitude belongs to the longitude groups of 0-3. Therefore, compared with the calculation of two-dimensional coordinates, the method for dividing longitude groups and latitude groups, namely performing dimensionality reduction and then performing query in the embodiment of the invention can achieve the effect of improving the query speed.
In order to further improve the query speed and further reduce the time complexity of the algorithm, the embodiments of the present invention respectively use the longitude distances of two nearest boundary points in the longitude direction as the index unit distance to create a hash index for the longitude packets, i.e., to divide the longitude sub-packets, and based on the longitude sub-packets, the time complexity can be improved to O (1), thereby greatly improving the query speed. As shown in fig. 7, in the longitudinal direction, longitude values of two boundary points that are closest to each other are 3 and 5, respectively, and a longitudinal distance 2 therebetween is an index unit distance in the longitudinal direction. And the index unit distance 2 is taken as a group, 4 longitude groups are divided into 7 longitude sub-groups, and during subsequent query, the group to which the current longitude belongs can be determined only by determining the ratio of the current longitude to the index unit distance, so that the query speed is further improved. In the case of storing an array, the numbers 0, 3, 5, 10 and 14 are stored in the array, so that the numbers cannot be covered to a plurality of numbers on the left and right, and after a plurality of longitude sub-groups are divided by adding indexes, all the numbers can be covered, so that the query speed is higher.
Optionally, in the embodiment of the present invention, step S52 may specifically include the following steps S521 to S523:
step S521, determining the ratio of the current longitude to the step length, and rounding the ratio upwards to obtain a target step number X; and X is a positive integer greater than 0.
In this embodiment of the present invention, the target step number may refer to a distance between a target longitude sub-packet to which the current longitude belongs and the first target longitude sub-packet.
And S522, sequencing the P longitude sub-packets in an ascending order according to the longitude sizes to obtain a sequencing result.
In the embodiment of the present invention, the P longitude sub-packets may be sorted in ascending order according to the size of the longitude, and then the target longitude sub-packet may be determined according to the sorting result and the target step number X.
Step S523, select the xth longitude sub-packet from the sorting result as the target longitude sub-packet.
In the embodiment of the present invention, in the sorting result, based on the target step number X, it may be directly determined that the xth longitude sub-packet is the target longitude sub-packet. Exemplarily, taking the longitude sub-packet 702 in fig. 7 as an example, if the current longitude is 9, rounding up the ratio of the current longitude 9 to the index unit distance 2 to obtain the target step number 5, and then sorting the longitude sub-packets in ascending order according to the longitude size, where the 5 th longitude sub-packet is 8 to 10, that is, the target longitude sub-packet. Thus, the section to which the current longitude belongs can be accurately and directly determined.
Fig. 8 is a block diagram of a data acquisition apparatus according to an embodiment of the present invention, where the apparatus 80 may include:
a first obtaining module 801, configured to obtain a current geographic location of a target user when a target data obtaining request sent by the target user is received;
a first determining module 802, configured to determine, based on the current geographic location, a target data segment corresponding to a target area to which the current geographic location belongs; the target data fragment stores the target area and related data in a boundary area, and the boundary area is adjacent to the target area;
the query module 803 is configured to query the target data in the related data in the target data segment based on the target data obtaining request, and return the target data to the target user.
In summary, the data obtaining apparatus provided in the embodiment of the present invention obtains the current geographic location of the target user when receiving the target data obtaining request sent by the target user; determining a target data fragment corresponding to a target area to which the current geographic position belongs based on the current geographic position; the target data fragment is stored with a target area and related data in a boundary area, and the boundary area is adjacent to the target area; and inquiring the target data in the related data in the target data fragment and returning the target data to the target user based on the target data acquisition request. Compared with the mode of grouping the merchant data according to the serial number and storing the merchant data on line, the method and the device for searching the merchant data in the geographic area have the advantages that the merchant data in the same geographic area are stored in the same data server, and the merchant data in the boundary area are stored in a redundant mode, so that a user only needs to search and inquire in the same target data fragment when searching the merchant data based on the geographic position, search request quantity of the user is reduced, network resources are saved, and data acquisition efficiency is improved.
Optionally, the apparatus 80 further comprises:
the dividing module is used for determining the geographic position of each target object and dividing each target object into a plurality of target areas according to the geographic position;
a second determination module, configured to determine, for any one target area, a neighbor area adjacent to the target area, and determine a boundary area in the neighbor area; the boundary area is an area which is directly adjacent to the target area in the neighbor area and occupies a preset proportion of the neighbor area;
and the storage module is used for storing the related data of each target object in the target area and the related data of each target object in the boundary area into the same target data fragment.
Optionally, the apparatus 80 further comprises:
the third determining module is used for determining the longitude and latitude of each target area boundary point for an area set formed by a plurality of target areas;
the first grouping module is used for grouping the target areas according to the longitudes and latitudes of the boundary points of the target areas respectively so as to establish M longitude groups in the longitudinal direction and N latitude groups in the latitudinal direction; the M, N are all positive integers greater than 1.
Optionally, the apparatus 80 further comprises:
a fourth determining module, configured to determine, for the longitude direction and the latitude direction, a distance between two boundary points that are closest to each other, as an index unit distance;
the second grouping module is used for establishing P longitude sub-groups with the same step length in the longitude direction and establishing Q latitude sub-groups with the same step length in the latitude direction by taking the index unit distance as the step length; wherein P is a positive integer greater than M, and Q is a positive integer greater than N.
Optionally, the apparatus 80 further comprises:
a fifth determining module, configured to determine a current longitude and a current latitude corresponding to the current geographic location;
a sixth determining module, configured to determine a target longitude sub-packet from the P longitude sub-packets according to the current longitude;
a seventh determining module, configured to determine a target latitude sub-packet from the Q latitude sub-packets according to the current latitude;
an eighth determining module, configured to determine, based on the target longitude sub-group and the target latitude sub-group, a target area to which the current geographic location belongs.
Optionally, the dividing module is specifically configured to:
determining the region to which each target object belongs based on a preset region classification grade;
and dividing the target objects with the same region into the same target area.
Optionally, the sixth determining module is specifically configured to:
determining the ratio of the current longitude to the step length, and rounding the ratio upwards to obtain a target step number X; x is a positive integer greater than 0;
sequencing the P longitude sub-groups in an ascending order according to the longitude sizes to obtain a sequencing result;
selecting the Xth longitude sub-packet from the sorting result as the target longitude sub-packet.
The present invention also provides an electronic device, see fig. 9, including: a processor 901, a memory 902 and a computer program 9021 stored on and executable on the memory, which when executed by the processor implements the data acquisition method of the foregoing embodiments.
The present invention also provides a readable storage medium, wherein the instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to execute the data acquisition method of the foregoing embodiment.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the invention and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be appreciated by those skilled in the art that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in a sequencing device according to the present invention. The present invention may also be embodied as an apparatus or device program for carrying out a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method of data acquisition, comprising:
under the condition of receiving a target data acquisition request sent by a target user, acquiring the current geographic position of the target user;
determining a target data fragment corresponding to a target area to which the current geographic position belongs based on the current geographic position; the target data fragment stores the target area and related data in a boundary area, and the boundary area is adjacent to the target area;
and inquiring target data in related data in the target data fragment based on the target data acquisition request, and returning the target data to the target user.
2. The method of claim 1, wherein prior to obtaining the current geographic location of the target user, the method further comprises:
determining the geographic position of each target object, and dividing each target object into a plurality of target areas according to the geographic position;
for any one target area, determining a neighbor area adjacent to the target area, and determining a boundary area in the neighbor area; the boundary area is an area which is directly adjacent to the target area in the neighbor area and occupies a preset proportion of the neighbor area;
and storing the related data of each target object in the target area and the related data of each target object in the boundary area into the same target data fragment.
3. The method of claim 1 or 2, wherein prior to said obtaining the current geographic location of the target user, the method further comprises:
determining the longitude and latitude of each target area boundary point for an area set consisting of a plurality of target areas;
grouping the target areas according to the longitudes and latitudes of the boundary points of the target areas respectively so as to establish M longitude groups in the longitudinal direction and N latitude groups in the latitudinal direction; the M, N are all positive integers greater than 1.
4. The method of claim 3, wherein after establishing M longitudinal groups in a longitudinal direction and N latitudinal groups in a latitudinal direction, the method further comprises:
respectively determining the distance between two boundary points which are closest to each other in terms of the longitude direction and the latitude direction, and taking the distance as an index unit distance;
establishing P longitude sub-groups with the same step length in the longitude direction and Q latitude sub-groups with the same step length in the latitude direction by taking the index unit distance as the step length; wherein P is a positive integer greater than M, and Q is a positive integer greater than N.
5. The method of claim 4, wherein after obtaining the current geographic location of the target user, the method further comprises:
determining a current longitude and a current latitude corresponding to the current geographic position;
determining a target longitude sub-packet from the P longitude sub-packets according to the current longitude;
determining a target latitude sub-packet from the Q latitude sub-packets according to the current latitude;
determining a target area to which the current geographic location belongs based on the target longitude sub-packet and the target latitude sub-packet.
6. The method of claim 2, wherein said dividing each of said target objects into a plurality of target regions according to said geographic location comprises:
determining the region to which each target object belongs based on a preset region classification grade;
and dividing the target objects with the same region into the same target area.
7. The method of claim 5, wherein said determining a target longitude sub-packet among said P longitude sub-packets based on said current longitude comprises:
determining the ratio of the current longitude to the step length, and rounding the ratio upwards to obtain a target step number X; x is a positive integer greater than 0;
sequencing the P longitude sub-groups in an ascending order according to the longitude sizes to obtain a sequencing result;
selecting the Xth longitude sub-packet from the sorting result as the target longitude sub-packet.
8. A data acquisition apparatus, comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring the current geographic position of a target user under the condition of receiving a target data acquisition request sent by the target user;
a first determination module, configured to determine, based on the current geographic location, a target data segment corresponding to a target area to which the current geographic location belongs; the target data fragment stores the target area and related data in a boundary area, and the boundary area is adjacent to the target area;
and the query module is used for querying the target data in the related data in the target data fragment based on the target data acquisition request and returning the target data to the target user.
9. An electronic device, comprising:
processor, memory and computer program stored on the memory and executable on the processor, characterized in that the processor implements the data acquisition method according to one or more of claims 1-7 when executing the program.
10. A readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the data acquisition method of one or more of claims 1-7.
CN202111323082.XA 2021-11-09 2021-11-09 Data acquisition method and device, electronic equipment and readable storage medium Pending CN114116931A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111323082.XA CN114116931A (en) 2021-11-09 2021-11-09 Data acquisition method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111323082.XA CN114116931A (en) 2021-11-09 2021-11-09 Data acquisition method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN114116931A true CN114116931A (en) 2022-03-01

Family

ID=80377768

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111323082.XA Pending CN114116931A (en) 2021-11-09 2021-11-09 Data acquisition method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN114116931A (en)

Similar Documents

Publication Publication Date Title
Cheng et al. Task assignment on multi-skill oriented spatial crowdsourcing
US9241240B2 (en) Techniques for server-controlled tiling of location-based information
CN104867065B (en) Method and equipment for processing order
US20190028836A1 (en) Determining timing for determination of applicable geo-fences
US20080222057A1 (en) Method and apparatus for fusing context data
CN107092623B (en) Interest point query method and device
CN101370025A (en) Storing method, scheduling method and management system for geographic information data
WO2013106856A1 (en) Place heat geometries
CN105608159B (en) The method and apparatus of data buffer storage
US20130205196A1 (en) Location-based mobile application marketplace system
CN108009205B (en) Search result caching method based on position, search method, client and system
CN110069579A (en) Fence method of partition and device
CN108021333B (en) System, device and method for randomly reading and writing data
CN111861296A (en) Piece collecting task allocation method and device, piece collecting system, equipment and medium
CN107798135B (en) Paging query method and device and electronic equipment
CN110888866A (en) Data expansion method and device, data processing equipment and storage medium
CN106210163A (en) IP address-based localization method and device
CN111641924B (en) Position data generation method and device and electronic equipment
Stojanovic et al. High performance processing and analysis of geospatial data using CUDA on GPU
CN110427574B (en) Route similarity determination method, device, equipment and medium
Tadakaluru Context optimized and spatial aware dummy locations generation framework for location privacy
CN114116931A (en) Data acquisition method and device, electronic equipment and readable storage medium
Liu et al. A common subgraph correspondence mining framework for map search services
CN115795097A (en) Data processing method and device based on XML (extensive Makeup language) logic rule
EP3915280B1 (en) Intelligent geofence provisioning

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