Map display method, electronic equipment and storage medium
By recursively correcting the layer data of smart terminal devices, the problem of slow map loading speed is solved, and fast response and efficient map display under limited resource conditions are achieved.
Patent Information
- Application Number
- CN202510382561.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-07-18
AI Technical Summary
In the prior art, smart terminal devices such as smart watches, when loading maps, due to high CPU performance and memory requirements, the loading speed is slow, and real-time response and fast scaling cannot be achieved.
By acquiring multiple layers of map data, the resource status is determined based on the configuration information of the electronic device and the amount of layer data, and the layer data is recursively corrected when the preset threshold is exceeded, until the device's optimal loading resource requirements are met, and the layers are dynamically adjusted to achieve rapid response.
On the premise of ensuring the display effect of maps, the resource usage of data loading is reduced, the map loading speed and response speed are improved, and the needs of real-time movement and zoom operations are met.
Smart Images

Figure CN120335913A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of intelligent terminals, and particularly to a map display method, an electronic device, and a storage medium. Background Art
[0002] With the improvement of people's living standards, electronic devices are more and more widely used, including smart phones, smart watches, in-vehicle intelligent terminals, etc. Map software is often installed on electronic devices. Through the map software, users can conveniently locate themselves, view the surrounding environment, and navigate to destinations.
[0003] The inventors of the present application found in the research that for Android terminals and IOS terminals with operating systems, currently, map browsing and display such as those of Amap, Baidu, and Google mainly use asynchronous and delayed loading methods. This technology has high requirements for CPU performance (the main frequency is required to be above 1.2 GHz), and also has high requirements for the capacity of ROM and RAM. Only for large platforms and large fields such as Android and IOS can the smoothness of map movement and zooming be achieved. For general-performance terminal devices such as smart watches, there are often problems such as slow loading speed when loading maps. Summary of the Invention
[0004] In view of the above problems, the embodiments of the present application provide a map display method, an electronic device, and a storage medium to solve the above technical problems existing in the prior art.
[0005] In one aspect of the embodiments of the present application, a map display method is proposed, which is applied to an electronic device. The method includes:
[0006] In response to an operation on the map, obtain map data, where the map data includes multiple layers;
[0007] Obtain the data information corresponding to each layer, where the data information includes the data volume corresponding to the layer;
[0008] According to the configuration information of the electronic device and the data volume of each layer, determine the resource status required for each layer;
[0009] If the resource status required for the layer is greater than a preset threshold, recursively correct the data information of the layer until the resource status required for the layer is less than or equal to the preset threshold;
[0010] Traverse all layers until the recursive correction of the data information of all layers is completed;
[0011] Perform map display according to the data information corresponding to each layer after recursive correction.
[0012] Preferably, in some embodiments, the method further includes:
[0013] Generating N square regions according to the screen pixel information of the electronic device and a preset resolution factor N, where N is a natural number;
[0014] Determining the longitude and latitude boundaries of each of the square regions according to the map data;
[0015] Obtaining multiple layers corresponding to each of the square regions according to the longitude and latitude boundaries.
[0016] Preferably, in some embodiments, each of the layers corresponds to each object type respectively, each of the layers includes multiple objects, the object types of the multiple objects are the same as the object type corresponding to the layer, and the data volume corresponding to the layer is the data volume corresponding to each object;
[0017] The object types include area object type, point object type, line object type, surface object type, and closed object type.
[0018] Preferably, in some embodiments, the configuration information of the electronic device includes CPU main frequency information Freq, memory information Heap, and file reading speed information F_Rate;
[0019] Determining the resource status required for each of the layers according to the configuration information of the electronic device and the data volume of each of the layers, including:
[0020] Determining the resource status required for the layer according to the resolution factor N, the data volume Capacity of the layer, and the CPU main frequency information Freq, memory information Heap, and file reading speed information F_Rate of the electronic device.
[0021] Preferably, in some embodiments, if the resource status required for the layer is greater than a preset threshold, recursively correcting the data information of the layer, including:
[0022] If the resource status required for the layer is greater than a first preset threshold, obtaining intermediate temporary data corresponding to each object in the layer;
[0023] Sorting the objects according to the data volume of the intermediate temporary data corresponding to each object, and obtaining a first set of objects to be optimized according to a preset first ratio in the order from largest to smallest data volume;
[0024] Correcting the data information of each object in the first set of objects to be optimized.
[0025] Preferably, in some embodiments, if the resource status required by the layer is greater than a preset threshold, recursively correcting the data information of the layer further includes:
[0026] If the resource status required by the layer is greater than a second preset threshold and less than or equal to a first preset threshold, where the difference between the first preset threshold and the second preset threshold is a preset adjustment difference, obtain intermediate temporary data corresponding to each object in the layer;
[0027] Sort the objects according to the data volume of the intermediate temporary data corresponding to each object, and obtain a second set of objects to be optimized according to a preset second ratio in ascending order of data volume;
[0028] Correct the data information of each object in the second set of objects to be optimized.
[0029] Preferably, in some embodiments, the method further includes:
[0030] Store the data information of the layer after recursive correction in a hash table;
[0031] Before recursively correcting the data information of the layer, it further includes:
[0032] Judge whether the hash table contains the data information of the layer. If it exists, directly call the data information of the layer after recursive correction.
[0033] Preferably, in some embodiments, the map display according to the data information corresponding to each layer after recursive correction includes:
[0034] Overlay each layer in turn according to the data information of each layer after recursive correction;
[0035] If there is a repetition in the data information between the layers, retain the data information corresponding to the top layer;
[0036] If the top layer contains an objectless area, crop the objectless area.
[0037] Another aspect of the embodiments of the present application further provides an electronic device, which includes: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface complete mutual communication through the communication bus;
[0038] The memory is used to store at least one program, and the program enables the processor to execute the operations of the map display method proposed by the embodiments of the present application.
[0039] In a third aspect of the embodiments of the present application, a computer-readable storage medium is further provided. At least one program is stored in the storage medium. When the program runs on an electronic device, the electronic device is caused to perform the operations of the map display method proposed in the embodiments of the present application.
[0040] In summary, for a map display method and an electronic device proposed in the embodiments of the present application, after obtaining the data information of each layer, according to the configuration of the electronic device itself and the data volume of each layer to be loaded, the resource status required for loading the map is determined. When the resource status required by the layer exceeds the optimal loading resource value of the electronic device, that is, when it exceeds the preset threshold, the data information of each layer is recursively corrected until the requirements of the optimal loading resource value of the electronic device are met. After the electronic device recursively corrects the data information of each layer, the map is displayed according to the recursively corrected data information of each layer. In this way, while ensuring the map display effect, the resource occupation of data loading is greatly reduced, and the map loading speed is improved.
[0041] The above description is only an overview of the technical solutions of the embodiments of the present application. In order to be able to understand the technical means of the embodiments of the present application more clearly, it can be implemented according to the content of the description. And in order to make the above and other purposes, features and advantages of the embodiments of the present application more obvious and understandable, the specific embodiments of the present application are specifically described below. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The drawings are only used to illustrate the embodiments and are not considered to be a limitation of the present application. And throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:
[0043] Figure 1 is a schematic structural diagram of an electronic device proposed in the embodiments of the present application;
[0044] Figure 2 is a schematic flowchart of a map display method proposed in the embodiments of the present application;
[0045] Figure 3 is a schematic flowchart of step S100 in the map display method proposed in the embodiments of the present application;
[0046] Figure 4 is a flowchart of another map display method proposed in the embodiments of the present application;
[0047] Figure 5 is a schematic structural diagram of a map display device proposed in the embodiments of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0048] Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein.
[0049] In the field of map processing technology, for Android terminals and iOS terminals with operating systems, etc., the application scenarios are mainly complex map applications. For application programs that contain a large amount of map data and functions, lazy loading technology can be used to improve the loading speed of map pages and reduce resource occupancy. For operations that require user interaction, lazy execution can be used to improve the user's response speed and experience. For operations that need to obtain data from the server, lazy execution can be used to avoid blocking page loading and user operations. However, the above map loading technologies are mainly applicable to devices such as Android and iOS that have relatively high requirements for CPU performance, ROM, and RAM capacity. For example, the main frequency requirement is above 1.2 GHz. For small embedded devices, platforms with low main frequency and low memory cannot be used. Moreover, for small embedded devices, the map cannot be zoomed through two-finger gesture events, and can only be zoomed through external rotary buttons and virtual buttons on the touch screen. At the same time, for small embedded devices, the lazy loading technology adopted cannot display the map image in real time and needs to wait for a while to display, which cannot meet the user experience of real-time response. This seriously affects the user experience.
[0050] In view of this, the embodiments of the present application propose a map display method and an electronic device. After obtaining the data information of each layer, according to the configuration of the electronic device itself and the data volume of each layer to be loaded, the resource status required for loading the map is determined. When the resource status required by the layer exceeds the optimal loading resource value of the electronic device, that is, when it exceeds the preset threshold, the data information of each layer is recursively corrected until the requirements of the optimal loading resource value of the electronic device are met. After the electronic device recursively corrects the data information of each layer, the map is displayed according to the recursively corrected data information of each layer. In this way, while ensuring the map display effect, the resource occupancy of data loading is greatly reduced, and the map loading speed is improved.
[0051] The map display method proposed by the embodiments of the present application can be applied to various electronic devices, including but not limited to electronic devices that require map information such as smart watches, smart phones, and navigators. In the embodiments of the present application, only a smart watch is taken as an example for illustration. As Figure 1 shown, the embodiments of the present application show a schematic structural diagram of an electronic device, and this electronic device is used to execute the map display method proposed by the embodiments of the present application.
[0052] As Figure 1As shown in the figure, the electronic device may include: a display screen 101, a processor 102, a communications interface 104, a memory 106, and a communication bus 108. Among them: the display screen 101, the processor 102, the communications interface 104, and the memory 106 communicate with each other through the communication bus 108. The communications interface 104 is used to communicate with network elements of other devices such as clients or other servers. The processor 102 is used to execute the program 110, and specifically can execute the map display method proposed in the embodiments of the present application.
[0053] Specifically, the program 110 may include program code, and the program code includes computer-executable instructions. The processor 102 may be a central processing unit CPU, or an ASIC, or one or more integrated circuits configured to implement the embodiments of the present application. One or more processors included in the computing device may be of the same type of processor, such as one or more CPUs; or may be of different types of processors, such as one or more CPUs and one or more ASICs.
[0054] The memory 106 is used to store the program 110. The memory 106 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk memory. The memory 106 stores the code for running the relevant steps in the embodiments of the map display method proposed in the embodiments of the present application.
[0055] The display screen 101 is preferably a touch screen, which is used to display map information to the user and is used to respond to the user's operations on the map, such as: zooming in and out of the map by two-finger touch, moving the display area of the map by single-finger operation, etc.
[0056] When the user uses the above electronic device to perform map operations, the electronic device runs the map display method proposed in the embodiments of the present application. Specifically, the map display method is as Figure 2 shown, and the method includes:
[0057] Step S100: In response to an operation on the map, obtain map data, where the map data includes multiple layers;
[0058] In a smartwatch, when the user opens a map application, the smartwatch first loads map data. Map data is a digital representation of geographical information, used to support functions such as map display, query, and analysis. Map data usually includes geographical location information, geographical feature information, attribute information, map display data, as well as annotations and explanations, etc. Among them, the geographical location information includes coordinate data and elevation data. The coordinate data is the basis of map data, including longitude and latitude coordinates, planar coordinates, etc., used to determine the positions of various geographical features on the map; the elevation data is used to represent the undulations of the terrain, such as the elevation information of mountains, valleys, etc., usually stored in the form of a Digital Elevation Model (DEM). The geographical feature information includes natural geographical features and human geographical features. The natural geographical features include landforms, such as mountains, plains, hills, basins, etc.; water systems, such as rivers, lakes, oceans, waterfalls, etc.; vegetation, such as forests, grasslands, deserts, etc. Human geographical features include populated places, such as the names, locations, and extents of cities, towns, villages, etc.; transportation networks, such as roads (expressways, national highways, provincial highways, county roads, etc.), railways, bridges, tunnels, etc.; public facilities, such as the locations and names of schools, hospitals, government agencies, parks, etc.; and also include place names and addresses. A place name is a geographical name marked on the map, and an address is specific information such as a house number and street name. The attribute information includes natural geographical feature attributes: such as the length, flow rate, and flow direction of a river, the area and water depth of a lake, etc.; human geographical feature attributes: such as the grade, width, and material of a road, the use, height, and construction year of a building, etc. The map display data includes symbols and icons: symbols used to represent various geographical features, such as using blue lines to represent rivers and brown lines to represent roads, etc., colors and fills: different colors and fill patterns are used to distinguish different geographical regions and features, such as green representing vegetation-covered areas and yellow representing deserts, etc. Annotations and explanations include textual explanations of geographical features on the map, such as place names, river names, road names, etc. The above map data is the initial input data set by the factory settings of the electronic device. Assuming the above initial input data is the first layer of input, denoted as: X1 1 , X1 2 , X1 3 ,...X1 n and corresponding data, including: all data parameters such as urban arterial roads, railways, subways, scenic spots, parks, hospitals, maximum scale, CPU main frequency of the device, screen size and resolution, zoning code, current GPS information, coordinate system information, etc.
[0059] In the embodiment of the present application, in order to be able to efficiently display map data, before the electronic device performs map display through this map display method, it will first process the above initial input data to generate multiple layers. Among them, the processing process of the initial input data is as Figure 3 shown, including:
[0060] Step 101: Generate N square regions according to the screen pixel information of the electronic device and a preset resolution factor N, where N is a natural number;
[0061] Among them, the screen pixel information represents the size of the electronic device screen, that is, the space where the map can be displayed, and the preset resolution factor N represents that the width (Width) and height (Height) of the current screen are respectively divided into N equal parts. The value of N can be determined according to actual needs and device performance. For example, it can be set according to the granularity of the map data. For a circular screen, the width and height are equal, and each divided square region forms a square frame.
[0062] Step 102: Determine the longitude and latitude boundaries of each of the square regions according to the map data;
[0063] For each divided square region, such as a square frame, it is necessary to determine its corresponding GPS longitude and latitude boundaries, which is achieved by calling the interface for converting screen pixel positions and longitude and latitude coordinates of the electronic device. Specifically, for the four corner points of each square region (i.e., the upper left, upper right, lower left, and lower right), the corresponding longitude and latitude coordinates are calculated according to their screen pixel coordinates, so as to obtain the longitude and latitude boundary range of each square region.
[0064] According to the screen pixel position and the longitude and latitude coordinate conversion interface, obtain the GPS longitude and latitude boundaries of Width / N of the current screen width and Height / N of the height, that is, the screen width and height are divided into N equal parts, N >= 1 and N <= Width. When it is a circular screen, that is, the width and height are equal, these square regions are micro-called later, and the pixel value boundaries of the square regions are selectively adjusted, which cannot be distinguished by the naked eye and belongs to a non-sensing operation.
[0065] Step 103: Obtain multiple layers corresponding to each of the square regions according to the longitude and latitude boundaries;
[0066] According to the formed square regions and the corresponding longitude and latitude boundaries of the square regions, generate multiple layers of the map data within each square region respectively. Among them, each layer corresponds to each object type. Each layer contains multiple objects, and the object types of the multiple objects are the same as the object type corresponding to the layer. The data volume of the layer is the data volume corresponding to each object. The generation of the layer can be divided according to needs. For example, it can be divided according to the object types included in the layer, that is, in one layer, it contains the data of all objects belonging to the same object type.
[0067] Among them, the object is geographical feature information in the map, such as: landforms: mountains, plains, hills, basins, etc., water systems: such as rivers, lakes, oceans, waterfalls, etc., vegetation: forests, grasslands, deserts, etc., settlements: names, locations, and scopes of cities, towns, villages, etc., transportation networks: roads (expressways, national highways, provincial highways, county roads, etc.), railways, bridges, tunnels, etc., public facilities: locations and names of schools, hospitals, government agencies, parks, etc. The above objects can be divided into layers according to their respective object types.
[0068] The object types of the objects include regional object types, point object types, linear object types, planar object types, and closed object types, etc. The regional objects include main roads, railways, parks, scenic spots, etc.; the point objects include place names, etc.; the linear objects include line information such as roads, rivers, etc.; the planar objects include: enclosed areas, such as area information of scenic spots, parks, etc.; the closed objects include elements within the curve, etc.
[0069] In the embodiment of the present application, the layers can be divided in the following manner:
[0070] Layer X2 1 : Determine the current province, city, and township according to the received GPS longitude and latitude, and use them as Layer X2 1 ;
[0071] Layer X2 2 : Use the above N square regions as X2 2 ;
[0072] Layer X2 3 : Multitask to parallelly obtain the total number of all elements such as main roads, railways, parks, scenic spots, etc. within each square region as X2 3 ;
[0073] Layer X2 4 : When traversing to points, such as point information like place names, save the GPS longitude and latitude coordinate information of the point and the corresponding unicode encoding value as X2 4 .
[0074] Layer X25: When traversing to line information, such as elements like roads, rivers, etc., calculate the road length according to the longitude and latitude coordinates passed by the road. Through quadratic linear fitting polynomial interpolation calculation, only save the information of multiple key points to reduce the storage capacity, and simplify it into a curve, that is, only the road length, without the road width, and specify the elements of the line to pixel points, and recombine the color format into the RGB mode represented by the minimum length. For example, each pixel was originally RGB256 and occupied 2 bytes in storage, and is converted to RGB8, which occupies 1 byte in storage, greatly reducing the storage capacity. As X2 5 .
[0075] Layer X2 6 : When traversing to area objects such as scenic spots and parks, for elements with area information, obtain the boundary key point information based on the latitude and longitude boundary values. The key points can be drawn into a smooth closed curve using a Bezier fitting polynomial, which reduces the number of traversal loops, consumes less time, and improves speed, serving as X2 6 .
[0076] Layer X2 7 : When traversing to closed object types, specify the elements within the closed perimeter curve to pixel points, and recombine the color format into the RGB mode represented by the minimum length. For example, each pixel was originally RGB256 (occupying 2 bytes in storage) and is converted to RGB8 (occupying 1 byte in storage), reducing the storage capacity, serving as X2 7 .
[0077] Layer X28: Determine whether there are mountain, desert, plateau, and plain terrains within the current screen range according to the region. Calculate the space complexity required to draw this data and the time complexity required to draw this type of data. If the time complexity and space complexity exceed the threshold (this threshold is obtained based on practical experience), then simplify the current terrain drawing and discard some elements if necessary, serving as the second-layer input X2 8 ;
[0078] Among them, the space complexity is the maximum additional memory space required during drawing. If the data itself is raw data, the space complexity is recorded as a constant order O(1) complexity, which can be understood as the memory capacity of a copy of the raw data. If the data itself only contains key points and new data needs to be combined from the key points during drawing, the space complexity is recorded as O(n) complexity, which can be understood as the raw copy memory plus the memory capacity generated through a certain rule (such as a linear function or a quadratic function). Finally, add up the memory required for each type of data to obtain the total consumed memory, which is recorded as the total data space complexity.
[0079] ……
[0080] Layer X2 n
[0081] It should be noted that the above layers can also be generated in other ways. In the embodiments of the present application, it is not limited. During the generation process of the above layers, on the one hand, objects of the same type are divided into the same layer, which facilitates data processing; on the other hand, during the layer division process, the layer data is also optimized to reduce the amount of data called when loading the map.
[0082] Step S200: Obtain the data information corresponding to each of the layers, where the data information includes the data volume corresponding to the layer;
[0083] When a single-finger or double-finger touch on the screen triggers a move or zoom message, start multi-task parallel execution, process the input parameters of the above layers respectively, and calculate the cached point, line, and surface information input for each layer X2n.
[0084] The data information of each of the layers includes the data information corresponding to each object within the layer. Therefore, the data volume Capacity corresponding to the layer is the sum of the data volumes corresponding to the objects within the layer.
[0085] Step S300: Determine the resource status required for each of the layers according to the configuration information of the electronic device and the data volumes of each of the layers;
[0086] In this step, process the data of each layer respectively to determine the resource status required for each layer.
[0087] Among them, the configuration information of the electronic device includes the CPU main frequency information Freq, memory information Heap, and file reading speed information F_Rate, etc. of the electronic device. These configuration information reflect the processing ability of the electronic device. At the same time, combine the data volume Capacity of the layer and the resolution factor N to determine the resource status required for the layer.
[0088] The required resource status Resource can be determined by the following formula:
[0089] Resource = (1 / Freq * F_Rate * N) + Capacity - Heap.
[0090] Step S400: Determine whether the resource status required for the layer is greater than a preset threshold;
[0091] The electronic device determines, based on the resource status required for each layer, whether it is greater than the preset threshold Threshold. If it is greater, go to step S500; otherwise, go to step S600.
[0092] Among them, the preset threshold Threshold is the upper limit value of the processing ability preset for the electronic device, and for different devices, the preset threshold can be different.
[0093] Step S500: Recursively correct the data information of the layer;
[0094] When the data volume corresponding to the layer exceeds the preset threshold, it indicates that the data information of the layer exceeds the processing ability of the electronic device, and the electronic device recursively corrects the data information of the layer.
[0095] The recursive correction is mainly used to optimize the data information of the layers, reduce the data loading amount corresponding to each layer, so as to ensure the smoothness and real-time display of the loading process when the electronic device loads the map.
[0096] After the recursive correction is completed, jump to step S400 again to determine whether the layer data information after the recursive correction meets the requirements. If it meets, directly go to step S600; otherwise, continue the recursive correction until the requirements of the preset threshold are met.
[0097] Step S600: Determine whether all layers are traversed;
[0098] If all layers are traversed, go to step S700; otherwise, go to step S400 to continue the recursive correction operation for other layers.
[0099] Step S700: Display the map according to the data information corresponding to each layer after the recursive correction;
[0100] After the recursive correction of the data information corresponding to each layer is completed, when loading the map, the data of each layer is drawn on the canvas (i.e., the buf in the code where a certain memory is stored) to form a layer, and each layer is superimposed in turn, which is the image data of a frame displayed on the screen. This frame of image data includes the superposition of multiple layers.
[0101] In summary, through the map display method provided by the embodiments of the present application, using the dynamic layer adjustment algorithm, for each zoom of the map, each data frame has been simplified, that is, conversely, each layer has been optimized, that is, the layer for each zoom display has been dynamically adjusted. The adjusted layer adapts to the screen display speed, can be loaded immediately, does not require delayed display, and realizes the rapid response of the real-time moving map and zoom map operations on the electronic device, greatly reducing the CPU running time and memory occupancy.
[0102] Further, in order to further improve the efficiency of the recursive correction of the layer data information in the above steps S400 and S500, in the embodiments of the present application, the above recursive correction process is further optimized, such as Figure 4 shown, step S400 is divided into step S411 and step S421.
[0103] Step S411: Determine whether the resource status required by the layer is greater than the first preset threshold;
[0104] Among them, the resource status Resource required by the layer is determined in step S300. In the embodiment of the present application, in order to recursively correct the layer data more quickly and accurately, the first preset threshold is set to a value that is slightly different from the ideal preset threshold. For example, if the ideal preset threshold is 1, the first preset threshold can be set to 1.1, with a deviation of about 10%. When the first preset threshold is met, that is, when the resource status required by the layer is greater than the first preset threshold, it means that the difference between the resource status of the layer and the ideal preset threshold is still relatively large. At this time, the layer data information can be corrected by a coarse adjustment method, and then go to step S511. Otherwise, go to step S421 for fine adjustment.
[0105] Step S511: obtaining intermediate temporary data corresponding to each object in the layer;
[0106] The intermediate temporary data is the data generated by the electronic device during the pixel simplification and curve fitting process. When multi-task operation is started, each real-time operating system RTOS task can be polled and allocated a certain time slice for recursive correction. Each task corresponds to an input for recursive correction, and the corresponding intermediate temporary data Dn generated by the calculation layer X2n is calculated.
[0107] Step S512: sorting the objects according to the amount of intermediate temporary data corresponding to each object, and obtaining a first set of objects to be optimized in descending order of data amount according to a preset first ratio;
[0108] During the coarse adjustment process, the data volume of the intermediate temporary data corresponding to the objects contained in each layer is sorted, and the data volume can be sorted in descending order. The data volume of the top-ranked objects can be obtained according to a preset first ratio or a first quantity. For example, 80% of the data volume corresponding to the layer is used to obtain the intermediate temporary data of the top-ranked objects with a large data volume for recursive correction; or, according to a predetermined quantity M, the data information of the top M objects is selected for optimization to form a first set of objects to be optimized, that is, the coarse adjustment only corrects the objects with a large data volume.
[0109] Step S513: modifying the data information of each object in the first set of objects to be optimized.
[0110] The first set of objects to be optimized includes M objects with a large amount of data. First, the data information of the top-ranked objects is recursively modified.
[0111] Then go to step S411. If the resource status required by the modified layer is still greater than the first preset threshold, continue to perform coarse adjustment optimization. Otherwise, go to step S421 for fine adjustment.
[0112] Step S421: Determine whether the resource status required by the layer is greater than a second preset threshold, where the difference between the first preset threshold and the second preset threshold is a preset adjustment difference;
[0113] After the rough adjustment of the layer data, go to step S421 to finely adjust the data information corresponding to the layer.
[0114] Perform a secondary judgment on the resource status of the layer after rough adjustment. If it is greater than the second preset threshold, go to step S521; otherwise, go to step S600.
[0115] Among them, the second preset threshold is an ideal preset threshold, that is, when the resource status required by the layer is less than or equal to the first preset threshold and greater than the second preset threshold. For example, when the resource status required by the layer is within 10% of the ideal preset threshold, the layer data is finely adjusted. The 10% is a user-defined preset adjustment difference and can be adjusted as needed.
[0116] Step S521: Then obtain the intermediate temporary data corresponding to each object in the layer;
[0117] Among them, the intermediate temporary data is the data generated by the electronic device during pixel simplification and curve fitting. Start multitasking operation, and each RTOS system task can be polled and allocated a certain time slice for recursive correction. Each task corresponds to an input for recursion to calculate the corresponding intermediate temporary data Dn generated by the layer X2n.
[0118] Step S522: Sort the objects according to the data volume of the intermediate temporary data corresponding to each object, and obtain a second set of objects to be optimized according to a preset second ratio in ascending order of data volume;
[0119] During the fine adjustment process, sort the data volumes of the intermediate temporary data corresponding to the objects of each layer. Sort them in ascending order of data volume. According to a preset second ratio or second quantity, etc., obtain the data volumes of the top P objects, and select to optimize these P objects to form a second set of objects to be optimized. For example, obtain the intermediate temporary data of the objects with smaller data volumes ranked among the top according to 20% of the layer data volume for recursive correction to form a second set of objects to be optimized, that is, the fine adjustment only corrects the objects with smaller data volumes.
[0120] Step S523: Correct the data information of each object in the second set of objects to be optimized.
[0121] The data information corresponding to the object with smaller data volume in the layer is recursively modified to fine-tune the layer data. After the fine-tuning is completed, go to step S421. If the resource status required by the modified layer is still greater than the second preset threshold, continue to fine-tune the optimization, otherwise go to step S600.
[0122] In summary, the above embodiment recursively corrects the data information in the layer by combining coarse adjustment and fine adjustment, which greatly improves the efficiency of data adjustment, reduces the resource occupation of correction, and can greatly improve the loading speed and efficiency of the map.
[0123] In the above embodiment, after each recursive correction, the data information of the layer after recursive correction can be stored in the hash table, so that before recursively correcting the data information of the layer, it can be first determined whether the hash table contains the data information of the layer. If it does, the data information of the layer after recursive correction is directly called without any further calculation; if it does not, the layer data is recursively corrected. In this way, repeated optimization of data is avoided and the optimization efficiency of layer data is improved.
[0124] Furthermore, based on the above-mentioned layer optimization, the map data may be optimized again to maximize the map loading efficiency. The embodiment of the present application provides further optimization for the processing method of each layer in the overlay process in step S700.
[0125] According to the data information of each layer after recursive correction, each layer is superimposed in turn. For example, 1 、 X2 2 …… X2 n The order of superposition is X2 1 As the bottom layer, X2 n As the top layer; if the data information between the layers is repeated, the data information corresponding to the top layer is retained; that is, in the process of superimposing different layers, if certain data ranges are superimposed and duplication occurs, for example: if a certain area of the display screen has data from the bottom layer to the top layer, then only the data information of the top layer is retained, and the data information of other layers is removed.
[0126] If the data from the bottom layer to the top layer is empty, that is, the said layers all contain objectless areas, then crop the objectless areas, that is, crop the blank areas of these layers to reduce memory occupancy. For example, several patterned papers are stacked together. For a certain patterned area, with the naked eye, only the pattern on the topmost paper can be seen, then removing the other layers of paper will not affect the user experience; for the area without a pattern, the objectless areas on all layers can be cropped, and it will also not affect the user experience.
[0127] Similarly, when the map is loaded, fine-tuning of pixel values can be performed at the end, that is, some pixels within the entire screen are cropped and not displayed. If the screen is large and there are many pixel points, some pixels can be cropped. The standard is that there is no distinguishable difference to the naked eye of a person. According to different screen sizes and specific requirements, it is judged based on empirical values.
[0128] In summary, through the map display method proposed in the embodiments of the present application, the electronic device can determine the resource status required when loading the map according to its own configuration and the data volume of each layer to be loaded. When the resource status required by the layer exceeds the optimal loading resource value of the electronic device, that is, exceeds the preset threshold, then the data information of each layer is recursively corrected until the requirements of the optimal loading resource value of the electronic device are met. After the electronic device recursively corrects the data information of each layer, it displays the map according to the recursively corrected data information of each layer. In this way, while ensuring the map display effect, the resource occupancy of data loading is greatly reduced, and the map loading speed is improved.
[0129] In some embodiments, after obtaining the optimal model of the area within the current screen range through the above map display method, the historical data can also be learned and stored. When performing a zoom operation next time, it can be immediately used without having to perform recursive correction again, which can greatly reduce the CPU running time and achieve fast zooming or map movement.
[0130] In subsequent map zoom operations, the electronic device loads the recursively corrected data information of each layer into the cache buf. This cache only requires a very small value, for example: only 2 buf and within about 1M byte of space are needed to achieve fast response, unlike the Android system which often requires dozens of M byte of space.
[0131] Furthermore, in some embodiments, a map display device 800 is also provided. The map display device 800 includes a map data acquisition module 801, a layer data acquisition module 802, a resource acquisition module 803, a recursive correction module 804, and a display module 805.
[0132] The map data acquisition module 801 is configured to acquire map data in response to an operation on the map, where the map data includes multiple layers;
[0133] The layer data acquisition module 802 is configured to acquire data information corresponding to each of the layers, where the data information includes the data volume corresponding to the layer;
[0134] The resource acquisition module 803 is configured to determine the resource status required for each of the layers according to the configuration information of the electronic device and the data volume of each of the layers;
[0135] The recursive correction module 804 is configured to recursively correct the data information of the layer when the resource status required for the layer is greater than a preset threshold until the resource status required for the layer is less than or equal to the preset threshold; and is further configured to traverse all the layers until the recursive correction of the data information of all the layers is completed;
[0136] The display module 805 is configured to perform map display according to the data information corresponding to each layer after recursive correction.
[0137] An embodiment of the present application further provides a computer-readable storage medium, in which executable instructions are stored. When the executable instructions run on an electronic device, the electronic device is enabled to perform the operations of the map display method provided in any of the above embodiments.
[0138] An embodiment of the present application further provides a map display program, and the map display program is configured to execute the map display method provided in the above embodiment.
[0139] The algorithms or displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The structure required to construct such a system will be apparent from the above description. In addition, embodiments of the present application are not directed to any particular programming language. It should be understood that the content of the present application described herein can be implemented using various programming languages, and the above description of a particular language is to disclose the best mode of the present application.
[0140] In the specification provided herein, a large number of specific details are set forth. However, it can be understood that embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures, and technologies have not been shown in detail so as not to obscure the understanding of this specification.
[0141] Similarly, it should be understood that, in order to streamline the present application and assist in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the embodiments of the present application are sometimes grouped together into a single embodiment, figure, or description thereof.
[0142] Those skilled in the art can understand that the modules in the devices in the embodiments can be adaptively changed and arranged in one or more devices different from those of the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and they can also be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all the features disclosed in this specification (including the accompanying abstract and drawings) and all the processes or units of any method or device so disclosed. Unless otherwise explicitly stated, each feature disclosed in this specification (including the accompanying abstract and drawings) can be replaced by an alternative feature that provides the same, equivalent or similar purpose.
[0143] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and those skilled in the art can design alternative embodiments without departing from the scope. The steps in the above embodiments, unless otherwise specified, should not be construed as a limitation on the execution order.
Claims
1. A map display method, applied to an electronic device, characterized in that The method includes: In response to an operation on the map, obtaining map data, where the map data includes multiple layers; Obtaining data information corresponding to each of the layers, where the data information includes the data volume corresponding to the layer; Determining the resource status required for each of the layers according to the configuration information of the electronic device and the data volume of each of the layers; If the resource status required for the layer is greater than a preset threshold, recursively correcting the data information of the layer until the resource status required for the layer is less than or equal to the preset threshold; Traversing all the layers until the recursive correction of the data information of all the layers is completed; Performing map display according to the data information corresponding to each of the layers after recursive correction.
2. The map display method according to claim 1, wherein The method further includes: Generating N square regions according to the screen pixel information of the electronic device and a preset resolution factor N, where N is a natural number; Determining the longitude and latitude boundaries of each of the square regions according to the map data; Obtaining multiple layers corresponding to each of the square regions according to the longitude and latitude boundaries.
3. The map display method according to claim 2, characterized in that Each of the layers corresponds to an object type respectively, each of the layers includes multiple objects, the object type of the multiple objects is the same as the object type corresponding to the layer, and the data volume corresponding to the layer is the data volume corresponding to each of the objects; The object types include area object type, point object type, line object type, surface object type, and closed object type.
4. The map display method according to claim 3, wherein The configuration information of the electronic device includes CPU main frequency information Freq, memory information Heap, and file reading speed information F_Rate; The determining the resource status required for each of the layers according to the configuration information of the electronic device and the data volume of each of the layers includes: Determining the resource status required for the layer according to the resolution factor N, the data volume Capacity of the layer, and the CPU main frequency information Freq, memory information Heap, and file reading speed information F_Rate of the electronic device.
5. The map display method according to claim 4, wherein The if the resource status required for the layer is greater than a preset threshold, then recursively correcting the data information of the layer includes: If the resource status required for the layer is greater than a first preset threshold, then obtaining intermediate temporary data corresponding to each of the objects in the layer; Sorting the objects according to the data volume of the intermediate temporary data corresponding to each of the objects, and obtaining a first set of objects to be optimized according to a preset first ratio in the order of decreasing data volume; Correcting the data information of each of the objects in the first set of objects to be optimized.
6. The map display method according to claim 5, wherein The if the resource status required for the layer is greater than a preset threshold, then recursively correcting the data information of the layer further includes: If the resource status required for the layer is greater than a second preset threshold and less than or equal to the first preset threshold, where the difference between the first preset threshold and the second preset threshold is a preset adjustment difference, then obtaining intermediate temporary data corresponding to each of the objects in the layer; Sort the objects according to the data volume of the intermediate temporary data corresponding to each object, and obtain a second set of objects to be optimized according to a preset second ratio in ascending order of data volume; Correct the data information of each object in the second set of objects to be optimized.
7. The map display method according to claim 6, characterized in that, The method further includes: Store the data information of the layer after recursive correction in a hash table; Before recursively correcting the data information of the layer, it further includes: Determine whether the hash table contains the data information of the layer. If it exists, directly call the data information of the layer after recursive correction.
8. The map display method according to claim 3, wherein The map display according to the data information corresponding to each layer after recursive correction includes: Overlay each layer in turn according to the data information of each layer after recursive correction; If there are duplicates in the data information between the layers, retain the data information corresponding to the top layer; If the top layer contains an area without objects, crop the area without objects.
9. An electronic device, characterized in that, It includes: A processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface complete communication with each other through the communication bus; The memory is used to store at least one program, and the program causes the processor to execute the operations of the map display method according to any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, At least one program is stored in the storage medium. When the program runs on an electronic device, the electronic device is caused to execute the operations of the map display method according to any one of claims 1-8.