Method for loading off-line electronic map in HarmonyOS Next

By compressing and decompressing map tile data, and using HarmonyOS Next's ArkWeb framework, the problem of HarmonyOS Next's inability to load electronic maps in the Internet isolation environment is solved, achieving the effect of quickly importing and offline loading of electronic maps.

CN119807318APending Publication Date: 2025-04-11CHINA NANHU ACAD OF ELECTRONICS & INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411873813.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

HarmonyOS Next cannot load electronic maps under Internet isolation, and the existing offline map loading method takes too long to import large data tiles.

Method used

Import map tile data through compression, import and decompression, and use HarmonyOS Next's ArkWeb framework to load electronic maps offline. This method includes downloading, packaging, uploading, decompressing, folder selection and local persistent storage of map tiles, combining GNSS positioning and magnetic sensor data on the application side to realize the loading of offline electronic maps.

Benefits of technology

It significantly reduces the time for map tiles import, avoids file access issues caused by sandboxing mechanism, and successfully loads offline electronic maps without the Internet.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807318A_ABST
    Figure CN119807318A_ABST
Patent Text Reader

Abstract

The invention provides a method for loading an off-line electronic map in HarmonyOS Next, and relates to the field of electronic maps, a tile root directory address is set through importing, decompression and selection of a tile compression package, the position and orientation of equipment are updated through mutual calling of ArkWeb and a main application, clicking, dragging and zooming events are monitored through an off-line function on the ArkWeb side, and the loading of the off-line electronic map in the HarmonyOS Next is achieved. And reading tile data from a corresponding position according to the root directory address of the tile, and loading an offline electronic map. According to the method, the problem that the HarmonyOS Next cannot load the electronic map under the condition of no Internet is solved, the time consumption caused by tile data import is greatly reduced, and the problems of limited user file access and limited sandbox folder uploading caused by a sandbox mechanism are also avoided. And the blank of a HarmonyOS Next application electronic map loading scheme under the condition of internet isolation is filled up.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electronic maps and invents a method for loading an offline electronic map in HarmonyOS Next. Background Art

[0002] With the continuous development of information technology, HarmonyOS Next, as a new generation of smart terminal operating system with independent innovation and foresight, is gradually demonstrating its strong strength in various fields.

[0003] However, due to the newness of HarmonyOS Next, in the field of electronic maps, the three major map manufacturers, AutoNavi, Tencent, and Baidu, as well as the electronic maps that come with HarmonyOS Next, can only support online loading. Electronic maps cannot be loaded without a network. This is fatal for some Internet-isolated scenarios.

[0004] In addition, the offline map loading SDK previously provided by the three major map manufacturers for the Android system requires the map tiles to be imported into the terminal device in advance when loading offline maps. However, due to the large number of tiles, the process of importing tiles into the device is extremely time-consuming.

[0005] Therefore, a method for loading offline maps on HarmonyOS Next and optimization of importing large map packages have become urgent needs. Summary of the invention

[0006] The purpose of the present invention is to provide a method for loading an offline electronic map in HarmonyOS Next to solve the problems in the background technology.

[0007] To achieve the above object, the technical solution of the present invention is:

[0008] A method for loading an offline electronic map in HarmonyOS Next comprises the following steps:

[0009] S0: Download, package and upload map tiles;

[0010] S1: Display, decompress and delete compressed packages;

[0011] S2: Display of the decompressed tile folder list, selection and deletion of folders;

[0012] S3: Local persistent storage of the selected folder name and modification of tile path configuration on the ArkWeb side;

[0013] S4: The ArkWeb page reads the tiles under the specified map level and directory based on the map coordinates passed in and the click, drag and zoom events monitored, and then loads the electronic map.

[0014] S5: The application side obtains the GNSS positioning and magnetic sensor of the device and calculates the coordinates and orientation in the map. The final offline electronic map is displayed on the electronic map through mutual calls between the application side and the ArkWeb page functions.

[0015] Furthermore, in the step S0, the map resources are downloaded in advance, and after the download is completed, the folder is packaged into a compressed file, and the compressed file is uploaded to the application sandbox directory through the upload command of HarmonyOS Next. The application sandbox is used to store tile data.

[0016] Furthermore, in step S1, the names of all map compression packages in the application sandbox are first obtained and displayed in a list on the decompression page. The compressed package is selected in the list for decompression and deletion, and the decompressed file is stored in the default map storage location in the application sandbox.

[0017] Furthermore, in step S2, all map folders in the default map storage location are read on the map selection page, and maps are selected and map files are renamed and deleted;

[0018] When unzipping the map package and renaming the map folder, the name is checked. If the name is repeated, the operation is canceled and a prompt is given that the map name is repeated.

