Natural algorithm for map data optimization display
By converting geographic coordinates into planar coordinates and dividing them into grids, and combining the movement rules of description points and center points, the problems of adaptability and display deviation in map data processing are solved, and efficient and accurate map data display is achieved.
Patent Information
- Application Number
- CN202511752466.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-26
- Publication Date
- 2026-02-27
AI Technical Summary
Existing technologies for map data processing suffer from poor screen compatibility with terminal devices, uneven resource allocation, and location deviations in map prompts, resulting in low data processing efficiency and insufficient display accuracy.
By converting geographic coordinates into planar coordinates, combining the screen size of the terminal device and the height of the map, an appropriate grid is divided. By describing the movement rules and termination conditions of points and the center point, the location of map prompt data is precisely controlled to ensure balanced data distribution and accurate display.
It improves the adaptability of map data processing and the efficiency of resource utilization, solves the problems of uneven data distribution and display deviation, and significantly improves the accuracy of map data display and user viewing experience.
Smart Images

Figure CN121582389A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of map data optimization technology, and in particular to a natural algorithm for optimizing map data display. Background Technology
[0002] As the types of terminal devices become increasingly diverse, and screen sizes vary across different devices, users' demands for the clarity and adaptability of map data displays are gradually increasing. In the application of map data, geographic coordinates need to be converted into planar coordinates suitable for the terminal screen, and map prompt data needs to undergo multi-stage processing, including data source segmentation, preliminary and secondary processing of descriptive data, processing of longitude center points, and processing of connecting line data, to achieve a reasonable presentation of map information. Simultaneously, map data includes various types of information such as regional center point coordinates, shape parameters, and prompt content. Orderly processing is necessary to ensure the synergistic effect of these data types, meeting users' needs for map display in different scenarios and providing a foundation of real-world application scenarios for subsequent algorithm optimization.
[0003] Existing technologies for map data processing suffer from two significant drawbacks. Firstly, the map data conversion and grid division stages lack a precise adaptation mechanism for the screen width and map height of terminal devices. This makes it difficult to allocate data resources rationally based on actual data characteristics, leading to resource waste or uneven data distribution during processing, impacting the efficiency and stability of subsequent data processing stages. Secondly, the adjustment of center points and the processing of connecting lines in map prompt data lack scientific movement rules and termination conditions. This makes it impossible to accurately control the relative positions of description points and center points, and also fails to properly handle connecting lines that exceed screen boundaries. Consequently, map prompt information display is prone to positional deviations, reducing the accuracy of map data display and the user viewing experience. Summary of the Invention
[0004] In order to overcome the shortcomings and deficiencies of existing technologies, this invention provides a natural algorithm for optimizing map data display.
[0005] The technical solution adopted in this invention is a natural algorithm for optimizing map data display, comprising the following steps: S1, Map drawing: Converting map data into a set of latitude and longitude points; based on the screen size of the terminal device or a specified area, and combining the Earth's radius parameter, converting geographical coordinates into planar coordinates using mathematical formulas; drawing the planar coordinates and area name information on the terminal device, reserving a certain area space in the left and right directions during calculation; S2, Map prompt data source segmentation: Extracting the longitude of the center points of each region in the map data after S1 conversion; sorting the data by longitude and dividing it into two data sources; then sorting the latitude coordinates of the map data center points in the two data sources by latitude; S3, Preliminary processing of map prompt data description data: Based on the data sources obtained from the S2 segmentation, processing four data items: outline height, longitude direction interval, center point of the displayed content, and height of the displayed content, and forming a set; dividing the set into appropriately sized grids based on the width of the terminal device screen and the height of the map outline; S4, Map prompt data longitude direction center point processing: Based on the description data obtained from S3, comparing the vertical distance of the center point of the displayed content on the grid. The description points and center points are set to move within a fixed range, based on the center point of the plane coordinates obtained in S1. The rule is that the description point moves south when it is above the center point and north when it is below it, with a fixed multiple gap. The process stops when the vertical difference between the description point and the center point is within a suitable distance. All description data are processed multiple times until the distance between each map center point reaches a suitable distance, calculating the set of minimum vertical values that satisfy all description points and their corresponding center points. S5, secondary processing of the map prompt data description data: Based on the data obtained in S4, the center point data of the corresponding data displayed in S3 is updated. The width is calculated based on the text size of the prompt data. The starting points of the left and right description data are fixed, and some shape parameters of the description data are processed. S6, processing of the line data of the map prompt data description data: Based on the width, height, horizontal starting point, and vertical center point of the description data obtained in S5, the corresponding plane position is calculated. Half the width of the terminal device screen is used as the dividing line, compared with the center point obtained in S1, so that the line data exceeding the dividing line extends by a certain distance.
[0006] Furthermore, the formula for converting geographic coordinates to planar coordinates in S1 is as follows: ;in, The x-coordinate represents the plane coordinate system. The ordinate representing the planar coordinate system. Represents the Earth's radius parameter. Longitude values representing geographic coordinates The latitude value represents the geographic coordinates. Represents the baseline latitude value of the specified area.
[0007] Furthermore, the size of the mesh in S3 is calculated using the following formula: ;in, Represents the width of the grid. Represents the height of the grid. Represents the screen width of the terminal device. Represents the height of the map's outline. This represents the number of grid cells divided horizontally. This represents the number of grid cells divided in the vertical direction.
[0008] Furthermore, the calculation of the distance the description point moves in S4 uses the following formula: ;in, This represents the distance the point was moved. Represents the moving average coefficient. Represents the verticality value of the description point. The vertical value representing the center point.
[0009] Furthermore, the width of the prompt content data in S5 is calculated using the following formula: ;in, This represents the width of the prompt content data. The first one in the representative prompt content Width coefficient of each character, Represents the text size parameter. This represents the total number of characters in the prompt content.
[0010] Furthermore, the calculation of the extension distance of the connection data exceeding the boundary line in S6 uses the following formula: ;in, This represents the distance the data is extended by the connection. Represents the elongation coefficient. This represents the x-coordinate of the center point obtained from S1. This represents the screen width of the terminal device.
[0011] Further, S2 includes the following sub-steps: S21, extracting the longitude information of the center point corresponding to each region in the map data after S1 transformation, ensuring that each region corresponds to only one center point of longitude data, and not omitting the longitude extraction of any region; S22, arranging all the extracted longitude data in descending or ascending order, maintaining the correlation between each longitude data and the corresponding region during the arrangement process, and avoiding data confusion; S23, dividing the sorted longitude data into two equal parts to form two independent data sources, ensuring that the difference in the number of data in the two data sources does not exceed one, and ensuring the balance of data distribution; S24, extracting the latitude coordinates of the center points of each region in the two data sources respectively, and then sorting the latitude coordinates in each data source according to the set order, maintaining the correspondence between latitude coordinates and regions and corresponding longitude data after sorting.
[0012] Further, step S3 includes the following sub-steps: S31, for each data source obtained from the segmentation in S2, extract the shape height information corresponding to each data point one by one. During the extraction process, the shape height value is determined based on the data's own attribute characteristics to ensure data accuracy; S32, calculate the interval of data in the longitude direction within each data source. By analyzing the longitude differences between data points, determine a reasonable interval value so that the interval meets the requirements of subsequent processing; S33, determine the center point of the display content corresponding to each data point. Combine the data location and display requirements to accurately locate the position parameters of the center point; S34, obtain the height data of the display content for each data point. Based on the type and specifications of the display content, determine the specific height value. Then, combine the four data points—shape height, longitude interval, center point of the display content, and height of the display content—into a set, and then divide the data into a grid based on the screen width of the terminal device and the shape height of the map.
[0013] Further, step S4 includes the following sub-steps: S41, extracting the vertical value of the center point of the display content corresponding to each description data from the description data set obtained in S3, and simultaneously extracting the vertical value of the center point of the planar coordinates obtained in S1; S42, comparing the vertical value of the center point of the display content of each description data with the vertical value of the center point of the corresponding planar coordinates on the divided grid, and recording the comparison results; S43, based on the comparison results, setting each description point and its corresponding center point to move within a fixed spatial range, controlling the movement direction according to the rule that the description point moves south above the center point and moves north below the center point; S44, during the movement process, reserving a fixed multiple of the gap between each description point and the center point, repeatedly running the movement process of all description data until the difference in the vertical direction between each description point and its corresponding center point is within a suitable distance, and then calculating the set of minimum vertical direction values that meet the requirements.
[0014] Further, step S5 includes the following sub-steps: S51, extracting relevant data corresponding to each descriptive data from the set of minimum vertical direction values calculated in S4, and using this data as the basis for updating the descriptive data in S3; S52, updating the center point data of the display content corresponding to each descriptive data in S3 based on the extracted data, ensuring the consistency of the center point data with other relevant data during the update process; S53, obtaining the text size parameter of the prompt content data, and calculating the width value of each prompt content data according to the correspondence between text size and width; S54, determining and fixing the starting point positions of the left and right descriptive data to avoid the starting point shifting in subsequent processing, and adjusting some shape parameters of the descriptive data to make the shape parameters meet the display requirements.
[0015] Beneficial Effects: This invention proposes a natural algorithm for optimizing map data display. Regarding adaptability and resource utilization, the algorithm first converts geographic coordinates into planar coordinates by combining parameters such as terminal device screen size and map height. Then, it divides the map into appropriate grids based on screen width and map height, establishing a precise adaptation mechanism. This avoids uneven data distribution and resource waste, solving the problem of poor adaptability in the data conversion and grid division stages of existing technologies, and improving data processing efficiency and stability. Regarding display accuracy, the algorithm performs multi-stage fine-tuning of map prompt data. First, it segments and sorts the data sources. Then, by setting rules for the movement of description points and termination conditions, it repeatedly adjusts the relative positions of description points and the center point to ensure that the vertical difference between them is within a suitable range. Simultaneously, it fixes the starting point of the description data and processes the extension distance of connecting lines, precisely controlling the position of prompt information and the display of connecting lines. This solves the display deviation problems caused by the lack of scientific rules for center point adjustment and unreasonable line processing in existing technologies, significantly improving the accuracy of map data display, optimizing the user viewing experience, and meeting users' high-quality map display needs in different scenarios. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating the overall steps of the algorithm of the present invention; Figure 2 This is a flowchart of algorithm step S2 of the present invention; Figure 3 This is a flowchart of algorithm step S3 of the present invention; Figure 4 This is a flowchart of algorithm step S4 of the present invention; Figure 5 This is a flowchart of algorithm step S5 of the present invention. Detailed Implementation
[0017] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0018] like Figure 1 As shown, a natural algorithm for optimizing map data display includes the following steps: S1, Map drawing: Convert map data into a set of latitude and longitude points. Based on the screen size of the terminal device or a specified area, and combined with the Earth's radius parameter, convert the geographic coordinates into planar coordinates using mathematical formulas. Draw the planar coordinates and area name information on the terminal device. During calculation, a certain area space is reserved in the left and right directions. Specifically, the S1 map drawing process begins by collecting a set of latitude and longitude points for the map, determining the width and height of the terminal device screen, and using the Earth's radius as a fixed geographical parameter to accurately convert each latitude and longitude point into planar coordinates. During this conversion, the accuracy of the coordinate calculations must be ensured to avoid positional deviations in subsequent displays. When drawing the planar coordinates and corresponding area names, a space of one-tenth of the screen width must be reserved on the left and right sides. For example, if the screen width is 1000, 100 pixels should be reserved on each side. This reservation effectively prevents content crowding when adding map prompts later, establishing a reasonable initial framework for the complete presentation of map information. The quality of this step directly determines the compatibility between the map and the terminal device. Insufficient conversion accuracy or unreasonable space reservation will lead to deviations in the basic data of all subsequent processing stages, thus affecting the final map display effect. Therefore, the calculation process of coordinate conversion and the setting of the space reservation ratio must be strictly controlled to ensure that the initial display framework not only conforms to the characteristics of the terminal but also meets the space requirements of subsequent data processing.
[0019] S2, Map prompts data source segmentation: Extract the longitude of the center point of each region in the map data after S1 transformation, sort the data by longitude, divide the data into two data sources, and then sort the latitude coordinates of the map data center points in the two data sources by latitude. Specifically, the S2 map prompts the data source segmentation steps. During implementation, firstly, the longitude information of the center points of all regions in the map data transformed by S1 is comprehensively extracted. During extraction, each region must be checked one by one to ensure that no region's longitude data is missed. Then, all extracted longitude data are sorted in descending order. During sorting, a table linking longitude data with corresponding region names must be created to prevent confusion in the data-region correspondence. If the total number of extracted longitude data entries is 100, after sorting, they are divided equally into two independent data sources, each with 50 entries. If the total number of entries is 101, one data source will have 50 entries, and the other will have 51 entries, ensuring data separation. Balance of distribution; after completing the longitude data segmentation, the latitude coordinates of the center points of each region in the two data sources are extracted, and then the latitude coordinates in each data source are sorted in ascending order. During the sorting process, the correlation between latitude data and region names and corresponding longitude data needs to be continuously checked to ensure that all coordinate data in the two data sources after segmentation can accurately correspond to specific regions. This step, through ordered segmentation and sorting, decomposes the originally complex map prompt data into clearly structured subsets, greatly reducing the amount of computation in subsequent processing steps, reducing the complexity of data processing, and maintaining data correlation, providing an orderly data foundation for subsequent accurate processing.
[0020] S3, Preliminary processing of map prompt data description data: Based on the data source obtained from the segmentation in S2, process the four data items of shape height, longitude direction interval, center point of displayed content, and height of displayed content and form a set. According to the screen width of the terminal device and the height of the map shape, divide it into grids of appropriate size. Specifically, S3 describes the preliminary data processing steps. During implementation, operations are performed on the two data sources obtained from S2. For each data point in each data source, four key parameters are extracted: outline height, longitude interval, center point of the displayed content, and height of the displayed content. The outline height is set to a range of 20 to 50, with the specific value determined based on the map element type corresponding to the data. For example, the outline height is set to 40 for city-level data and 25 for district / county-level data. The longitude interval is obtained by calculating the difference between the longitude values of two adjacent data points within the data source and then averaging all the differences. For example, if the longitude differences between adjacent data points within a data source are 10, 12, and 8, then the interval is set to 10. The center point of the displayed content is directly taken as the center point based on the planar coordinates obtained from S1. Initial position; the height of the displayed content ranges from 15 to 35, also determined by the data type, such as 35 for important prompts and 15 for ordinary prompts; after integrating these four parameters into the descriptive data set for each data point, the grid is divided according to the screen width and map outline height of the terminal device. If the screen width is 1200 and the map outline height is 960, the screen is divided into a grid of 24 columns and 16 rows, with each column width of 50 and each row height of 60. During the division process, it is necessary to ensure that the grid boundaries are aligned with the screen edges. This step provides a unified processing benchmark for subsequent data position adjustments by extracting key parameters and establishing a standardized grid, so that the descriptive data has a standardized structure, ensuring the orderliness and accuracy of subsequent processing, and avoiding processing deviations caused by chaotic data parameters or unreasonable grid division.
[0021] S4, Map prompt data longitude direction center point processing: Based on the description data obtained in S3, compare the vertical value of the center point of the displayed content with the center point of the planar coordinates obtained in S1 on the grid. Set the description point and the center point to move within a fixed range, adopting the rule that the description point moves south when it is above the center point and moves north when it is below the center point, and reserve a fixed multiple gap. The stopping condition is that the vertical difference between the description point and the center point is within a suitable distance. Run all description data multiple times until the distance between each map center point reaches a suitable distance, and calculate the set of all description points and their corresponding center points with the minimum vertical direction values. Specifically, the S4 longitude direction center point processing steps involve first extracting the vertical value of the display content center point corresponding to each set of description data obtained in S3, and simultaneously extracting the vertical value of the plane coordinate center point obtained in S1 for that data. During the extraction process, it is crucial to ensure that the measurement standards for both vertical values are consistent. On the grid divided in S3, the vertical value of the display content center point for each set of description data is compared one by one with the vertical value of the corresponding plane coordinate center point. The comparison result for each set of data is recorded. If the vertical value of the display content center point is greater than the vertical value of the plane coordinate center point, the description point is determined to be above the center point; otherwise, it is below. The description point and center point are allowed to move within a 30° range vertically. The movement rule is that if the description point is above the center point, it moves south; if it is below, it moves north. During the process, a gap of twice the height of the displayed data should be reserved between the two. For example, if the height of the displayed content is 30, a gap of 60 should be reserved. The movement process of all description data should be repeated according to this rule. After each movement, the vertical difference between the description point and the center point should be recalculated until the vertical difference between all description points and their corresponding center points is within 5. Then, the movement should be stopped and the vertical value of each data point should be recorded. Finally, the set of the minimum vertical values of all description points and their corresponding center points should be obtained. This step, through clear movement rules and termination conditions, accurately adjusts the positional relationship between description points and center points, effectively reduces the overlap or positional deviation when displaying map prompts, and significantly improves the display accuracy. It is the core link in optimizing the map information display effect and directly affects the clarity of prompts obtained by users.
[0022] S5, secondary processing of map prompt data description data: Based on the data obtained in S4, update the center point data of the corresponding data display content in S3, calculate the width according to the text size of the prompt data, fix the starting point of the left and right side description data, and process some shape parameters of the description data. Specifically, in the S5 description data secondary processing step, the first step is to extract the vertical direction value corresponding to each description data from the minimum vertical direction value set calculated in S4. This value is used as the basis for updating the center point of the corresponding description data display content in S3. During the update, the vertical value of the display content center point in S3 needs to be replaced with the minimum vertical direction value obtained in S4, while keeping the horizontal value of the center point unchanged to ensure that the center point position adjustment is only carried out in the vertical direction and avoids deviation in the horizontal direction. Then, the width of the prompt content for each description data is calculated. The calculation method is determined according to the text size of the prompt content. The text size is set according to a fixed standard, such as 16 for level 1, 14 for level 2, and 12 for level 3. The width of each character is calculated as 0.6 times the text size. For example, when the text size is 16, the width of each character is 9.6. If the prompt content has 10 characters... The total width is 96. After calculating the width, the starting point positions of the left and right description data are fixed. The starting point of the left description data is set to 15 units away from the left side of the screen, and the starting point of the right description data is set to 15 units away from the right side of the screen. Once the starting point positions are fixed, they will not be changed in subsequent processing. At the same time, the outline height of the description data is adjusted by adding 5 units to the outline height determined in S3. For example, if the outline height in S3 is 40 units, it will be adjusted to 45 units. The height adjustment must ensure that the adjustment range of all data is consistent to avoid the situation that some data have abnormal heights. This step further improves the attributes of the description data by updating the center point, calculating the width, fixing the starting point, and adjusting the height, so that the data is more in line with the display requirements of the terminal screen and provides data support for the final presentation of clear and standardized map prompt information, ensuring that the prompt information meets the display standards in terms of position and size.
[0023] S6, processing of line data for map prompt data description data: Based on the width, height, horizontal starting point, and vertical center point of the description data obtained in S5, calculate the corresponding planar position, take half the width of the terminal device screen as the dividing line, compare it with the center point obtained in S1, and extend the line data beyond the dividing line by a certain distance.
[0024] Specifically, the S6 connection data processing steps, during implementation, first calculate the specific planar position of each descriptive data item on the terminal screen based on the four parameters obtained from S5: width, height, horizontal starting point, and vertical center point. During the calculation, the top left corner of the screen is taken as the origin, the horizontal direction to the right is the positive horizontal direction, and the vertical direction downwards is the positive vertical direction. The horizontal coordinate of the planar position is the horizontal starting point, and the vertical coordinate is the vertical center point minus half the height. For example, if the descriptive data width is 100, the height is 30, the horizontal starting point is 200, and the vertical center point is 500, then the horizontal coordinate of the planar position is 200, and the vertical coordinate is 485. After the calculation, half the width of the terminal device screen is used as the dividing line. If the screen width is 1000, the horizontal coordinate of the dividing line is 500; if the screen width is 1400, the dividing line is 700. The horizontal coordinate of each descriptive data point's planar position is compared with the horizontal coordinate of the boundary line. If the horizontal coordinate of the planar position exceeds the boundary line, the connection data for that data needs to be extended. The extension distance is set to 30, and the extension direction is outward from the center of the screen. That is, when the planar position is to the right of the boundary line, the connection extends 30 to the right, and when it is to the left, it extends 30 to the left. During the extension process, it is necessary to ensure that the starting point of the connection is the edge of the planar position of the descriptive data, the ending point is the extended position, and the thickness of the connection remains consistent, such as being set to 2. This step, through accurate calculation of the planar position and reasonable handling of the connection extension, ensures that the connection between the map prompt data and the corresponding center point is displayed completely, avoiding the connection being truncated due to the screen boundary, ensuring the integrity of the association between the prompt information and the center point, allowing users to clearly identify the map position corresponding to each prompt information, and improving the coherence and accuracy of information acquisition.
[0025] Preferably, the formula for converting geographic coordinates to planar coordinates in S1 is: ;in, The x-coordinate represents the plane coordinate system. The ordinate representing the planar coordinate system. Represents the Earth's radius parameter. Longitude values representing geographic coordinates The latitude value represents the geographic coordinates. Represents the baseline latitude value of the specified area.
[0026] Specifically, the conversion of geographic coordinates in S1 to planar coordinates involves a specific calculation method to achieve the coordinate system transformation. During implementation, the Earth's radius parameter is first determined, with a value of 6371. This value is based on the standard setting of the Earth's average radius, ensuring the accuracy of the coordinate conversion benchmark. Next, the longitude and latitude values of each point are obtained, and a benchmark latitude value for the specified area is determined. The benchmark latitude value needs to be determined based on the target area displayed on the map; for example, when displaying an area from 30°N to 40°N, the benchmark latitude value can be set to 35. During calculation, the longitude value is first multiplied by the cosine of the benchmark latitude value, and then multiplied by the Earth's radius parameter to obtain the abscissa of the planar coordinates; the latitude value is directly multiplied by the Earth's radius parameter to obtain the ordinate of the planar coordinates. This process uses unified parameter standards and calculation logic to accurately convert spherical geographic coordinates into planar coordinates suitable for display on terminal screens, avoiding map distortion caused by differences in coordinate systems. The fixed value of the Earth radius parameter ensures the consistency of coordinate conversion in different regions, while the reasonable setting of the reference latitude value reduces the error of coordinate conversion in specific regions, ensuring that the converted planar coordinates can accurately reflect the relative positional relationship of geographic points, laying a precise data foundation for subsequent map drawing.
[0027] Preferably, the size of the grid in S3 is calculated using the following formula: ;in, Represents the width of the grid. Represents the height of the grid. Represents the screen width of the terminal device. Represents the height of the map's outline. This represents the number of grid cells divided horizontally. This represents the number of grid cells divided in the vertical direction.
[0028] Specifically, the S3 gridding process provides a standardized spatial framework for describing data processing. During implementation, the specific values of the terminal device screen width and map outline height are first obtained. The screen width is set according to common terminal types, such as 1080 for mobile phones and 2048 for tablets. The map outline height is determined based on the screen ratio and display requirements; if the screen width is 1080 and the screen ratio is 16:9, the map outline height is set to 608. Next, the number of grids in the horizontal and vertical directions is determined. The number of horizontal grids needs to be set in conjunction with the screen width and data density; for example, 36 for a screen width of 1080. The number of vertical grids is set in conjunction with the map outline height; for example, 19 for a height of 608. During calculation, the screen width is divided by the number of horizontal grids to obtain the grid width (1080 divided by 36 equals 30); the map outline height is divided by the number of vertical grids to obtain the grid height (608 divided by 19 equals 32). This step divides the data into uniformly sized grids through clearly defined parameter values and calculation methods, enabling subsequent description data to be processed within a unified spatial unit. The specific values of screen width and map outline height ensure that the grid is fully adapted to the terminal display area. The reasonable setting of the number of grids in the horizontal and vertical directions balances data processing accuracy and calculation efficiency, avoiding excessive computation due to overly dense grids or insufficient processing accuracy due to overly sparse grids, thus providing accurate spatial reference for adjusting the position of description data.
[0029] Preferably, the calculation of the distance the description point moves in S4 uses the following formula: ;in, This represents the distance the point was moved. Represents the moving average coefficient. Represents the verticality value of the description point. The vertical value representing the center point.
[0030] Specifically, the purpose of calculating the movement distance of the description point in S4 is to precisely control the movement range of the description point and ensure a reasonable relationship with the center point. In implementation, a movement coefficient is first set, determined based on the map scaling ratio and data density. When the map scaling ratio is 1:100000 and the data density is moderate, the movement coefficient is set to 0.8. Next, the vertical value of the description point and the corresponding vertical value of the center point are extracted for each description data point. The vertical value of the description point is obtained from the description data set in S3, and the vertical value of the center point is obtained from the planar coordinate data in S1. Both are measured in fixed pixel units, with the top of the screen as the reference. During calculation, the absolute value of the difference between the vertical value of the description point and the vertical value of the center point is first calculated, and then this absolute value is multiplied by the movement coefficient to obtain the movement distance of the description point. For example, if the vertical value of the description point is 500 and the vertical value of the center point is 480, the absolute value of the difference is 20, and multiplying by 0.8 results in a movement distance of 16. This step, through the reasonable setting of the movement coefficient and the calculation of the difference, ensures that the movement distance of the description point can effectively adjust the positional deviation without causing the position to become out of control due to excessive movement. The numerical setting of the movement coefficient takes into account both adjustment efficiency and stability, and the calculation of the absolute value of the difference ensures that the movement direction does not affect the distance. The direction is controlled only by subsequent rules, thereby achieving precise vertical alignment between the description point and the center point. This lays the foundation for reaching the termination condition and improves the accuracy of the map prompt information display.
[0031] Preferably, the width of the prompt content data in S5 is calculated using the following formula: ;in, This represents the width of the prompt content data. The first one in the representative prompt content Width coefficient of each character, Represents the text size parameter. This represents the total number of characters in the prompt content.
[0032] Specifically, the core of S5's prompt content data width calculation steps is to determine the display width of the prompt content based on text characteristics, avoiding content truncation or wasted space during display. In implementation, first, the width coefficient of each character is determined. This coefficient is set according to the font and display standard; when using standard Song typeface, the width coefficient is set to 0.55. Next, the text size parameter of the prompt content is obtained. The text size is graded according to the importance of the prompt information: important prompts have a text size of 18, and ordinary prompts have a text size of 14. The total number of characters in the prompt content is counted, requiring a character-by-character count, including Chinese characters, numbers, and symbols, to ensure no omissions. During calculation, the width coefficient of each character is multiplied by the text size parameter to obtain the width of a single character. For example, with a width coefficient of 0.55 and a text size of 18, the width of a single character is 9.9. Then, the width of a single character is multiplied by the total number of characters to obtain the total width of the prompt content data. If the total number of characters is 12, the total width is 118.8. This step precisely quantifies the display width of the prompt content through specific parameters and calculations of the width coefficient, text size, and total number of characters. The fixed value of the width coefficient ensures the consistency of character width under the same font, the hierarchical setting of text size meets the display needs of prompts of different importance, and the accurate statistics of the total number of characters ensure that the width calculation is without deviation. This provides a basis for fixing the starting point of the description data and adjusting the shape parameters, avoiding display problems caused by inaccurate width estimation, and improving the standardization of the prompt content display.
[0033] Preferably, the calculation of the extension distance of the connection data exceeding the boundary line in S6 uses the following formula: ;in, This represents the distance the data is extended by the connection. Represents the elongation coefficient. This represents the x-coordinate of the center point obtained from S1. This represents the screen width of the terminal device.
[0034] Specifically, the calculation steps for the extension distance of the connection data in S6 ensure that connections exceeding the screen boundary are displayed completely, avoiding information loss. During implementation, an extension coefficient is first set, determined based on screen size and the visual effect of the connection. For a larger screen width, the extension coefficient is set to 0.3, and for a smaller screen width, it is set to 0.5. The specific value of the terminal device's screen width is obtained; for example, a computer terminal screen width is set to 1920. The horizontal coordinate of the center point obtained in S1 is extracted; this value is directly obtained from the planar coordinate data, measured with the left side of the screen as the reference. During calculation, half the screen width is first calculated: 1920 divided by 2 equals 960. Then, the absolute value of the difference between the horizontal coordinate of the center point and half the screen width is calculated. If the horizontal coordinate of the center point is 1100, the absolute value of the difference is 140. Finally, the absolute value of the difference is multiplied by the extension coefficient to obtain the connection data extension distance: 140 multiplied by 0.3 equals 42. This step, through flexible setting of the extension coefficient and difference calculation, allows the extension distance of the connection to adapt to different screen sizes. The adjustment of the extension coefficient balances the extension effect and screen space occupation. The specific values of screen width and center point x-coordinate ensure that the extension distance calculation corresponds accurately with the actual display position, avoiding the connection being cut off due to insufficient extension or the screen space being wasted due to excessive extension. This ensures the integrity of the map prompt data and the association with the center point, and improves the user's understanding of the map information.
[0035] Preferred, such as Figure 2 As shown, step S2 includes the following sub-steps: S21, extracting the longitude information of the center point corresponding to each region in the map data after transformation by S1, ensuring that each region corresponds to only one center point of longitude data, and not omitting the longitude extraction of any region; S22, arranging all the extracted longitude data in descending or ascending order, maintaining the correlation between each longitude data and the corresponding region during the arrangement process, and avoiding data confusion; S23, dividing the sorted longitude data into two equal parts to form two independent data sources, ensuring that the difference in the number of data in the two data sources does not exceed one, and ensuring the balance of data distribution; S24, extracting the latitude coordinates of the center points of each region in the two data sources respectively, and then sorting the latitude coordinates in each data source according to the set order, maintaining the correspondence between latitude coordinates and regions and corresponding longitude data after sorting.
[0036] Specifically, the S2 map prompts the data source segmentation steps, including four sub-steps from S21 to S24. During S21, the longitude information of the center point of each region in the map data transformed by S1 is comprehensively extracted. During the extraction process, each region is checked individually to ensure that each region corresponds to only one longitude data point, with no omissions or duplicates. The extracted longitude information is retained to six decimal places to ensure the accuracy of subsequent processing. S22 arranges all extracted longitude data in descending order, creating a table corresponding to the longitude data and region names to avoid data confusion. After sorting, the data is numbered to facilitate subsequent segmentation operations. S23 divides the sorted longitude data equally into two data sources according to the number. If the total data volume is 120 records, then each data source will... If the total data volume is 121 records, then 60 records are allocated to one data source and 61 records to ensure balanced data distribution. S24 extracts the latitude coordinates of the center points of each region in the two data sources, retaining the latitude coordinate precision to six decimal places. Then, the latitude coordinates in each data source are sorted in ascending order. After sorting, the correlation between latitude coordinates and regions and corresponding longitude data is maintained. Through orderly step-by-step operations, the complex data source is decomposed into structured subsets, reducing the amount of subsequent processing computation and laying the foundation for subsequent accurate processing. The setting of longitude and latitude precision ensures data accuracy, and the balanced data segmentation ensures processing efficiency.
[0037] Preferred, such as Figure 3 As shown, step S3 includes the following sub-steps: S31, for each data source obtained from the segmentation in S2, extract the shape height information corresponding to each data point one by one. During the extraction process, the shape height value is determined based on the data's own attribute characteristics to ensure data accuracy; S32, calculate the interval of data in the longitude direction within each data source. By analyzing the longitude differences between data points, determine a reasonable interval value so that the interval meets the requirements of subsequent processing; S33, determine the center point of the display content corresponding to each data point. Combine the data location and display requirements to accurately locate the position parameters of the center point; S34, obtain the height data of the display content for each data point. Based on the type and specifications of the display content, determine the specific height value. Then, combine the four data points—shape height, longitude interval, center point of the display content, and height of the display content—into a set. Finally, divide the data into a grid based on the screen width of the terminal device and the shape height of the map.
[0038] Specifically, the preliminary processing steps for the map prompt data in S3 include four sub-steps: S31 to S34. S31 extracts the outline height of each data point from each data source segmented in S2. The outline height is set according to the map element type corresponding to the data: 45 for city-level data, 30 for district / county-level data, and 20 for township-level data. The correspondence between data number and outline height is recorded during extraction. S32 calculates the longitude interval within each data source by calculating the longitude difference between adjacent data points and taking the average of all differences as the interval. If the longitude differences between adjacent data points within a data source are 15, 18, and 12 respectively, then the interval is set to 15. S33 determines the center point of the content displayed for each data point, using the planar coordinates obtained in S1 as a reference, with the x-coordinate of the center point consistent with the x-coordinate of the planar coordinates. The vertical coordinate is the same as the vertical coordinate of the plane to ensure the accurate position of the center point; S34 obtains the height of each data display content, the height of important prompts is set to 35, and the height of ordinary prompts is set to 25. The outline height, longitude interval, center point of the display content, and height of the display content are combined to form a descriptive data set. Then, according to the terminal screen width (such as mobile phone screen width 1080) and map outline height (600), the grid is divided into 36 columns horizontally and 20 rows vertically, with a grid width of 30 and a height of 30. Through step-by-step extraction and setting, a standardized descriptive dataset and grid system are constructed to provide a unified benchmark for subsequent processing. The differentiated setting of parameters meets different data display needs.
[0039] Preferred, such as Figure 4 As shown, step S4 includes the following sub-steps: S41, extracting the vertical value of the center point of the display content corresponding to each description data from the description data set obtained in S3, and simultaneously extracting the vertical value of the center point of the planar coordinates obtained in S1; S42, comparing the vertical value of the center point of the display content of each description data with the vertical value of the center point of the corresponding planar coordinates on the divided grid, and recording the comparison results; S43, based on the comparison results, setting each description point and its corresponding center point to move within a fixed spatial range, controlling the movement direction according to the rule that the description point moves south above the center point and moves north below the center point; S44, during the movement process, reserving a fixed multiple of the gap between each description point and the center point, repeatedly running the movement process of all description data until the difference between each description point and its corresponding center point in the vertical direction is within a suitable distance, and then calculating the set of minimum vertical direction values that meet the requirements.
[0040] Specifically, the S4 map prompt data longitude direction center point processing steps include four sub-steps S41 to S44. S41 extracts the vertical value of the center point of each data display item and the vertical value of the plane coordinate center point from the description data set in S3. The vertical value is measured in pixels with the top of the screen as the origin, and the precision is retained to the integer part. S42 compares the two vertical values one by one on the grid divided in S3, recording the comparison result for each data item. If the vertical value of the display item's center point is greater than the vertical value of the plane coordinate center point, it is marked as "up"; otherwise, it is marked as "down". S43 sets the movement range of the description point and center point to 40 pixels up and down, controls the movement direction according to the marking result, and marks "up". Marking "Up" moves the description point south, while marking "Down" moves it north, recording position changes in real time. During the movement, S44 reserves a gap twice the height of the displayed content. If the displayed content height is 30, a gap of 60 pixels is reserved. The movement process is repeated until the vertical difference between the description point and the center point of each data is less than 8 pixels. The movement stops and the minimum vertical value set is calculated. Through step-by-step comparison, movement, and adjustment, the positional relationship between the description point and the center point is precisely controlled. The numerical settings of the movement range, gap, and termination condition ensure the accuracy and stability of the display.
[0041] Preferred, such as Figure 5 As shown, step S5 includes the following sub-steps: S51, extracting relevant data corresponding to each descriptive data from the set of minimum vertical direction values calculated in S4, and using this data as the basis for updating the descriptive data in S3; S52, updating the center point data of the display content corresponding to each descriptive data in S3 based on the extracted data, ensuring the consistency of the center point data with other relevant data during the update process; S53, obtaining the text size parameter of the prompt content data, and calculating the width value of each prompt content data according to the correspondence between text size and width; S54, determining and fixing the starting point positions of the left and right descriptive data to avoid the starting point shifting in subsequent processing, and adjusting some shape parameters of the descriptive data to make the shape parameters meet the display requirements.
[0042] Specifically, the secondary processing steps for the description data of the S5 map prompt data include four sub-steps from S51 to S54. S51 extracts the minimum vertical value of each data point from the minimum vertical direction value set in S4, uses it as the basis for updating, and organizes it into an update table according to the data number; S52, based on the update table, replaces the vertical value of the center point of the display content of the corresponding data in the description data set in S3 with the minimum vertical value, while keeping the horizontal coordinate unchanged. After updating, the data number is checked to ensure that there are no errors; S53 calculates the width of the prompt content. According to the text size (important prompt text size 18, normal 14), the width of each character is calculated as 0.6 times the text size. If the prompt content has 12 characters and the text size is 18, the width is 129.6; S54 fixes the starting point of the left and right side description data. The left starting point is 20 pixels away from the left side of the screen, and the right starting point is 20 pixels away from the right side of the screen. At the same time, the outline height is adjusted, increasing by 5 on the original basis. The outline height of city-level data is adjusted from 45 to 50. After adjustment, the final description data is recorded. Through step-by-step updating, calculation and adjustment, the description data attributes are optimized. The fixed starting point and the outline height adjustment ensure the display standard, and the width calculation ensures the complete presentation of the prompt content, providing data support for the final display effect.
[0043] A natural algorithm for optimizing map data display is proposed. When processing map data, this algorithm first converts geographic coordinates into planar coordinates based on the terminal device screen size and Earth radius parameters. Then, it divides the map into appropriate grids according to the terminal device screen width and map height. The entire process fully considers the actual characteristics of the device and the data, constructing a scientific adaptation mechanism. This design effectively solves the problem of poor adaptability in the data conversion and grid division stages of existing technologies, avoiding uneven data distribution or resource waste. It makes the data processing process more efficient and stable, ensuring that map data can be displayed reasonably on different terminal devices, laying a solid foundation for further optimization of the data display effect.
[0044] Regarding display accuracy, this algorithm first segments and sorts the map prompt data source, then processes the descriptive data twice. Especially when processing the center point in the longitude direction, it sets clear movement rules and termination conditions, repeatedly adjusting the relative positions of the descriptive points and the center point. It also fixes the starting point of the descriptive data and reasonably handles the extension distance of the connecting lines. These refined operations solve the display deviation problems caused by the lack of scientific rules for center point adjustment and unreasonable line processing in existing technologies. It can accurately control the position of map prompt information and the display effect of connecting lines, significantly improving the accuracy of map data display, making it clearer and more convenient for users to obtain map information, and significantly optimizing the user viewing and usage experience.
[0045] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various equivalent changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A natural algorithm for optimizing map data display, characterized in that, The process includes the following steps: S1, converting map data into a set of latitude and longitude points. Based on the screen size of the terminal device or a specified area, and using the Earth's radius parameter, the geographic coordinates are converted into planar coordinates using mathematical formulas. The planar coordinates and area name information are then plotted on the terminal device, reserving a certain amount of space in the left and right directions during calculation. S2, extracting the longitude of the center points of each region from the map data after conversion in S1, sorting the data by longitude, and then dividing the data into two data sources. The latitude coordinates of the map data center points in the two data sources are then sorted by latitude. S3, based on the data sources obtained from the segmentation in S2, processing four data items—shape height, longitude interval, center point of the displayed content, and height of the displayed content—and forming a set. Based on the width of the terminal device screen and the height of the map shape, the set is divided into appropriately sized grids. S4, based on the descriptive data obtained in S3, comparing the vertical value of the center point of the displayed content with the center point of the planar coordinates obtained in S1 on the grid, and setting the description. The description points and center point move within a fixed range, following the rule that the description point moves south when it is above the center point and north when it is below the center point, with a fixed multiple gap reserved. The process stops when the vertical difference between the description point and the center point is within a suitable distance. All description data are run multiple times until the distance between each map center point reaches a suitable distance, and the set of minimum vertical values that satisfy all description points and their corresponding center points is calculated. In S5, based on the data obtained in S4, the center point data of the corresponding data displayed in S3 is updated, the width is calculated based on the text size of the prompt content data, the starting points of the description data on the left and right sides are fixed, and some shape parameters of the description data are processed. In S6, based on the width, height, horizontal starting point, and vertical center point of the description data obtained in S5, the corresponding planar position is calculated, and half the width of the terminal device screen is used as the dividing line. This is compared with the center point obtained in S1, so that the connecting data that exceeds the dividing line extends by a certain distance.
2. The natural algorithm for optimizing map data display according to claim 1, characterized in that, The formula used to convert geographic coordinates to planar coordinates in S1 is as follows: ;in, The x-coordinate represents the plane coordinate system. The ordinate representing the planar coordinate system. Represents the Earth's radius parameter. Longitude values representing geographic coordinates The latitude value represents the geographic coordinates. Represents the baseline latitude value of the specified area.
3. The natural algorithm for optimizing map data display according to claim 1, characterized in that, The formula used to calculate the size of the grid in S3 is as follows: ;in, Represents the width of the grid. Represents the height of the grid. Represents the screen width of the terminal device. Represents the height of the map's outline. This represents the number of grid cells divided horizontally. This represents the number of grid cells divided in the vertical direction.
4. The natural algorithm for optimizing map data display according to claim 1, characterized in that, The formula used to calculate the distance the description point moves in S4 is as follows: ;in, This represents the distance the point was moved. Represents the moving average coefficient. This represents the verticality value of the description point. The vertical value representing the center point.
5. The natural algorithm for optimizing map data display according to claim 1, characterized in that, The formula used to calculate the width of the prompt content data in S5 is as follows: ;in, This represents the width of the prompt content data. The first one in the representative prompt content Width coefficient of each character, Represents the text size parameter. This represents the total number of characters in the prompt content.
6. The natural algorithm for optimizing map data display according to claim 1, characterized in that, The formula used to calculate the extension distance of the connection data exceeding the boundary line in S6 is as follows: ;in, This represents the distance the data is extended by the connection. Represents the elongation coefficient. This represents the x-coordinate of the center point obtained from S1. This represents the screen width of the terminal device.
7. The natural algorithm for optimizing map data display according to claim 1, characterized in that, S2 includes the following sub-steps: S21, extracting the longitude information of the center point corresponding to each region in the map data after S1 transformation, ensuring that each region corresponds to only one center point of longitude data, and not omitting the longitude extraction of any region; S22, arranging all the extracted longitude data in descending or ascending order, maintaining the correlation between each longitude data and the corresponding region during the arrangement process, and avoiding data confusion; S23, dividing the sorted longitude data into two equal parts to form two independent data sources, ensuring that the difference in the number of data in the two data sources does not exceed one, and ensuring the balance of data distribution; S24, extracting the latitude coordinates of the center points of each region in the two data sources respectively, and then sorting the latitude coordinates in each data source according to the set order, maintaining the correspondence between latitude coordinates and regions and corresponding longitude data after sorting.
8. The natural algorithm for optimizing map data display according to claim 1, characterized in that, S3 includes the following sub-steps: S31, for each data source obtained from S2, extract the corresponding shape height information of each data point one by one. During the extraction process, the shape height value is determined based on the data's own attribute characteristics to ensure data accuracy; S32, calculate the interval of data in the longitude direction within each data source. By analyzing the longitude differences between data points, determine a reasonable interval value so that the interval meets the requirements of subsequent processing; S33, determine the center point of the display content corresponding to each data point. Combine the data location and display requirements to accurately locate the position parameters of the center point; S34, obtain the height data of the display content for each data point. Based on the type and specifications of the display content, determine the specific height value. Then, combine the four data points—shape height, longitude interval, center point of the display content, and height of the display content—into a set, and then divide the data into a grid based on the screen width of the terminal device and the shape height of the map.
9. The natural algorithm for optimizing map data display according to claim 1, characterized in that, S4 includes the following sub-steps: S41, extracting the vertical value of the center point of the display content corresponding to each description data from the description data set obtained in S3, and simultaneously extracting the vertical value of the center point of the planar coordinates obtained in S1; S42, comparing the vertical value of the center point of the display content of each description data with the vertical value of the center point of the corresponding planar coordinates on the divided grid, and recording the comparison results; S43, based on the comparison results, setting each description point and its corresponding center point to move within a fixed spatial range, controlling the movement direction according to the rule that the description point moves south above the center point and moves north below the center point; S44, during the movement process, reserving a fixed multiple of the gap between each description point and the center point, repeatedly running the movement process of all description data until the vertical difference between each description point and its corresponding center point is within a suitable distance, and then calculating the set of minimum vertical values that meet the requirements.
10. The natural algorithm for optimizing map data display according to claim 1, characterized in that, S5 includes the following sub-steps: S51, extracting relevant data corresponding to each descriptive data from the set of minimum vertical direction values calculated in S4, and using this data as the basis for updating the descriptive data in S3; S52, updating the center point data of the display content corresponding to each descriptive data in S3 based on the extracted data, ensuring the consistency of the center point data with other relevant data during the update process; S53, obtaining the text size parameter of the prompt content data, and calculating the width value of each prompt content data according to the correspondence between text size and width; S54, determining and fixing the starting point positions of the left and right descriptive data to avoid the starting point shifting in subsequent processing, and adjusting some shape parameters of the descriptive data to make the shape parameters meet the display requirements.