A method, server and electronic device for downloading geofence data
By sending incremental geofence data to electronic devices via a server, the problem of time-consuming and data-intensive downloads on mobile phones is solved, enabling more efficient data updates.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-05-31
- Publication Date
- 2026-07-10
Smart Images

Figure CN121099302B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method for downloading geofence data, a server, and an electronic device. Background Technology
[0002] Geofencing refers to using a virtual fence to enclose a virtual geographic boundary; it's an application of location-based services (LBS). When an electronic device (such as a mobile phone) enters or leaves a geofence, the phone can receive automatic notifications, triggering pre-subscribed activities or accessing customized location-based services. Servers can periodically generate new datasets. Mobile phones can download datasets from the server and update their existing datasets using the downloaded datasets. This dataset includes at least one geofence entry.
[0003] However, when a mobile phone downloads data, it downloads the entire dataset generated by the server, resulting in a longer download time and higher network resource consumption. Furthermore, as the number of services increases, the number of geofences also increases, further making mobile downloads more time-consuming and data-intensive. Summary of the Invention
[0004] This application provides a method, server, and electronic device for downloading geofence data to reduce download time.
[0005] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:
[0006] In a first aspect, a method for downloading a dataset is provided, characterized in that it is applied to a server. The method includes: receiving a download request sent by an electronic device; the download request includes version information of a first dataset currently stored in the electronic device; sending target incremental data to the electronic device; the target incremental data includes one or more of the following: geofence information added to the second dataset compared to the first dataset, updated geofence information, and deleted geofence information. Both the first dataset and the second dataset include at least one piece of geofence information.
[0007] In this application, after receiving a download request from an electronic device, the server can send incremental data between the first dataset and the second dataset currently stored in the electronic device, which helps to reduce the download time and save download bandwidth.
[0008] In one possible implementation of the first aspect, the server stores multiple versions of the dataset and first incremental data and second incremental data corresponding to each version of the dataset; the multiple versions of the dataset include the first dataset and the second dataset.
[0009] When the first dataset is a previous version of the second dataset, the target incremental data is the first incremental data corresponding to the first dataset among multiple versions of the dataset. The first incremental data is used to update the corresponding version of the dataset to the next version of the dataset.
[0010] Specifically, the target incremental data is generated by the server based on the first geofence information and the third geofence information used in this update. The newly added geofence information in the target incremental data consists of third geofence information in the third dataset that does not match any of the first geofence information. The deleted geofence information in the target incremental data consists of first geofence information in the first dataset that does not match any corresponding second geofence information. The updated geofence information in the target incremental data consists of second geofence information in the third dataset that matches each of the first geofence information one-to-one, and the first geofence information and its corresponding second geofence information are inconsistent.
[0011] When the first and second datasets differ by multiple versions, the target incremental data is the second incremental data corresponding to the first and second datasets among the multiple versions of the dataset. The second incremental data is used to update a corresponding version of the dataset to the next n versions, where n is an integer greater than or equal to 2.
[0012] In one possible implementation of the first aspect, for one version of the multiple versions of the dataset, the following method is executed to obtain a version of the dataset and the corresponding incremental data: generating a third dataset based on the collected crowdsourced data; comparing the fence information dataset and the third fence information dataset to generate incremental data corresponding to the fence information dataset; updating the fence information dataset based on the incremental data corresponding to the fence information dataset to obtain the next version of the dataset. This implementation provides a method for generating multiple versions of the dataset and the incremental data corresponding to multiple versions.
[0013] In one possible implementation of the first aspect, each first geofence in the fence information dataset is traversed, and a corresponding second geofence is matched one-to-one with each first geofence in the third fence information dataset. The first and corresponding second geofences indicate the same geofence. If a first geofence matches a corresponding second geofence, it is determined whether the first and second geofences are consistent. If they are inconsistent, the corresponding second geofence is identified as an updated geofence. If no second geofence is matched, the first geofence is identified as a deleted geofence. After the fence information traversal is complete, if a third geofence in the third fence information dataset does not match any first geofence, it is identified as a newly added geofence. This implementation provides a method for generating multiple versions of the dataset and corresponding incremental data for each version.
[0014] In one possible implementation of the first aspect, if the first geofence information does not match a corresponding second geofence information, and the time elapsed between the generation time and the current update time of the first geofence information exceeds a preset time, the first geofence information is identified as a deleted geofence information. This implementation provides a method for generating multiple versions of the dataset and incremental data corresponding to multiple versions.
[0015] In one possible implementation of the first aspect, each first geofence piece of information in the fence information dataset is traversed, and a first association relationship corresponding to the first geofence piece of information is obtained based on the third geofence information dataset. This first association relationship indicates the correspondence between the first geofence piece of information and third geofence pieces in the third geofence information dataset whose similarity to the first geofence piece of information is greater than a threshold. If the first association relationship is obtained, a second association relationship is obtained. This second association relationship indicates the correspondence between the first geofence piece of information and a fourth geofence piece of information. The fourth geofence piece of information is the third geofence piece of information with the highest similarity to the first geofence piece of information among the third geofence pieces whose similarity to the first geofence piece of information is greater than a threshold. Based on the first and second association relationships, a one-to-one matching second geofence piece of information is established for each first geofence piece of information. This implementation provides a method for generating multiple versions of the dataset and incremental data corresponding to multiple versions.
[0016] In one possible implementation of the first aspect, the first and second geofence information associations are updated according to preset conditions. The fourth geofence information in the second association when updating stops is used as the second geofence information that matches the first geofence information one-to-one. The preset condition for the geofence information is that different second associations include situations where both the fourth and first geofence information are different.
[0017] In one possible implementation of the first aspect, if the first geofence information does not match a third geofence information with a similarity greater than a threshold, or if the first geofence information matches a third geofence information with a similarity greater than a threshold, but there are other first geofence information and the third geofence information with a similarity greater than the similarity between the first geofence information and the third geofence information, then it is identified that the first geofence information does not match the corresponding second geofence information.
[0018] In one possible implementation of the first aspect, if the third geofence information in the third dataset of fence information does not match the first geofence information with a similarity greater than a threshold, or if the third geofence information matches the first geofence information with a similarity greater than a threshold, but there are other third geofence information with a similarity greater than the first geofence information, then the third geofence information is identified as newly added geofence information.
[0019] In one possible implementation of the first aspect, the geofence information in the fence information dataset and the corresponding incremental data includes an identifier, which is used to identify the geofence corresponding to the geofence information.
[0020] In one possible implementation of the first aspect, the fence information identifier includes a first code and a first serial number; the first code of the fence information is related to the information of the geographic fence corresponding to the geographic fence information.
[0021] Secondly, a method for downloading a dataset is provided, applied to an electronic device. The method includes: sending a download request; the geofencing information download request includes version information of a first dataset currently stored in the electronic device; receiving target incremental data; the target incremental data includes one or more of the following: newly added geofencing information, updated geofencing information, and deleted geofencing information in the second dataset compared to the first dataset; and updating the first dataset based on the target incremental data. Both the first and second datasets include at least one geofencing information entry.
[0022] In this application, the electronic device can download incremental data between the first dataset and the second dataset currently stored in the electronic device from the server, which helps to reduce the download time of the electronic device.
[0023] In one possible implementation of the second aspect, the geofence information in the first dataset and the incremental geofence information target data includes an identifier. This geofence identifier is used to identify the geofence corresponding to the geofence information. The geofence identifier uniquely identifies a geofence, and with the geofence identifier, the dataset can be updated based on it.
[0024] In one possible implementation of the second aspect, newly added geofence information is added to the first geofence information dataset; geofence information updated using the geofence information is used to replace geofence information with the same identifier in the first geofence information dataset; geofence information deleted using the geofence information is deleted from the first geofence information dataset based on the identifier.
[0025] Thirdly, a server is provided, comprising: a memory, a communication module, and one or more processors; the memory, the communication module, and the processors are coupled; wherein the communication module is used to interact with an electronic device, and the memory is used to store computer program code, the computer program code including computer instructions; when the computer instructions are executed by the processor, the server performs the method as described in the first aspect.
[0026] Fourthly, an electronic device is provided, comprising: a memory, a communication module, and one or more processors; the memory, the communication module, and the processors are coupled; wherein the communication module is used to interact with the electronic device, and the memory is used to store computer program code, the computer program code including computer instructions; when the computer instructions are executed by the processor, the server performs the method as described in the second aspect.
[0027] Fifthly, this application provides a chip system applicable to electronic devices including memory. The chip system includes one or more interface circuits and one or more processors. The interface circuits and processors are interconnected via lines. The interface circuits are used to receive signals from the aforementioned memory and send the signals to the processors, the signals including computer instructions stored in the memory. When the processor executes the computer instructions, the electronic device performs the method as described in the first aspect and any of its possible design embodiments.
[0028] Sixthly, this application provides a computer-readable storage medium including computer instructions. When the computer instructions are executed on an electronic device, they cause the electronic device to perform a method as described in the first aspect or the second aspect, or any possible design thereof.
[0029] In a seventh aspect, this application provides a computer program product that, when run on a computer, causes the computer to perform a method as described in the first aspect or the second aspect and any possible design thereof.
[0030] Understandably, the beneficial effects that can be achieved by the server of any of the possible designs of the third aspect, the electronic device of any of the possible designs of the fourth aspect, the chip system of the fifth aspect, the computer-readable storage medium of the sixth aspect, and the computer program product of the seventh aspect can be referred to as the beneficial effects in the first aspect and any of its possible designs, which will not be repeated here. Attached Figure Description
[0031] Figure 1 A schematic diagram of the interface display of an electronic device provided in an embodiment of this application;
[0032] Figure 2 This is a schematic diagram illustrating a method for generating fence markers provided in an embodiment of this application;
[0033] Figure 3 This application provides a schematic flowchart of a method for updating geofence data.
[0034] Figure 4 A schematic diagram of a geofencing provided for an embodiment of this application;
[0035] Figure 5 A schematic diagram illustrating a method for establishing a relationship between first geofence information and third geofence information, provided in an embodiment of this application;
[0036] Figure 6 A schematic diagram illustrating another method for establishing the association between first geofence information and third geofence information provided in this application embodiment;
[0037] Figure 7 A schematic diagram of a geofence data download system provided in this application embodiment;
[0038] Figure 8 This is a schematic flowchart of a geofence data download method provided in an embodiment of this application. Detailed Implementation
[0039] To facilitate understanding, the terms used in the embodiments of this application will be introduced first.
[0040] Point of Interest (POI): Typically used to identify a small object. In Geographic Information Systems (GIS), a POI can be a building, a shop, a coffee shop, an oil drum, a gas station, a bus stop, etc. A POI generally includes several basic pieces of information: name, address, category, and location information. The location information can include only the latitude and longitude coordinates of a single location point, or it can include the latitude and longitude of a center point and a radius, where the radius is usually relatively small.
[0041] Crowdsourced data refers to data collected from numerous terminal devices, such as mobile phones, regarding user business behavior. This user business behavior, also known as user business or business in general, can include payment and QR code scanning. Payment business might involve a user scanning a merchant's QR code or a merchant scanning a user's QR code for payment. QR code scanning, based on scanning QR codes or barcodes, can include scanning to enter designated locations, such as high-speed rail stations, airports, train stations, shopping malls, and companies. It can also include scanning to pick up packages at courier stations or scanning to search for items. Utilizing mass networks for data collection is called crowdsourcing. This involves distributing data collection tasks across a large network, effectively utilizing public resources, reducing collection costs, increasing efficiency, and ensuring high timeliness. For example, real-time traffic information on some location maps is collected through crowdsourcing. Users can upload large amounts of vehicle speed and location information to the backend via location software, allowing the backend to analyze the data and generate comprehensive real-time traffic information.
[0042] Regular payment: Payment behavior exhibiting a pattern. For example, if a mobile phone frequently makes payments at a specific time and location, this can be identified as a regular payment. Regular payment patterns can be used to provide users with convenient service functions. For instance, if a user makes regular payments for service A (payment application, merchant service application, etc.) in a target scenario, and it's determined that the phone is connected to Wi-Fi covering the target scenario, then the phone is considered to be within the target scenario. Subsequently, the corresponding quick operation can be performed for service A, thus realizing the function of providing convenient services through scenario recognition.
[0043] Geofencing: A geofencing represents a geographical area within a certain range, which can be used to represent a shop, a tourist attraction, or a commercial area, etc. The server can generate a dataset. The dataset can include at least one geofencing piece of information. Geofencing information can include, for example, geographical identifiers such as city identifiers, shop identifiers, latitude and longitude ranges, the set of covered base stations, the set of Wi-Fi networks, the fence radius, etc. One geofencing piece of information can correspond to one geofencing. For example, Table 1 shows a dataset generated by the server based on crowdsourced data. The dataset shown in Table 1 includes 7 geofencing pieces of information, each corresponding to one geofencing.
[0044] Table 1
[0045]
[0046] As an example, after performing a business action, the mobile phone can upload crowdsourced data to the server. This crowdsourced data can include the mobile phone's business action, such as the central longitude and latitude of the phone when scanning a QR code, the set of base stations and Wi-Fi networks the phone searched for, and the business tag of the action performed. The business tag could be, for example, the name of a shop, such as Shop 1, Shop 2, etc. in Table 1. It could also be the location information of the phone when scanning the QR code, such as a high-speed rail station, a courier station, or a certain building. It should be noted that in this application's technical solution, the mobile phone's upload of crowdsourced data to the server is with the user's personal consent, including but not limited to notifying and reminding the user to read the relevant user agreement (notification) and sign the agreement (authorization) which includes authorizing relevant user information before the user uses this function.
[0047] The server generates and stores geofence information based on crowdsourced data uploaded by mobile phones, such as by using a clustering algorithm to cluster the crowdsourced data to obtain geofence information.
[0048] The mobile phone can download a dataset from the server and store it on the phone. After the phone enables the geofence-based recommendation function, when the phone is located within a geofence corresponding to a specific geofence in the stored dataset, the business server can recommend business information corresponding to that geofence to the phone. This business information could be store discounts, new product launches, etc. For example, after enabling the geofence-based recommendation function, the phone can obtain its current location information, including its current latitude and longitude. Based on this latitude and longitude, the phone can identify the geofence it is currently located within, using the stored dataset.
[0049] For example, such as Figure 1 As shown, when the phone is not within the geofence corresponding to the company cafeteria, for example, when the user is on their way to the company cafeteria, the phone can display the following: Figure 1 The main interface shown in (a) does not include quick access to payment services. When the phone enters the geofence corresponding to the company cafeteria, for example, when a user enters the company cafeteria, the phone can display something like this. Figure 1 The main interface is shown in (b). This main interface includes quick access points for payment services, such as the "Quick Payment" icon 11. It can be seen that after the user enters the geofence corresponding to the company cafeteria, the phone automatically recommends the quick access points for payment services. Then, in response to the user clicking icon 11, the phone can display... Figure 1 The payment interface is shown in (c). After the payment is completed, the phone can display something like this. Figure 1 The interface shown in (d) is shown in the middle.
[0050] In conventional technology, a server can periodically generate a dataset based on crowdsourced data reported by multiple mobile phones within a given period. The newly generated dataset includes multiple newly generated geofence entries. A period could be, for example, one or two months. Mobile phones can download the dataset from the server, replacing the old dataset stored on the phone with the newly downloaded one. However, during the download, the phone downloads all geofence entries from the dataset generated in the latest period, resulting in a long download time and high network resource consumption. Furthermore, as the number of services increases, the number of geofence entries generated in the latest period also increases, further increasing the time and data consumption of the download.
[0051] Therefore, this application provides a geofence data download method applicable to a server. After receiving a download request from an electronic device, the server can send target incremental data to the electronic device. This target incremental data is the incremental data between a first dataset already stored on the electronic device and a second dataset on the server, used to upgrade and update the first dataset to the second dataset. The target incremental data includes one or more of the following: newly added geofence information, updated geofence information, and deleted geofence information in the second dataset compared to the first dataset. Since only target incremental data is sent to the electronic device, the download time of the electronic device can be reduced, saving download bandwidth.
[0052] The following section introduces this solution for mobile phones, which are electronic devices.
[0053] The server can receive download requests from mobile phones. These requests include version information of the first dataset currently stored on the phone; this version information could be, for example, a version number. The server can also send target incremental data to the phone. This target incremental data can include one or more of the following: newly added geofencing information, updated geofencing information, and deleted geofencing information in the second dataset compared to the first dataset. The version number of the first dataset is lower than the version number of the second dataset.
[0054] The first and second datasets include multiple geofencing information. The first dataset or the second dataset can be as shown in Table 2.
[0055] Table 2
[0056]
[0057]
[0058] The server can store multiple versions of a dataset and a first incremental dataset corresponding to each version. The multiple versions of the dataset include a first dataset and a second dataset. That is, the first dataset is one of the multiple versions of the dataset stored on the server, and the second dataset is another of the multiple versions of the dataset stored on the server.
[0059] If the first dataset is the previous version of the second dataset, such as the version number of the first dataset being REV3.0 and the version number of the second dataset being REV4.0, then the target incremental data is the first incremental data corresponding to the first dataset, which is one of the first incremental data corresponding to multiple versions of the dataset.
[0060] If the first dataset is not a previous version of the second dataset, such as the version number of the first dataset being REV2.0 and the version number of the second dataset being REV4.0, the server obtains the target incremental data based on the second dataset and the first dataset.
[0061] Continuing with the previous example, consider this: a server stores a first dataset with version number REV1.0 and its corresponding first incremental data; a first dataset with version number REV2.0 and its corresponding first incremental data; a first dataset with version number REV3.0 and its corresponding first incremental data; and a first dataset with version number REV4.0 and its corresponding first incremental data. If the first dataset is the previous version of the second dataset, the target incremental data is the first dataset with version number REV3.0 and its corresponding first incremental data. This first incremental data is used to upgrade the first dataset with version number REV3.0 to the first dataset with version number REV4.0.
[0062] The server also stores multiple versions of the dataset and corresponding second incremental data for each version. The second incremental data is used to upgrade a dataset version to the next n versions. For example, the server stores second incremental data P24 and second incremental data P25 for the first dataset of REV2.0. Second incremental data P24 is used to upgrade the first dataset of REV2.0 to the first dataset of REV4.0. Second incremental data P25 is used to upgrade the first dataset of REV2.0 to the first dataset of REV5.0. If the first dataset is not a previous version of the second dataset, the server retrieves the corresponding second incremental data based on the version number and uses it as the target incremental data.
[0063] The following section describes the method for generating the first incremental data for multiple versions of the dataset on the server. Each first incremental data includes one or more of the following: newly added geofence information, updated geofence information, and deleted geofence information in the next version of the dataset compared to the corresponding version. The scheme is illustrated using the example of each first incremental data including newly added, updated, and deleted geofence information in the next version of the dataset compared to the corresponding version.
[0064] The geofence information in the first incremental data corresponding to each version of the dataset includes an identifier, which uniquely identifies a geofence corresponding to the geofence information. This identifier can be a fence identifier. For example, the server generates geofence information from the crowdsourced data collected in the first period. After generating the geofence information, the server can generate a fence identifier for the geofence information. The server generates geofence information from the crowdsourced data collected in the first period, and after identifying newly added geofence information, it can generate fence identifiers for them. After identifying updated geofence information, the identifier of the geofence information in the first period that points to the same geofence as the updated geofence information is assigned to the updated geofence information.
[0065] In other words, the geofence information for which a fence identifier needs to be generated can be geofence information generated in any one period but not in other periods. For example, the geofence information for which a fence identifier needs to be generated can be all the geofence information generated in the first period, or a portion of the geofence information generated in the second period, which is geofence information that was not generated in the first period but was generated in the second period.
[0066] The fence identifier includes a first code and a first sequence number, where the first code is related to the geofence information corresponding to the geofence information. For example, the server can perform actions such as... Figure 2 The method shown in 'a' generates fence markers. Figure 2 In this application, 'a' represents a method for generating fence markers, which includes:
[0067] S1, the server encodes the center longitude, center latitude, and business tag in the geofence information to obtain the first code.
[0068] For example, the server can encode the center longitude, center latitude, and business tag in the geofencing information separately, and then concatenate the three encoded values into a first encoding. Alternatively, it can concatenate a portion of the three encoded values into the first encoding. The first encoding can be, for example, ASCII, Unicode, UTF-8, or UTF-16 encoding. The encoding method can be, for example, hash encoding.
[0069] As a feasible implementation method, such as Figure 2As shown in b, the server first encodes the string type corresponding to the business tag into an 8-bit (UTF-8) byte array. The UTF-8 byte array includes at least one UTF-8 byte. One UTF-8 byte consists of 8 bits. Then, the server sums all the bytes in the UTF-8 byte array and converts the sum to hexadecimal. The server takes the last two digits of the hexadecimal result as the encoding of the business tag.
[0070] To reduce the length of the fence marker, the server can convert the center longitude and center latitude into longitude arc length and latitude arc length, respectively. For example, longitude arc length = (π / 180) * center longitude. Latitude arc length = (π / 180) * center latitude. The unit of arc length can be meters. To further reduce the fence marker length, the server divides the longitude arc length by the unit length and rounds it down to obtain the first longitude arc length. It then divides the latitude arc length by the unit length and rounds it down to obtain the first latitude arc length. The unit length can be, for example, 50 meters or 100 meters. The unit length can be pre-stored on the server. The first longitude arc length and the first latitude arc length are encoded into strings, and a portion of each string is extracted. For example, this string can be a decimal string, and the server can extract the last 5 characters. If the length of the encoded first longitude arc length and the first latitude arc length is less than 5 characters, zeros can be padded on the left. Finally, a portion of the encoded first longitude arc length and a portion of the encoded first latitude arc length are combined into a single longitude and latitude code. For example, alternatingly combining the 5 characters of the first longitude arc length and the last 5 characters of the first latitude arc length into 10 characters yields the latitude and longitude code. For instance, the 5 characters of the first longitude arc length could be 01234, the last 5 characters of the first latitude arc length could be abcde, and the resulting 10 characters could be 0a1b2c3d4e.
[0071] Finally, the server concatenates the latitude and longitude codes and the business tag codes to obtain the first code.
[0072] S2, the server adds a first sequence number to the first code to obtain the fence identifier.
[0073] The first sequence number can be, for example, 00, 01, 02, or AA, BB, CC, AB, AC, BC, etc. In some cases, different geofence information may have the same first code. For example, since the first code is derived from the business tag and the converted center longitude and center latitude, multiple shops with the same business tag and relatively dense geographical locations may have the same first code for their geofences. Adding a first sequence number to the first code can better distinguish geofences that are geographically close. The first sequence number can be added to the end or beginning of the first code.
[0074] The server stores a mapping relationship between generated codes and their corresponding serial numbers. For example, the server can use a generated code as a key and its existing serial number as a value in the database. After generating the first code, the server checks if it includes the first code in the existing generated codes. If it does, the server directly reads the corresponding serial number and performs a preset operation on it to obtain the first serial number. The preset operation can be incrementing or decrementing, or incrementing or decrementing by equal steps. Then, the server updates the serial number corresponding to the first code in the mapping relationship to the first serial number, which serves as the basis for determining the corresponding serial number when generating the first code next time. If the generated codes do not include the first code, the server adds a first serial number to the first code, which can be "00". Afterward, the server adds the mapping relationship between the first code and the first serial number to the mapping relationship.
[0075] according to Figure 2 The method shown creates geofence identifiers where geofences with similar geographical locations and the same business type share the same first code. This is beneficial for subsequent statistics and analysis. For example, it facilitates the identification of geofences corresponding to a specific business within a certain geographical area, or geofences corresponding to different businesses within a certain geographical area.
[0076] The following is combined with Figure 3 Taking the example of a dataset with multiple versions being a summary table of multiple versions and the first incremental data corresponding to the dataset with multiple versions being an incremental table, this paper introduces a method for the server to generate the first incremental data corresponding to the dataset with multiple versions.
[0077] The server stores multiple versions of summary tables and corresponding incremental tables for each version. The server can periodically update the summary tables. Specifically, during an update, the server can identify the first incremental data corresponding to the current version of the summary table based on the current version of the summary table and a third dataset. This first incremental data includes newly added, updated, and deleted geofence information compared to the current version of the summary table in the third dataset. Then, based on the first incremental data, the current version of the summary table is updated to the next version. The third dataset may include the latest geofence information generated in the latest period.
[0078] For example, the server generates geofencing information based on the crowdsourcing data collected in the first cycle and summarizes it in the first version of the summary table. The server generates geofencing information and the first version of the summary table based on the crowdsourcing data collected in the second cycle, generates an incremental table corresponding to the first version of the summary table, and uses the incremental table to update the first version of the summary table to the second version of the summary table. Then, the server generates geofencing information based on the crowdsourcing data collected in the third cycle, generates first incremental data based on the second version of the summary table and the newly generated geofencing information from the third cycle, and uses the first incremental data to update the second version of the summary table to the third version of the summary table.
[0079] For one version of a summary table across multiple versions, the following method is used to obtain a summary table and its corresponding incremental table for that version: For each first geofence piece of information in the summary table, the server searches for a corresponding second geofence piece of information in the third dataset. The first geofence piece of information and its corresponding second geofence piece of information indicate the same geofence. Since there is no fence identifier, the server cannot determine whether the newly generated geofence piece of information corresponds to a newly added geofence or an existing geofence, for example, if the geofence information has only been updated. Therefore, the server can find a corresponding second geofence piece of information in the third dataset for existing geofence information (first geofence information).
[0080] For each first geofence piece of information in the current version's summary table, if the server can find a second geofence piece of information that corresponds one-to-one with the first geofence piece of information in the third dataset, then the second geofence piece of information that corresponds one-to-one with the first geofence piece of information is not a newly added geofence piece of information. Furthermore, the server identifies whether there is a difference between these two geofence pieces of information. If there is a difference, the server identifies the second geofence piece of information as an updated geofence piece of information.
[0081] If the server cannot find a second geofence that corresponds one-to-one with the first geofence in the third dataset, the server recognizes that the first geofence may be a geofence to be deleted.
[0082] If, after searching through all the data, the third dataset contains a third geofence that does not match any of the first geofences in the current version's summary table, then this third geofence is a newly added geofence. In other words, if a third geofence exists in the third dataset that does not match any of the first geofences, then this third geofence is a newly added geofence. Newly added geofences are included in the third dataset but not in the current version's summary table.
[0083] like Figure 4 As shown, solid lines represent the geofences corresponding to the first geofence information included in the current version's summary table, and dashed lines represent the geofences corresponding to the third geofence information included in the third dataset. The newly generated dataset is shown in Table 1. Figure 4 In the diagram, region 1 includes geofence 1 and geofence 2. Both geofence 1 and geofence 2 correspond to two geofence entries: the second geofence entry shown by the dashed line and the first geofence entry shown by the solid line. Taking geofence 1 as an example, the two geofence entries corresponding to geofence 1 indicate the same geofence, and these two geofence entries are in a one-to-one correspondence. Therefore, geofence 1 and geofence 2 are not newly added geofences. Similarly, geofence 3 includes corresponding first and second geofence entries; geofence 3 is not a newly added geofence. For any geofence among geofences 1, 2, and 3, the server can further compare the differences between the second geofence entry corresponding to the geofence and the first geofence entry corresponding to the geofence to identify whether the second geofence entry is an updated geofence. Geofences 5, 4, and 7 only correspond to the third geofence entry shown by the dashed line, indicating that geofences 5, 4, and 7 are newly added geofences. Geofences 6 and 8 only correspond to the first geofence entry shown by the solid line, indicating that geofences 6 and 8 may be geofences to be deleted.
[0084] The server can execute Figure 3 The method shown generates an incremental table and updates the summary table for the current version. Figure 3 A method for updating a dataset provided in this application embodiment includes:
[0085] S301, iterate through each first geofence information in the summary table of the current version, and match third geofence information with similarity greater than the threshold from the third dataset based on similarity. There can be one or more third geofence information that match the first geofence information.
[0086] Based on a first condition, the server matches at least one third geofence from a third dataset with a similarity greater than a threshold to the first geofence information. For example, the server can calculate the similarity between the first geofence information and each third geofence in the third dataset, then compare each similarity to a threshold, identifying those with similarities greater than the threshold. The third geofence with a similarity greater than the threshold is the third geofence information that matches the first geofence information. Several examples of calculating the similarity between two geofence pieces of information are given below. A geofence piece of information includes geographic identifiers such as city identifiers, store identifiers, latitude and longitude ranges, the set of covered base stations, the set of Wi-Fi networks, the fence radius, etc.
[0087] For example, a server can calculate the similarity between a second set of base stations and a first set of base stations. This similarity can be used to represent the similarity between two geofencing sets. The second set of base stations is the set of base stations in a third set of geofencing information; the first set of base stations is the set of base stations in a first set of geofencing information. The second set of base stations includes at least one base station identifier. The first set of base stations includes at least one base station identifier. The server can calculate the ratio of the intersection to the union of these two sets to measure their similarity. For example, the server can first count the number of base station identifiers shared by the second and first sets (i.e., the number of base station identifiers included in the intersection). Then, the server can count the number of all base station identifiers included in both sets (i.e., the number of base station identifiers included in the union). Finally, the server calculates the ratio of the number of base station identifiers included in the intersection to the number of base station identifiers included in the union to obtain the similarity. Alternatively, the server can calculate the similarity between the two sets by calculating the cosine distance, Euclidean distance, or other similar methods.
[0088] For example, the server can calculate the similarity between a second Wi-Fi set and a first Wi-Fi set, which can be used to represent the similarity between two geofencing sets. The second Wi-Fi set is the Wi-Fi set in the third geofencing set; the first Wi-Fi set is the Wi-Fi set in the first geofencing set. The second Wi-Fi set includes at least one Wi-Fi identifier. The first Wi-Fi set includes at least one Wi-Fi identifier. The server can calculate the ratio of the intersection to the union of these two sets to measure their similarity. This calculation method is similar to that described above and will not be repeated here. Alternatively, the server can calculate the similarity between the two sets by calculating the cosine distance, Euclidean distance, or other similar methods.
[0089] For example, the server can calculate the intersection-union ratio (IUR) of the second and first geofence areas. This IUR is the similarity score, which can be used to represent the similarity between two geofence pieces of information. It should be understood that a geofence represents a geographical area within a certain range. A geofence includes its radius and center latitude and longitude; therefore, a geofence can represent a circular area centered on the center latitude and longitude with a radius equal to the perimeter of the geofence. The second geofence area is the area of the geofence corresponding to the second geofence information, and the first geofence area is the area of the geofence corresponding to the first geofence information.
[0090] Optionally, to reduce computational load, for a given first geofence, the server can filter out at least one third geofence from the third dataset that meets certain conditions based on the distance between geofences. Then, from the filtered at least one third geofence, at least one third geofence with a similarity greater than a threshold is matched. This condition could be that the distance between the center latitude and longitude of the geofence corresponding to the third geofence and the geofence corresponding to the first geofence is less than a preset distance.
[0091] S302, establish a first association relationship between first geofence information and at least one third geofence information that matches the first geofence information.
[0092] The first association relationship is used to indicate the correspondence between the first geofencing information and third geofencing information in the third dataset whose similarity to the first geofencing information is greater than a threshold.
[0093] The server can record the first association. As one possible implementation, the server can use element identifiers to record the first association. For example, D1 can represent the first element in the current version's summary table, i.e., the first first geofence information. T1 can represent the first third geofence information in the third dataset. For example, the server can record the first association as an array. For instance, [T1, D1, D2, D4] indicates that the third geofence information associated with the first first geofence information is the first third geofence information D1, the second third geofence information D2, and the fourth third geofence information D4 in the third dataset. Among these, the similarity between the third geofence information D1, the second third geofence information D2, and the fourth third geofence information D4 and the first geofence information T1 is greater than a threshold.
[0094] After executing S301-S302, the server can obtain multiple first associations. Each first association corresponds to a first geofence. After obtaining the first associations, the server can obtain second associations. The second associations are used to indicate the correspondence between the first geofence information and the fourth geofence information. The fourth geofence information is the third geofence information with the highest similarity to the first geofence information among the third geofence information whose similarity to the first geofence information is greater than a threshold. For example, the server can execute S303.
[0095] S303, from at least one third geofence information in the first association relationship, identify fourth geofence information, and establish a second association relationship between the first geofence information and the fourth geofence information, wherein the fourth geofence information is the third geofence information with the highest similarity to the first geofence information among at least one third geofence information.
[0096] For at least one third geofence piece of information in the first association relationship, the server obtains the third geofence piece of information most closely related to the first geofence piece of information, and establishes a one-to-one second association relationship between the first geofence piece of information and the third geofence piece of information most closely related to the first geofence piece of information. The third geofence piece of information most similar to the first geofence piece of information is the fourth geofence piece of information.
[0097] For example, regarding the first association, the server can sort at least one third geofence piece of information associated with (or matching) the first geofence information based on similarity. The higher the similarity between the third geofence piece of information and the first geofence piece of information, the higher the ranking of the third geofence piece of information. Then, the third geofence piece of information ranked highest is taken as the fourth geofence piece of information most associated with the first geofence piece of information. If the similarity is the same, the server can further select the third geofence piece of information corresponding to the nearest geofence as the fourth geofence piece of information associated with that first geofence piece of information based on the distance between geofences. In this way, the server can obtain the fourth geofence piece of information associated with the first geofence piece of information.
[0098] Since a first geofence may be associated with at least one third geofence, and a third geofence may be associated with multiple first geofences, there may be situations where different first geofences are associated with the same fourth geofence.
[0099] like Figure 5As shown, the first geofence information T1 matches the third geofence information D1, D2, and D4. The first geofence information T2 matches the third geofence information D2 and D3. The first geofence information T3 matches the third geofence information D3. The first geofence information T4 matches the third geofence information D1. Therefore, the server obtains the following multiple first association relationships: the first geofence information T1 is associated with the third geofence information D1, D2, and D4; the first geofence information T2 is associated with the third geofence information D2 and D3; the first geofence information T3 is associated with the third geofence information D3; and the first geofence information T4 is associated with the third geofence information D1.
[0100] For a first association, the server can obtain fourth geofence information associated with the first geofence information based on similarity and establish a second association. Multiple second associations can be, for example, the association between first geofence information T1 and fourth geofence information D1, the association between first geofence information T2 and fourth geofence information D2, the association between first geofence information T3 and fourth geofence information D3, and the association between first geofence information T4 and fourth geofence information D1. Thus, there are cases where the geofence information associated with first geofence information T1 and first geofence information T4 are both fourth geofence information D1. Optionally, in some embodiments, the same first geofence information may be associated with different fourth geofence information.
[0101] Therefore, the server can update the first and second associations according to preset conditions, and use the fourth geofence information in the second association at the time of stopping the update as the second geofence information that matches the first geofence information one-to-one. The preset condition is that different second associations include those where both the fourth and first geofence information are different.
[0102] Optionally, the server can execute an S304.
[0103] S304, the server identifies whether the preset conditions are met.
[0104] S305, if the preset conditions are not met, update the first association and the second association until the preset conditions are met and then stop updating.
[0105] Below is an example of an update. When different second associations include the same fourth geofence information, the fifth geofence information most similar to the second geofence information is identified from the different first geofence information included in the different second associations, and the first association is updated. For example, the first associations corresponding to the remaining first geofence information (excluding the fifth geofence information) among the different first geofence information included in the second associations are updated. For example, the association between the first geofence information and the fourth geofence information in this first association. Alternatively, when different second associations include the same first geofence information, the fifth geofence information most similar to the first geofence information is identified from the different fourth geofence information included in the different second associations, and the first association is updated. For example, the first associations corresponding to the remaining fourth geofence information (excluding the fifth geofence information) among the different fourth geofence information included in the second associations are updated. For example, the association between the fourth geofence information and the first geofence information in this first association.
[0106] For example, when different second associations include the same fourth geofence information, for the same fourth geofence information and multiple different first geofence information associated with it, the server can obtain the similarity between each first geofence information and the second geofence information. Then, the first geofence information corresponding to the highest similarity among the multiple similarities is designated as the fifth geofence information. If the similarity is the same, the server identifies the first geofence information corresponding to the closest geofence as the fifth geofence information based on the distance between the second geofence information and different first geofences.
[0107] As in the previous example, the server can obtain the fifth geofence information most closely related to the fourth geofence information D1. For instance, the server can compare the similarity between the first geofence information TI and the fourth geofence information D1, and the similarity between the first geofence information T4 and the fourth geofence information D1. Assuming the similarity between the first geofence information TI and the fourth geofence information D1 is higher than the similarity between the fourth geofence information D1 and the first geofence information T4, then the fourth geofence information D1 is most closely related to the first geofence information T1. Alternatively, assuming the similarity between the first geofence information TI and the fourth geofence information D1 is equal to the similarity between the first geofence information T4 and the fourth geofence information D1, and the geofence corresponding to the first geofence information TI is the closest to the geofence corresponding to the fourth geofence information D1, then the fourth geofence information D1 is most closely related to the first geofence information T1.
[0108] Afterwards, the server deletes the association between the first geofence information and the fourth geofence information in the first association relationships corresponding to all first geofence information except the fifth geofence information. For example, in the previous example, the server deletes the association between the first geofence information T4 and the fourth geofence information D1 in the first association relationship corresponding to the first geofence information T4. After deletion, the updated first association relationships and updated second association relationships are as follows... Figure 5 As shown. Afterwards, the server executes S305 multiple times until the preset conditions are met.
[0109] S306, when the preset conditions are met, the fourth geofence information in the second association relationship is used as the second geofence information that matches the first geofence information one-to-one.
[0110] S307, compare whether there is a difference between the first geofence information and the corresponding second geofence information in the second association relationship.
[0111] S308, if there is a difference between the first geofence information and the corresponding second geofence information, the server uses the second geofence information to replace the first geofence information in the current version's summary table.
[0112] Optionally, the server assigns the fence identifier of the first geofence information in the current version's summary table to the second geofence information corresponding to the first geofence information.
[0113] Optionally, if there is no difference between the first geofence information and the second geofence information, the second geofence information is identified as not being the updated geofence information.
[0114] Optionally, in some cases, some first geofence information in the current version's summary table may not have a one-to-one corresponding second geofence information in the third dataset. This part of the first geofence information may have been generated previously but not generated this time. The reason for not generating it may be that the corresponding crowdsourcing data was not collected, for example, the shop corresponding to the first geofence information is closed, causing the phone to be unable to collect the corresponding crowdsourcing data. Therefore, for this part of the first geofence information, it can be identified whether the first geofence information is a geofence to be deleted. The phone can further execute some or all of S309-S313.
[0115] S309, if the first geofence information does not match the corresponding second geofence information, identify the first geofence information as deleted geofence information.
[0116] Optionally, S309 can also be: if the first geofence information does not match the corresponding second geofence information, and if the time elapsed between the generation time of the first geofence information and the current update time exceeds a preset time, then identify the first geofence information as deleted geofence information.
[0117] For example, when the server executes S301, if the first geofence information does not match a third geofence information with a similarity greater than a threshold, the server identifies that the first geofence information does not match the corresponding second geofence information. Alternatively, when the server executes S301, the first geofence information matches a third geofence information with a similarity greater than the threshold. However, if there are other first geofence information and third geofence information with a greater similarity than the first geofence information and the third geofence information, the first association between some first geofence information and fourth geofence information is deleted in each loop. Therefore, after multiple loop iterations, the matching relationship between the first geofence information and previously matched third geofence information is deleted, resulting in the first geofence information not establishing a first association with any third geofence information after loop iterations. Therefore, even if the first geofence information matches a third geofence information with a similarity greater than the threshold, but there are other first geofence information and the third geofence information with a greater similarity than the first geofence information and the third geofence information, the server identifies that the first geofence information does not match the corresponding second geofence information.
[0118] As in the example above, the server deletes the first association between the first geofence information T4 and the fourth geofence information D1. Since the first geofence information T4 is only associated with the fourth geofence information D1, after deleting the first association, the first geofence information T4 is no longer associated with any third geofence information. The server can identify that the first geofence information T4 is a geofence information to be deleted. Alternatively, the server can further identify whether the first geofence information T4 is a geofence information to be deleted.
[0119] The server can obtain the generation time of the third geofence information. If the generation time to the current update time exceeds a preset threshold, the third geofence information is to be deleted. If the generation time to the current update time does not exceed the preset threshold, the third geofence information is not to be deleted. The preset threshold can be, for example, the duration of n periods, where n is an integer greater than or equal to 1. Geofence information has a corresponding generation time; for example, the server adds the generation time to the geofence information after it is generated. For instance, geofence information generated in the first period all have a generation time. For geofence information generated in the second period, after executing the methods shown in S301-S309 to identify the newly added geofence information, the server adds the generation time to the newly added geofence information.
[0120] S310, when the first geofence information is a geofence to be deleted, delete the first geofence information in the summary table of the current version.
[0121] Timely identification and deletion of geofence information to be deleted can reduce the amount of data stored on the server, as well as the amount of data downloaded and stored on mobile devices. Optionally, if the first geofence information is not a geofence to be deleted, the server will not delete the first geofence information.
[0122] S311, after the traversal is completed, if there is a third geofence information in the third dataset that does not match any first geofence information, identify the third geofence information as newly added geofence information.
[0123] For example, when the server executes S301, if the third geofence information does not match the first geofence information with a similarity greater than a threshold, the server identifies the third geofence information as newly added geofence information. Alternatively, when the server executes S301, the third geofence information matches the first geofence information with a similarity greater than the threshold. However, if other third geofence information has a greater similarity to the first geofence information, the first and second association relationships are updated in each loop. Therefore, after multiple iterations of filtering, the matching relationship between the third geofence information and previously matched first geofence information is deleted. This results in the third geofence information not establishing a first association relationship with any first geofence information after iterative filtering. Therefore, when the third geofence information matches the first geofence information with a similarity greater than the threshold, but other third geofence information has a greater similarity to the first geofence information, the server identifies the third geofence information as newly added geofence information.
[0124] S312, the server generates a fence identifier for the geofence corresponding to the newly added geofence information and adds the new geofence information to the summary table of the current version. The server can perform actions such as... Figure 4 The method shown generates fence markers.
[0125] S313, the server adds newly added geofence information, updated geofence information, and geofence information to be deleted to the incremental table.
[0126] Specifically, the server can first create an empty table, add the newly added geofence information and its corresponding fence identifier to the incremental table. Then, use the fence identifier of the geofence information before the update as the fence identifier of the corresponding updated geofence information, add the updated geofence information and its corresponding fence identifier to the incremental table, and add the geofence information to be deleted and its corresponding fence identifier to the incremental table.
[0127] Thus, with each update, the server updates the summary table for the current version and generates an incremental table for the current update. The incremental table stores the first incremental data for this update, such as newly added geofence information, updated geofence information, and geofence information to be deleted during this update.
[0128] The following is combined with Figure 6 This paper presents an example of a server finding second geofence information that corresponds one-to-one with the first geofence information from a third dataset. For example... Figure 6 As shown, the method includes eight steps.
[0129] The first step is to establish the primary relationship.
[0130] Iterate through each first geofence piece of information in the current version's summary table, match third geofence pieces of information with similarity greater than a threshold from the third dataset based on similarity, and establish the first association relationship between the first geofence pieces of information and the third geofence pieces of information with similarity greater than the threshold.
[0131] like Figure 6 In the current version, the summary table includes first geofencing information D1 to first geofencing information Dn, where n is an integer greater than or equal to 1. The newly generated geofencing information (third dataset) includes third geofencing information T1 to third geofencing information Tm, where m is an integer greater than or equal to 1. n and m may be equal or unequal, and this application does not impose specific restrictions on this.
[0132] The server iterates through each first geofence from D1 to Dn, establishing a first association between each first geofence and at least one third geofence based on a first condition. For example, the server first calculates the distance between the geofence corresponding to each third geofence in the newly generated geofence information and the geofence corresponding to D1, filtering out third geofences whose distances are less than a preset distance. Then, it calculates the similarity between the first geofence D1 and the filtered third geofences, filtering out third geofences with similarities greater than a preset similarity, and establishing a first association between the first geofence D1 and the filtered third geofences. Subsequently, the server can perform a similar method to establish a first association for each first geofence from D2 to Dn in the current version's summary table.
[0133] After executing the first step, the server can obtain multiple first associations. Each first association corresponds to a first geofence.
[0134] The second step is to sort at least one third geofence information.
[0135] For each first association, the server sorts at least one third geofence piece of information within that first association based on similarity. The sorted first associations are as follows: Figure 6 As shown.
[0136] The third step is to establish a second association.
[0137] For a first association, establish a second association between the first geofence information and the fourth geofence information. The fourth geofence information is the first-ranked third geofence information, i.e., the third geofence information with the highest similarity.
[0138] Step 4: Reverse filtering.
[0139] Based on each of the fourth geofence information included in the multiple second associations, at least one first geofence information associated with each fourth geofence information is filtered out and sorted.
[0140] That is, Figure 6 As shown, for each fourth geofence information included in multiple second associations, at least one first geofence information that establishes an association with the fourth geofence information is found in reverse and sorted.
[0141] For example, multiple second associations include fourth geofence information D1, fourth geofence information D2, and fourth geofence information D3. Specifically, first geofence information T1 establishes a second association with fourth geofence information D2, first geofence information T2 establishes a second association with fourth geofence information D2, first geofence information T3 establishes a second association with fourth geofence information D3, and first geofence information T4 establishes a second association with fourth geofence information D1. Therefore, the geofence information associated with fourth geofence information D1 includes first geofence information T1 and first geofence information T4; the geofence information associated with fourth geofence information D2 is first geofence information T2; and the geofence information associated with fourth geofence information D3 is first geofence information T3.
[0142] The fifth step is to map the fourth geofence information to the fifth geofence information one by one.
[0143] Establish a one-to-one correspondence between each fourth geofence and the first fifth geofence.
[0144] Step 6: Update the first association.
[0145] In step four, delete the association between the remaining first geofence information (excluding the fifth geofence information) and the fourth geofence information in at least one first geofence information associated with each fourth geofence information.
[0146] For example, fourth geofence information D1 is associated with first geofence information T1 and first geofence information T4. First geofence information T1 has the highest similarity to fourth geofence information D1, meaning first geofence information T1 is the corresponding fifth geofence information. The server deletes the association between first geofence information T4 and fourth geofence information D1 from the first association relationship corresponding to first geofence information T4.
[0147] Step 7: Perform steps 2 through 5 in sequence until the different second associations, including the fourth geofence information and the first geofence information, are all different.
[0148] The server can also configure version numbers for the summary table. For example, in the first cycle, the dataset generated by the server based on crowdsourced data might be the initial version of the summary table, with a version number such as REV0.0. After each update to the summary table, the version number is updated. For instance, after generating the dataset in the second cycle, the server executes the method described above to identify the first incremental data and update the summary table based on it, simultaneously updating the summary table's version number, for example, from REV0.0 to REV1.0. Furthermore, each time the summary table is updated, the server saves the first incremental data in the incremental table.
[0149] The server can store the summary table (dataset) for each version and the incremental table (first incremental data) generated with each update in the database. After receiving a download request from a terminal device such as a mobile phone, the server can send the dataset to the mobile phone based on the download request. Figure 7 This application provides a geofence data download system.
[0150] For example, the download system may include a server and terminal devices such as mobile phones. The server may be a cloud server. The server includes a big data module, a service module, and a cloud database. The big data module can collect crowdsourced data and periodically generate datasets based on the crowdsourced data. The big data module can also use the newly generated datasets to update the current version's summary table and generate the incremental table corresponding to this update. The big data module can also publish the updated summary table and the corresponding incremental table to the cloud database. The service module provides a query interface for mobile phones and distributes the corresponding update data based on the mobile phone's download request.
[0151] The mobile phone can collect crowdsourced data and upload it to the server. It periodically requests and downloads datasets from the server based on version information of the datasets already stored in the local database, and then uses the downloaded datasets to update the datasets stored in the local database.
[0152] The following is combined with Figure 8 This paper introduces a method for downloading datasets. Figure 8 A method for downloading geofences provided in this application embodiment includes:
[0153] S01, the mobile phone sends a download request to the server.
[0154] The download request may include the version number of a first dataset already stored on the phone. The first dataset is one of multiple versions of a summary table stored on the server. The second dataset is also one of multiple versions of a summary table stored on the server. The first dataset differs from the second fenced data; its version is lower than the second dataset's version. The second dataset may be the latest version of the summary table on the server.
[0155] S02, the server responds to the phone's download request and identifies whether the phone is downloading for the first time.
[0156] The server can identify whether the download request includes a version number. If the download request includes a version number, the server recognizes that the phone is not downloading for the first time. If the download request does not include a version number, the server recognizes that the phone is downloading for the first time.
[0157] S03, if this is the first time the phone is downloading the data, the server sends the second dataset to the phone.
[0158] If this is the first time the phone has downloaded the dataset, and the phone does not have the dataset stored, the server will send a second dataset to the phone. Since this is the first time downloading, the server can send the entire latest version of the dataset to the phone.
[0159] S04, the mobile phone receives and saves the second dataset.
[0160] S05, if the phone is not downloading for the first time, the server identifies whether the first dataset is the previous version of the second dataset.
[0161] For example, since the first request carries the version number of the first dataset that has been stored, the server can read the version number from the first request and compare it.
[0162] S06, when the first dataset is the previous version of the second dataset, the server sends the first incremental data corresponding to the first dataset to the mobile phone.
[0163] Because the server stores multiple versions of the dataset and a first incremental data between each version and the next, for example, the server stores a first version summary table, a second version summary table, and a third version summary table. It also stores the first incremental data corresponding to the first version summary table, which is used to update the first version summary table to the second version summary table; and the first incremental data corresponding to the second version summary table, which is used to update the second version summary table to the third version summary table. When the version of the first dataset already stored on the mobile phone differs from the version of the second dataset requested for download by one version number, the server can directly send the first incremental data corresponding to the first dataset as the target incremental data to the mobile phone.
[0164] The server can find the first incremental data corresponding to the first dataset based on the version number of the first dataset from multiple stored datasets and the first incremental data corresponding to the first dataset. This first incremental data is the target incremental data.
[0165] The target incremental data includes the incremental data required to update and upgrade the first dataset to the second dataset. The target incremental data includes one or more of the following: newly added geofencing information, updated geofencing information, and deleted geofencing information in the second dataset compared to the first dataset.
[0166] S07, the mobile phone receives the first incremental data and uses the first incremental table to update the first dataset in the mobile phone.
[0167] The geofencing information in both the first dataset and the first incremental data includes fence identifiers.
[0168] For example, the mobile phone adds newly added geofence information from the incremental table to the first dataset. Based on the fence identifier of the geofence information deleted from the first incremental data, the corresponding geofence information with the same identifier in the first dataset is deleted. Based on the fence identifier, the geofence information with the same identifier in the first dataset is updated using the updated geofence information from the first incremental data. For example, based on the fence identifier of the updated geofence information in the first incremental data, geofence information with the same fence identifier in the first dataset is replaced.
[0169] S08, when the first dataset is not a previous version of the second dataset, the server retrieves the second incremental data.
[0170] Optionally, the server also stores second incremental data between a version of the dataset and the next n versions of the dataset. n is an integer greater than or equal to 2. For example, the server stores first incremental data between the first and second versions of the dataset, and second incremental data between the first and third versions of the dataset, and second incremental data between the first and fourth versions of the dataset. An example of a second incremental data generation is given below.
[0171] As an example, the server iterates through the first geofence identifier for each geofence in the first dataset and searches for a second geofence identifier in the second dataset (which consists of n versions of the first dataset) that matches the first geofence identifier. Both the first and second geofence identifiers are geofence identifiers. If the server can find a matching second geofence identifier in the second dataset based on the first geofence identifier, it indicates that the geofence information corresponding to that first geofence identifier is not newly added. In this case, the server further compares the geofence information corresponding to the first geofence identifier with the geofence information corresponding to the second geofence identifier for differences. If these two geofence information differ, the server identifies the geofence information corresponding to the second geofence identifier as updated. If these two geofence information are completely identical, the server identifies them as identical and no update is needed.
[0172] After a one-to-one comparison, if the first fence identifier of some geofence information in the first dataset cannot be matched with a second fence identifier in the second dataset, the server identifies this portion of geofence information as geofence information to be deleted. If, after a one-to-one comparison, some geofence information in the second dataset still lacks a matching first fence identifier, the server identifies this portion of geofence information as newly added geofence information. The server then adds the updated geofence information, the newly added geofence information, and the deleted geofence information to the second incremental data.
[0173] The server can directly retrieve the corresponding second incremental data for the first and second datasets based on their respective versions. This second incremental data is the target incremental data. For example, if the first dataset is version 1 and the second dataset is version 3, the server will retrieve the second incremental data P13 between these two versions as the target incremental data.
[0174] S09, the server sends the second incremental data to the mobile phone.
[0175] The geofence information in the second incremental data all includes fence identifiers.
[0176] S10, Receive the second incremental data, and use the second incremental data to update the first dataset in the mobile phone.
[0177] The method by which the mobile phone updates the first dataset in the mobile phone using the second incremental data is the same as the method by which the mobile phone updates the first dataset in the mobile phone using the first incremental data. Please refer to the previous text, and it will not be repeated here.
[0178] Optionally, before sending the target incremental data (first incremental data or second incremental data), the server can compare the data volume of the target incremental data with the data volume of the second dataset. If the data volume of the target incremental data is less than or equal to the data volume of the second dataset, the server sends the target incremental data to the mobile phone. If the data volume of the target incremental data is greater than the data volume of the second dataset, the server sends the second dataset to the mobile phone. Optionally, the server can calculate the difference between the data volume of the second dataset and the data volume of the target incremental data, and only send the target incremental data to the mobile phone if the difference is greater than a preset threshold.
[0179] This application provides a server, the electronic device including: a memory, a display screen, and one or more processors. The display screen is coupled to the processors. The memory stores computer program code. The computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can perform various functions or steps performed by the mobile phone in the above method embodiments.
[0180] This application also provides a computer storage medium that includes computer instructions. When the computer instructions are executed on the server, they cause the electronic device to perform the various functions or steps described in the method embodiments.
[0181] This application also provides a computer program product that, when run on a computer, causes the computer to perform the various functions or steps described in the above method embodiments.
[0182] This application also provides a chip system including at least one processor and at least one interface circuit. The processor and the interface circuit are interconnected via lines. For example, the interface circuit can be used to receive signals from other devices (e.g., the memory of an electronic device). As another example, the interface circuit can be used to send signals to other devices (e.g., the processor). Exemplarily, the interface circuit can read instructions stored in the memory and send the instructions to the processor. When the instructions are executed by the processor, the electronic device can perform the steps in the above embodiments. Of course, the chip system may also include other discrete devices, and this application does not specifically limit this.
[0183] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0184] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0185] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0186] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0187] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially or in other words, the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0188] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for downloading geofence data, characterized in that, The method is applied to a server, which stores multiple versions of a dataset and corresponding first and second incremental data for each version. The first incremental data is used to update a corresponding version of the dataset to the next version, and the second incremental data is used to update a corresponding version of the dataset to the next n versions, where n is an integer greater than or equal to 2. The multiple versions of the dataset include a first dataset and a second dataset. Receive a download request sent by an electronic device; the download request includes version information of a first dataset currently stored by the electronic device; Send the target incremental data to the electronic device; In the case where the first dataset is a previous version of the second dataset, the target incremental data is the first incremental data corresponding to the first dataset among the first incremental data corresponding to the multiple versions of the dataset; the first incremental data is determined based on the first dataset and the third dataset when the second dataset is generated, and the third dataset includes the geofencing information generated in the latest period before updating the first dataset to generate the second dataset; If the first dataset is not a previous version of the second dataset, the target incremental data is the second incremental data corresponding to the first dataset and the second dataset among the multiple versions of the dataset. The target incremental data includes one or more of the following: newly added geofence information, updated geofence information, and deleted geofence information in the second dataset compared to the first dataset; both the first dataset and the second dataset include at least one geofence information.
2. The method according to claim 1, characterized in that, For one version of the dataset from the multiple versions, the following method is executed to obtain the dataset for that version and the corresponding first incremental data: The third dataset is generated based on the collected crowdsourced data; Compare the dataset and the third dataset to generate the first incremental data corresponding to the dataset; The dataset is updated based on the first incremental data corresponding to the dataset to obtain the next version of the dataset.
3. The method according to claim 2, characterized in that, The step of comparing the dataset and the third dataset to generate first incremental data corresponding to the dataset includes: Iterate through each first geofence information in the dataset, and match a one-to-one corresponding second geofence information for the first geofence information from the third dataset. The first geofence information and the corresponding second geofence information indicate the same geofence. If the first geofence information matches the corresponding second geofence information, identify whether the first geofence information and the corresponding second geofence information are consistent; if the first geofence information and the corresponding second geofence information are inconsistent, identify that the corresponding second geofence information is the updated geofence information. If the first geofence information does not match the corresponding second geofence information, the first geofence information is identified as the deleted geofence information; After the traversal is complete, if there is a third geofence information in the third dataset that does not match any first geofence information, then the third geofence information is identified as the newly added geofence information.
4. The method according to claim 3, characterized in that, The step of identifying the first geofence information as the deleted geofence information when the first geofence information does not match the corresponding second geofence information includes: If the first geofence information does not match the corresponding second geofence information, and the time elapsed between the generation time of the first geofence information and the current update time exceeds a preset time, the first geofence information is identified as the deleted geofence information.
5. The method according to claim 3, characterized in that, The step of traversing each first geofence piece of information in the dataset and matching a corresponding second geofence piece of information from the third dataset includes: Traverse each first geofence piece of information in the dataset, and obtain the first association relationship corresponding to the first geofence piece of information based on the third dataset; the first association relationship is used to indicate the correspondence between the first geofence piece of information and the third geofence piece of information in the third dataset whose similarity to the first geofence piece of information is greater than a threshold. If a first association relationship is obtained corresponding to the first geofence information, a second association relationship is obtained; the second association relationship is used to indicate the correspondence between the first geofence information and the fourth geofence information; the fourth geofence information is the third geofence information with the greatest similarity to the first geofence information among the third geofence information whose similarity to the first geofence information is greater than a threshold. Based on the first association relationship and the second association relationship, a corresponding second geofence information is matched one-to-one with the first geofence information.
6. The method according to claim 5, characterized in that, The step of matching corresponding second geofence information to the first geofence information based on the first association relationship and the second association relationship includes: The first association and the second association are updated according to preset conditions. The fourth geofence information in the second association when the update stops is used as the second geofence information that matches the first geofence information one by one. The preset condition is that different second associations include different fourth geofence information and different first geofence information.
7. The method according to claim 3 or 4, characterized in that, The method further includes: If the first geofence information does not match a third geofence information with a similarity greater than a threshold, or if the first geofence information matches a third geofence information with a similarity greater than a threshold, but there are other first geofence information and the third geofence information with a similarity greater than the first geofence information and the third geofence information, then it is identified that the first geofence information does not match the corresponding second geofence information.
8. The method according to claim 4 or 5, characterized in that, When a third geofence piece of information exists in the third dataset but does not match any first geofence piece of information, identifying the third geofence piece of information as the newly added geofence piece of information includes: If the third geofence information in the third dataset does not match the first geofence information with a similarity greater than the threshold, or if the third geofence information matches the first geofence information with a similarity greater than the threshold, but there are other third geofence information with a similarity greater than that of the first geofence information, then the third geofence information is identified as the newly added geofence information.
9. The method according to claim 1, characterized in that, The geofence information in the dataset and the corresponding first incremental data includes an identifier, which is used to identify the geofence corresponding to the geofence information.
10. The method according to claim 9, characterized in that, The identifier includes a first code and a first serial number; the first code is related to the geofence information corresponding to the geofence information.
11. A method for downloading geofencing data, characterized in that, Applied to electronic devices, the method includes: Send a download request; the download request includes version information of the first dataset currently stored in the electronic device; Receive target incremental data; the target incremental data includes one or more of the following: geofence information added, updated, and deleted in the second dataset compared to the first dataset; The first dataset is updated based on the target incremental data; both the first dataset and the second dataset include at least one geofence entry. Wherein, when the first dataset is the previous version of the second dataset, the target incremental data is the first incremental data corresponding to the first dataset among the first incremental data corresponding to the multiple versions of the dataset; the first incremental data is used to update the corresponding version of the dataset to the next version of the dataset, and the first incremental data is determined based on the first dataset and the third dataset when the second dataset is generated, and the third dataset includes the geofencing information generated in the latest cycle before updating the first dataset to generate the second dataset; If the first dataset is not the previous version of the second dataset, the target incremental data is the second incremental data corresponding to the first dataset and the second dataset among the second incremental data corresponding to the multiple versions of the dataset; the second incremental data is used to update the corresponding version of the dataset to the next n versions of the dataset, where n is an integer greater than or equal to 2.
12. The method according to claim 11, characterized in that, The geofence information in the first dataset and the target incremental data includes an identifier, which is used to identify the geofence corresponding to the geofence information.
13. The method according to claim 12, characterized in that, Updating the first dataset based on the target incremental data includes: Add the newly added geofence information to the first dataset; The updated geofence information is used to replace geofence information with the same identifier in the first dataset based on the identifier; The deleted geofence information is deleted based on the identifier; geofence information with the same identifier in the first dataset is deleted.
14. A server, characterized in that, The server includes: a memory, a communication module, and one or more processors; the memory, the communication module, and the processors are coupled; wherein the communication module is used to interact with an electronic device, the memory is used to store computer program code, the computer program code including computer instructions; when the computer instructions are executed by the processor, the server performs the method as described in any one of claims 1-10.
15. An electronic device, characterized in that, The electronic device includes: a memory, a communication module, and one or more processors; the memory, the communication module, and the processors are coupled; wherein the communication module is used to interact with the electronic device, the memory is used to store computer program code, the computer program code including computer instructions; when the computer instructions are executed by the processor, the server performs the method as described in any one of claims 11-13.
16. A computer-readable storage medium, characterized in that, Includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-10 or 11-13.
17. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the method as described in any one of claims 1-10 or 11-13.