[0019] Furthermore, in step S3, when a map is selected, the loading address configuration of the map tile in the offline function on the ArkWeb side is updated, and the address is accessed. If there is a corresponding tile, the tile is returned, otherwise a null value is returned;

[0020] Select a map and store the map name locally using sqlite. When you log in again, access the local storage and configure the loading address of the map tile.

[0021] Furthermore, in step S4, the map page is loaded through the ArkWeb framework in the HarmonyOS Next application, and the click, drag and zoom events of the map are listened to on the ArkWeb side. Through offline function processing, the storage address of the tiles in the current view is obtained, and the tiles at the specified address are read and rendered into ArkWeb to load the electronic map.

[0022] Furthermore, in step S5, the application side obtains the GNSS coordinates of the device and the environmental geomagnetic field on the three physical axes of the magnetic field sensor, and then obtains the map coordinates through coordinate conversion and calculates the east-west, south-north and north-south directions of the device based on the environmental geomagnetic field on the three physical axes. After obtaining the map coordinates and device orientation, the device's location and orientation information are added to the map through mutual calls between the application side and ArkWeb's functions to obtain the final offline electronic map.

[0023] Due to the limitations of the HarmonyOS Next sandbox mechanism, the access rights to HarmonyOS Next application data are isolated within the sandbox, and uploading files to the sandbox is also subject to permission restrictions, resulting in only single files being uploaded. Therefore, the tile data is packaged into a compressed file and uploaded to the application sandbox directory through the HarmonyOS Next upload command;

[0024] On the map decompression page, obtain all compressed files in the application sandbox directory and choose to decompress or delete them. This process avoids the time consumption caused by excessive data volume when directly importing uncompressed files into the device, and compresses the time consumption of about 20 minutes to less than one minute;

[0025] On the map selection page, get all the unzipped tile folders in the application sandbox directory and select a map. When selecting, store the selected map name locally through sqlite persistence and update the root directory address of loading tiles in the offline function on the ArkWeb side. When re-login and map management are performed, the local data will be read and the tile root directory address will be directly configured.

[0026] In the HarmonyOS Next application, use the ArkWeb framework to load the map main page and configure sandbox file access permissions. In ArkWeb, preset the tile root directory address and declare response events, and call back the application-side function.

[0027] On the ArkWeb page, the offline function listens to click, drag, and zoom events, reads tile data according to the root directory address of the tile, and then loads the offline electronic map;

[0028] The GNSS positioning and magnetic sensor of the device are obtained on the application side, and the coordinates and orientation of the device in the map are obtained after conversion. The application side and the ArkWeb page are called to update the position and orientation of the device in real time to obtain the final offline electronic map.

[0029] Compared with the prior art, the present invention has the following beneficial effects and advantages:

[0030] 1. Importing map tile data by compression, importing, and decompression saves a lot of time compared to directly uploading files to the device.

[0031] 2. It avoids the upload permission problem of HarmonyOS Next uploading folders to the sandbox and the access permission problem of applications reading local directories.

[0032] 3. Offline electronic maps can be successfully loaded through the ArkWeb framework of HarmonyOS Next, and maps can be loaded normally even without the Internet. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 Loading the overall structure diagram for the map of the present invention;

[0035] Figure 2 A flow chart for loading a map of the present invention. DETAILED DESCRIPTION

[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0037] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0038] like Figure 1As shown in the figure, in order to solve the problem that the current HarmonyOS Next application cannot load the electronic map in an Internet-isolated environment and the time consumption caused by the transmission of large amounts of data tiles, this paper proposes a method for loading offline electronic maps in HarmonyOS Next, and provides a solution for the development of other HarmonyOS Next applications that use offline electronic maps. Through this method, map tiles pre-imported into the application sandbox can be accessed without the Internet, and the GNSS positioning and magnetic sensor of the device can be obtained and then transferred to the electronic map to complete the loading of the offline electronic map. In addition, it also avoids the user file access rights and folder upload permissions caused by the sandbox mechanism, and greatly reduces the time consumption caused by directly importing large amounts of data tiles. The selection of the map and local persistent storage make it unnecessary to re-select the map every time you log in.

[0039] like Figure 2 As shown, a method for loading an offline electronic map in HarmonyOS Next of this embodiment includes the following steps:

[0040] Step 1: Download, compress and upload map tiles.

[0041] Download the map tiles of the destination in advance, package the tiles into a compressed file after downloading, and upload it to the sandbox in the application through the upload command of HarmonyOS Next.

[0042] Step 2: Get all compressed files in the specified directory.

[0043] Enter the map decompression page, enter the sandbox path, and obtain all the compressed package files in the directory according to the path and display them in the list.

[0044] Step 3: Unzip and delete the compressed package.

[0045] Select a compressed package in the compressed package list to decompress or delete it. When decompressing, first enter the name of the decompressed folder to decompress and rename it.

[0046] Step 4. Get the unzipped folder.

[0047] Enter the map management page, obtain all decompressed folders in the default decompression path and display them in the map list.

[0048] Step 5. Selection of all unpacked maps and storage of options.

[0049] Select a folder in the map list to select, rename, and delete maps. When renaming or unzipping, if the newly entered name already exists, it will not be modified and a prompt will be given. When selecting a map, the selected map name will be persistently stored so that you do not need to reselect it when you log in to the application again.

[0050] Step 6. ArkWeb updates the tile address.

[0051] When selecting a map, pass the selected folder name and decompression path to ArkWeb to modify the tile path configuration file.

[0052] Step 7: The offline function obtains tiles.

[0053] ArkWeb obtains click, drag, zoom events and map coordinates and passes them to the offline function, and the offline function obtains the specified tile at the specified level.

[0054] Step 8. ArkWeb loads the map.

[0055] Load the map in ArkWeb based on the obtained tiles.

[0056] Step 9: Acquire and convert sensor values ​​on the application side.

[0057] The application obtains the GNSS coordinates of the device and converts them into map coordinates. At the same time, the environmental geomagnetic field on the three physical axes of the device's magnetic field sensor is obtained to calculate the east-west, south-north, and north-south orientation of the device.

[0058] Step 10: The application side and ArkWeb side call each other.

[0059] The mutual calls between the application side and the ArkWeb side of the ArkWeb framework update the device's position and orientation display in the electronic map, and also provide a data path for subsequent calls between the two.

[0060] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0061] The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.

Claims

1. A method for loading an offline electronic map in HarmonyOS Next, characterized in that: The method for loading an offline electronic map in HarmonyOS Next comprises the following steps: S0: Download, package and upload map tiles; S1: Display, decompress and delete compressed packages; S2: Display of the decompressed tile folder list, selection and deletion of folders; S3: Local persistent storage of the selected folder name and modification of tile path configuration on the ArkWeb side; S4: The ArkWeb page reads the tiles under the specified map level and directory based on the map coordinates passed in and the click, drag and zoom events monitored, and then loads the electronic map. S5: The application side obtains the GNSS positioning and magnetic sensor of the device and calculates the coordinates and orientation in the map. The final offline electronic map is displayed on the electronic map through mutual calls between the application side and the ArkWeb page functions.

2. The method for loading an offline electronic map in HarmonyOS Next according to claim 1, characterized in that: In the step S0, the map resources are downloaded in advance, and after the download is completed, the folder is packaged into a compressed file, and the compressed file is uploaded to the application sandbox directory through the upload command of HarmonyOS Next. The application sandbox is used to store tile data.

3. The method for loading an offline electronic map in HarmonyOS Next according to claim 1, characterized in that: In step S1, first obtain the names of all map compression packages in the application sandbox, display them in a list on the decompression page, select the compression package in the list to decompress and delete it, and store the decompressed files in the default map storage location in the application sandbox.

4. The method for loading an offline electronic map in HarmonyOS Next according to claim 1, characterized in that: In step S2, all map folders in the default map storage location are read on the map selection page, and maps are selected and map files are renamed and deleted; When unzipping the map package and renaming the map folder, the name is checked. If the name is repeated, the operation is canceled and a prompt is given that the map name is repeated.

5. The method for loading an offline electronic map in HarmonyOS Next according to claim 1, characterized in that: In step S3, when a map is selected, the loading address configuration of the map tile in the offline function on the ArkWeb side is updated, and the address is accessed. If there is a corresponding tile, the tile is returned, otherwise a null value is returned; Select a map and store the map name locally using sqlite. When you log in again, access the local storage and configure the loading address of the map tile.

6. The method for loading an offline electronic map in HarmonyOS Next according to claim 1, characterized in that: In step S4, the map page is loaded through the ArkWeb framework in the HarmonyOS Next application, and the click, drag and zoom events of the map are listened to on the ArkWeb side. The storage address of the tile in the current view is obtained through offline function processing, and the tile at the specified address is read and rendered into ArkWeb to load the electronic map.

7. The method for loading an offline electronic map in HarmonyOS Next according to claim 1, characterized in that: In step S5, the application side obtains the GNSS coordinates of the device and the environmental geomagnetic field on the three physical axes of the magnetic field sensor, then obtains the map coordinates through coordinate conversion and calculates the east-west, south-north and north-south directions of the device based on the environmental geomagnetic field on the three physical axes. After obtaining the map coordinates and device orientation, the device's location and orientation information are added to the map through mutual calls between the application side and ArkWeb's functions to obtain the final offline electronic map.