Visualization method and device for coupling place name tag and TreeMap subdivision, and electronic equipment
Through the visualization method of coupling place name tags and TreeMap segmentation, the problem that traditional spatial path visualization technology is difficult to take into account both global and local information and space utilization efficiency, and the comprehensive visualization of cities and interest points along the path is realized, improving user interaction experience and path readability.
Patent Information
- Application Number
- CN202510542920.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-04-28
AI Technical Summary
Traditional spatial path visualization technology is difficult to take into account both global and local information expression, and the spatial utilization efficiency is low, so it is unable to effectively display the overall relationship between cities along the path and the semantic information of interest points.
The visualization method of coupling place name tags and TreeMap segmentation is adopted to realize the comprehensive visualization of cities and points of interest along the path through the coupled expression of semantic information and spatial distribution. The specific steps include receiving user input, processing the sequence of spatial coordinate point points, city matching, extracting attractions, calculating city weights, using the Squarified layout algorithm to allocate cities to the canvas, sorting and placing attractions labels, and connecting color matching and splines.
It realizes efficient spatial utilization and semantic expression of path data, solves the problem of imbalance between global and local information expression, improves user interaction experience and path readability, and is suitable for scenarios such as tourism planning, business analysis and regional traffic optimization.
Smart Images

Figure CN120144686A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of geographic information science and visualization, and particularly to a visualization method, device and electronic device that couple place name tags and TreeMap dissection. Background Art
[0002] With the rapid development of information and communication technology (ICT), the expression form of geographic information has gradually expanded from traditional standard maps to the field of pan-maps. The function of maps is no longer limited to the accurate presentation of spatial positions, but begins to incorporate diverse semantic information. As a core component of geographic information, the visualization form of points of interest (POIs) becomes particularly important in scenarios such as tourist navigation, restaurant recommendations, and commercial site selection. However, traditional POI visualization methods mostly focus on the display of POIs in a single area, ignoring the spatial relationships and semantic connections between multiple areas, that is, the visualization of spatial paths.
[0003] Visualization of spatial paths not only needs to display the starting point and the ending point, but also needs to include a series of waypoints along the path and their related information. The essence of a path is a data structure with spatial sequence attributes. By visualizing the spatial structure of the path and the semantic features of the areas along the path, it can help users understand the geographical distribution, important nodes, and the associations between multi-dimensional information along the path. For example, in the scenario of tourist planning, visualization of spatial paths can not only provide a global perspective of the route, but also refine and display the distribution and features of scenic spots in the cities along the way, providing comprehensive support for user decision-making.
[0004] However, existing spatial path visualization technologies generally face two main challenges: First, it is difficult for traditional maps to balance the expression of global and local information. At a small scale, although the global structure of the path can be displayed, the distribution of POIs within the city is difficult to reflect. At a large scale, although the POI information in the local area of the city can be refined, the global perspective is often lost, and it is difficult to show the overall relationship between the cities involved in the path. When users obtain global and local information, they need to frequently switch perspectives, reducing the overall usability. Second, the spatial utilization efficiency in current path visualization is relatively low. Traditional path visualization methods mostly use polylines as the core elements, only presenting the geometric information of the path, but ignoring the attributes and semantic information of the areas along the path, resulting in a large waste of map spatial resources and insufficient information density. Currently, there is no technical solution that can solve the above technical problems, nor a visualization method, device and electronic device that couple place name tags and TreeMap dissection. Summary of the Invention
[0005] The present invention provides a visualization method, device and electronic device for coupling place name tags with TreeMap dissection. Through the coupled expression of the semantic information and spatial distribution of path data, the comprehensive visualization of cities and points of interest along the path is realized.
[0006] In a first aspect, the present invention provides a visualization method for coupling place name tags with TreeMap dissection, including: Receiving and responding to user input, processing the starting point and the ending point according to a preset navigation software to obtain a sequence of spatial coordinate points corresponding to the starting point, all waypoints and the ending point, processing the sequence of spatial coordinate points by using a preset polyline densification algorithm to obtain encrypted fold points, using the Turf library to perform city matching on the encrypted fold points, identifying the city to which each encrypted fold point belongs, and generating a complete list of cities, where the user input is generated after the user inputs the starting point and the ending point in the preset navigation software; For each city in the complete list of cities, extracting all scenic spots of the city, determining the font size of the scenic spots according to the popularity of each scenic spot, and determining the weight of the city according to the weighted character count of all scenic spots and the font size of the scenic spots; According to the weight of each city in the complete list of cities, using the Squarified layout algorithm to assign each city to the shortest side direction of a preset canvas in the form of a node one by one until the layout of all cities in the preset canvas is completed, and obtaining a post-layout canvas containing the rectangular space corresponding to each city; For each city in the post-layout canvas, sorting the popularity of each scenic spot in the city from large to small to obtain a scenic spot popularity ranking, and starting from the center position of the rectangular space corresponding to the city according to the scenic spot popularity ranking, placing the scenic spot labels corresponding to each scenic spot in turn until the layout of all scenic spots in the rectangular space of the city is completed, traversing all cities until the visual layout of all cities in the post-layout canvas is completed, and displaying the visual layout.
[0007] According to the visualization method for coupling place name tags with TreeMap dissection provided by the present invention, the processing of the sequence of spatial coordinate points by using a preset polyline densification algorithm to obtain encrypted fold points includes: Using a preset polyline densification algorithm to perform thinning operation on the sequence of spatial coordinate points to obtain encrypted fold points; Among them, the distance between each coordinate point in the encrypted fold points is the same.
[0008] According to the visualization method for coupling place name tags with TreeMap dissection provided by the present invention, the determining of the weight of the city according to the weighted character count of all scenic spots and the font size of the scenic spots includes:
[0009] Among them, is the total weight of the city, represents the total number of scenic spots included in the city, represents the number of characters in the POI label of the th scenic spot, and represents the font size of the
[0010] th scenic spot label. According to the visualization method of coupling place name labels and TreeMap dissection provided by the present invention, in the process of sequentially allocating each city to the shortest side direction of the preset canvas in the form of a node by using the Squarified layout algorithm until the layout of all cities in the preset canvas is completed, obtaining the layout canvas including the rectangular space corresponding to each city, the method includes: For the weight of any city, in the process of allocating the city to the shortest side direction of the preset canvas in the form of a node, obtain the first city allocation layout of the city in the largest rectangular space corresponding to the rectangular space already allocated by the previous city, and obtain the second city allocation layout of the city in the remaining space to be allocated, where the remaining space to be allocated is the remaining space in the preset canvas after removing all the already allocated rectangular spaces; Calculate the first aspect ratio corresponding to the first city allocation layout, calculate the second aspect ratio corresponding to the second city allocation layout, determine the city allocation layout with the smallest absolute value of the difference from 1 in the first aspect ratio and the second aspect ratio as the target allocation layout of the city, and allocate the city to the preset canvas in the form of a node according to the target allocation layout;
[0011] Traverse all cities until the layout of all cities in the preset canvas is completed, obtaining the layout canvas including the rectangular space corresponding to each city. According to the visualization method of coupling place name labels and TreeMap dissection provided by the present invention, starting from the central position of the rectangular space corresponding to the city, sequentially place the scenic spot labels corresponding to each scenic spot until the layout of all scenic spots in the city in the rectangular space is completed, the method includes: For any scenic spot label, perform collision detection with the labels already placed in the rectangular space during placement. In the case of overlap, move outward along the Archimedean spiral path and re-detect until there is no overlap, and then the scenic spot label is fixed;
[0012] According to the visualization method of coupling place name labels with TreeMap dissection provided by the present invention, before performing collision detection with the labels already placed in the rectangular space during placement, the method further includes: For any scenic spot, process the scenic spot label corresponding to the scenic spot according to the font size of the scenic spot, and obtain the processed scenic spot label with the font size of the scenic spot; Traverse all scenic spots to obtain the processed scenic spot labels corresponding to each scenic spot.
[0013] According to the visualization method of coupling place name labels with TreeMap dissection provided by the present invention, after traversing all cities until the visualization layout of all cities in the post-layout canvas is completed, the method further includes: For the rectangular space corresponding to any city in the post-layout canvas, select any current color from a preset number of coloring schemes for assignment, and judge whether the current color conflicts with the colors of adjacent rectangular spaces based on the adjacency matrix; If a color conflict occurs, discard the current color, select the next color from the preset number of coloring schemes for assignment until the current color does not conflict with the colors of adjacent rectangular spaces; If all the colors in the preset number of coloring schemes conflict with the colors of adjacent rectangular spaces, then backtrack to the coloring of the rectangular space corresponding to the previous city and re-adjust the color matching until the rectangular spaces corresponding to all cities do not conflict with the colors of adjacent rectangular spaces, and obtain the post-layout canvas with colors colored.
[0014] According to the visualization method of coupling place name labels with TreeMap dissection provided by the present invention, after obtaining the post-layout canvas with colors colored, the method further includes: Adopt Catmull-Rom spline curves to sequentially connect the central positions of each city in the rectangular space according to the order of cities in the complete list of cities, and obtain the connected post-layout canvas.
[0015] In a second aspect, a visualization device for coupling place name labels with TreeMap dissection is provided, including: A receiving unit, which is used to receive and respond to user input, process the starting point and the ending point according to a preset navigation software, obtain a sequence of spatial coordinate points corresponding to the starting point, all waypoints, and the ending point, process the sequence of spatial coordinate points by using a preset polyline densification algorithm to obtain encrypted breakpoints, perform city matching on the encrypted breakpoints by using the Turf library, identify the city to which each encrypted breakpoint belongs, and generate a complete list of cities, where the user input is generated after the user inputs the starting point and the ending point in the preset navigation software; An extraction unit, which is used to extract all scenic spots of each city in the complete list of cities, determine the font size of the scenic spots according to the popularity of each scenic spot, and determine the weight of the city according to the weighted character number and font size of all scenic spots; An allocation unit, which is used to allocate each city to the shortest side direction of a preset canvas in the form of a node one by one according to the weight of each city in the complete list of cities by using the Squarified layout algorithm until the layout of all cities in the preset canvas is completed, and obtain a post-layout canvas containing the rectangular space corresponding to each city; A display unit, which sorts each scenic spot in each city in the post-layout canvas from large to small according to the popularity of each scenic spot in the city to obtain a scenic spot popularity ranking, and starting from the center position of the rectangular space corresponding to the city, sequentially place the scenic spot labels corresponding to each scenic spot until the layout of all scenic spots in the rectangular space of the city is completed. Traverse all cities until the visual layout of all cities in the post-layout canvas is completed, and display the visual layout.
[0016] In a third aspect, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the visualization method for coupling geographical name tags with TreeMap dissection is implemented.
[0017] The present invention introduces a number of innovations in the field of path visualization, comprehensively improving the spatial utilization rate, semantic expression ability, and user interaction experience of path data. With the help of the TreeMap rectangular tree map technology, the efficient expression of the importance of cities along the path is realized. By using the Squarified layout algorithm, the city weights are mapped into the canvas area, solving the problem of imbalance in the expression of global and local information in traditional path maps. The area of the city rectangular region not only clearly reflects the weight of its points of interest but also provides an accurate spatial segmentation structure, enhancing the readability of the global structure of the path; the introduction of the tag cloud technology breaks through the limitation of only showing geometric information in traditional path visualization. Through visual variables such as the font size and color of the tag cloud, the popularity attributes and distribution characteristics of the points of interest are intuitively encoded. The compact arrangement of the tag cloud within each city rectangular region effectively avoids label overlap through the spiral layout algorithm, improving the clarity and expression efficiency of local semantic information; Adopt the four-color method for color matching and combine it with the recursive backtracking algorithm of the adjacency matrix to ensure clear differentiation of colors for adjacent rectangular areas, while restricting the types of colors to optimize the coordination of the overall layout. In addition, use Catmull-Rom spline curves to connect urban rectangular areas to smooth the visual effect of the path curve and further enhance the expression of path coherence and directionality; this method can be widely applied to scenarios such as tourism planning, business analysis, and regional traffic optimization, providing more intuitive data support for path planning and point-of-interest selection. At the same time, in the future, it can be combined with user behavior data and dynamic path generation technology to achieve intelligent and personalized visual expression of multiple categories of points of interest, providing new possibilities for the technical development of path visualization. Brief Description of the Drawings
[0018] To more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0019] Figure 1 is one of the flow diagrams of the visualization method that couples geographical name tags with TreeMap dissection provided by the present invention; Figure 2 is the second of the flow diagrams of the visualization method that couples geographical name tags with TreeMap dissection provided by the present invention; Figure 3 is the schematic diagram of the polyline densification algorithm that retains inflection points provided by the present invention; Figure 4 is the schematic diagram of the polyline densification algorithm with a fixed spacing provided by the present invention; Figure 5 is the schematic diagram of obtaining a city list provided by the present invention; Figure 6 is the traditional treemap provided by the present invention; Figure 7 is the rectangular treemap TreeMap provided by the present invention; Figure 8 is the example diagram of the Squarified algorithm provided by the present invention; Figure 9 is the schematic diagram of generating an adjacency matrix provided by the present invention; Figure 10 is the schematic diagram of the recursive backtracking algorithm provided by the present invention; Figure 11 is the schematic diagram of the polyline path provided by the present invention; Figure 12 is the schematic diagram of the curved path provided by the present invention; Figure 13 It is a schematic structural diagram of a visualization device that couples place name tags and TreeMap dissection provided by the present invention; Figure 14 It is a schematic structural diagram of an electronic device provided by the present invention. Detailed implementation manners
[0020] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without creative efforts shall fall within the protection scope of the present invention.
[0021] The present invention proposes an innovative path visualization method. By combining a place name tag cloud with a TreeMap space dissection technology, a new path visualization framework is constructed. This framework can not only efficiently express the global structure of a path, but also detail the distribution of local interest points of cities along the path, thereby improving the spatial utilization efficiency and information carrying capacity of the canvas, and is applicable to scenarios such as tourism planning, business analysis, and regional traffic optimization. Figure 1 It is one of the schematic flowcharts of a visualization method that couples place name tags and TreeMap dissection provided by the present invention. The visualization method that couples place name tags and TreeMap dissection includes: Step 101: Receive and respond to user input. Process the starting point and the ending point according to a preset navigation software to obtain a sequence of spatial coordinate points corresponding to the starting point, all waypoints, and the ending point. Process the sequence of spatial coordinate points using a preset polyline densification algorithm to obtain encrypted fold points. Use the Turf library to perform city matching on the encrypted fold points, identify the city to which each encrypted fold point belongs, and generate a complete list of cities. The user input is generated after the user inputs the starting point and the ending point in the preset navigation software.
[0022] In step 101, the process of using a preset polyline densification algorithm to process the sequence of spatial coordinate points to obtain encrypted fold points includes: performing a thinning operation on the sequence of spatial coordinate points using a preset polyline densification algorithm to obtain encrypted fold points; wherein, the distance between each coordinate point in the encrypted fold points is the same. The acquisition of path data is the basis of the technical method of the present invention. After the user inputs the starting point and the ending point of the path, the system generates detailed path data including the starting point, the ending point, and waypoints by calling the Amap path navigation API, and extracts the sequence of spatial coordinate points of the path. For the efficiency of subsequent calculations and the uniformity of node information, the present invention uses an optimized polyline densification (densification) algorithm to process the path.
[0023] Traditional densification algorithms usually retain the original breakpoints of the path. However, due to the complexity of the path, directly retaining the original breakpoints will lead to a rapid increase in data volume and increase the computational burden of subsequent processing. The present invention adopts an improved strategy to discard the original breakpoints during the densification process and strictly ensure that the distances between the breakpoints after encryption are consistent. This method can not only retain the geometric features of the path but also significantly reduce redundant data, thereby improving the computational efficiency.
[0024] Figure 3 It is a schematic diagram of the polyline densification algorithm that retains breakpoints provided by the present invention. Figure 4 It is a schematic diagram of the polyline densification algorithm with a fixed distance. The purpose of densifying the polyline is to obtain the list of cities passed by the spatial path. Therefore, in order to further improve the efficiency on the basis of accurately and completely extracting cities, it is necessary to densify the polyline. For the densification algorithm, as a relatively basic algorithm in mature spatial data processing software such as ArcGIS Pro, it can densify each straight line segment according to the distance / maximum offset angle / maximum offset parameter. The "densification" of the present invention can also be called the "polyline simplification (thinning)" operation. On the premise of ensuring that cities are not missed in extraction, some breakpoints are removed, which will achieve the same purpose and effect as "densification". Existing algorithms for the "polyline simplification" operation include Douglas-Peucker, Douglas-Peucker, Visvalingam-Whyatt, Zhou-Jones, etc. After testing, for the spatial path from Xi'an to Beijing, the number of original breakpoints is 14,753. If the densification algorithm that retains breakpoints is adopted, since the distances between the breakpoints are all less than the threshold of 5 km, the number of breakpoints remains unchanged; if the densification process that discards breakpoints is adopted, the number of breakpoints will drop to 253.
[0025] Figure 5 It is a schematic diagram of obtaining the list of cities provided by the present invention. After densification is completed, the system uses the Turf library to match cities for the encrypted breakpoints, identify the city to which each breakpoint belongs, and generate a complete list of cities passed by the path. Compared with directly using the geocoding API method, using the Turf library can effectively avoid the loss of node information caused by API request quota problems and ensure the integrity and reliability of data acquisition. Through the above series of processes, the spatial path is accurately mapped from a two-dimensional spatial curve to a set of discrete city nodes, laying a foundation for subsequent point-of-interest screening and weight calculation.
[0026] Step 102: For each city in the complete list of cities, extract all scenic spots of the city, determine the font size of the scenic spots according to the popularity of each scenic spot, and determine the weight of the city according to the weighted character count of all scenic spots and the font size of the scenic spots.
[0027] In step 102, after generating the list of cities along the path, the system extracts the scenic spot data of each city from the database and sorts it according to the popularity information of the scenic spots. In the present invention, the popularity of each scenic spot is converted into the font size through a mapping formula, so as to realize the visual encoding of the importance of the scenic spots. The formula is as follows:
[0028] In the formula, represents the font size of the th point of interest label, represents the popularity ranking of the th point of interest label, and respectively represent the minimum and maximum font sizes for showing on the map, and respectively represent the minimum ranking and maximum ranking of all labels. In the present invention, the popularity value is mapped to the font size, and the scenic spot label with higher popularity will have a larger font size.
[0029] On this basis, the weight of each city is calculated. The weight value is determined by the weighted character number and font size of all scenic spots in the city. The formula is as follows:
[0030] In the formula, is the total weight of the city, represents the total number of scenic spots included in the city, represents the number of characters in the th scenic spot POI label, represents the font size of the th scenic spot label. Through this method, the system not only considers the popularity of the scenic spots, but also comprehensively calculates the weight by combining the name length, making the weight distribution more in line with the actual distribution of points of interest and more accurate than the traditional method that only relies on the number of points of interest.
[0031] In the present invention, for some cities, although they have a large number of scenic spots, their popularity is not very high. The font sizes of their labels are relatively small, and the total canvas space required for them is not very large. However, due to the single indicator of the large number of scenic spots, the treemap algorithm allocates a large canvas space for them, which will result in a waste of space. On the contrary, for some cities, although the number of scenic spots is small, their popularity is high, so the font sizes of their labels will be relatively large, and the total canvas space required will be larger than usual. However, due to the small number of scenic spots, a smaller space is allocated to them. This is the conflict between the number of city labels and the space to be allocated. Therefore, the present invention takes into account the number of characters and the font size of each label, and can more precisely obtain the weights of each city to allocate a more reasonable area space on the canvas.
[0032] Step 103: According to the weights of each city in the complete city list, use the Squarified layout algorithm to allocate each city to the shortest side direction of the preset canvas in the form of a node one by one until the layout of all cities in the preset canvas is completed, and obtain the post-layout canvas containing the rectangular space corresponding to each city.
[0033] Figure 6 is the traditional tree diagram provided by the present invention, while Figure 7 is a schematic diagram of the TreeMap of the present invention. It uses the classic SND algorithm. The SND algorithm is the first algorithm of TreeMap in history. After the weight calculation is completed, the system inputs the cities passed by the path and their weights into the TreeMap treemap algorithm for canvas space division. TreeMap is derived from the traditional tree diagram and is a space-filling visualization technology that represents the node weights by area, which can effectively improve the canvas utilization rate by mapping the node information to a two-dimensional rectangular area. In the selection of the layout algorithm, the present invention adopts the Squarified layout algorithm. This algorithm takes optimizing the aspect ratio of the rectangle as the core and preferentially selects a rectangle splitting strategy close to a square based on the greedy principle to ensure that the layout result has high visual recognition and interactive friendliness. Specifically, the Squarified algorithm will allocate nodes to the shortest side direction of the canvas one by one based on the weights of each city node. When adding a new node each time, the algorithm will calculate the average aspect ratio (Average Aspect Ratio, AAR) of the rectangle row or column to select the optimal layout solution, and finally generate a rectangular arrangement close to a square. After the layout is completed, the system maps each city to the corresponding rectangular space to realize the distribution expression of the cities along the path.
[0034] Optionally, when using the Squarified layout algorithm to assign each city to the shortest side direction of the preset canvas in the form of nodes one by one until the layout of all cities in the preset canvas is completed, and a post-layout canvas including the rectangular space corresponding to each city is obtained, the method includes: For the weight of any city, during the process of assigning the city to the shortest side direction of the preset canvas in the form of nodes, obtain the first city assignment layout of the city in the largest rectangular space corresponding to the rectangular space where the previous city has been assigned, and obtain the second city assignment layout of the city in the remaining space to be assigned. The remaining space to be assigned is the remaining space in the preset canvas after removing all the assigned rectangular spaces; Calculate the first aspect ratio corresponding to the first city assignment layout, calculate the second aspect ratio corresponding to the second city assignment layout, and determine the city assignment layout with the smallest absolute value of the difference from 1 between the first aspect ratio and the second aspect ratio as the target assignment layout of the city, and assign the city to the preset canvas in the form of nodes according to the target assignment layout; Traverse all cities until the layout of all cities in the preset canvas is completed, and a post-layout canvas including the rectangular space corresponding to each city is obtained.
[0035] Figure 8 It is an example diagram of the Squarified algorithm provided by the present invention. The used node order and their weights are: 6, 6, 4, 3, 2, 2, 1. It can be seen that this algorithm can obtain a layout with a relatively low average aspect ratio. Figure 8 Only an example in the case where the node order is sorted from large to small according to the weight is shown. In the original algorithm, all nodes will be sorted according to the weight size, and nodes with larger weights will be placed first. However, this does not mean that the present invention needs to perform layout according to such a weight sorting. Since the spatial path visualization of the present invention has requirements for the order between cities, the Squarified algorithm of the present invention does not sort the node weights and directly constructs the layout. The core of the present invention lies in the combination of the treemap and the word cloud. The role of the treemap is only to divide the space to facilitate users to obtain the order information of the spatial path at the global scale.
[0036] Step 104: For each city in the post-layout canvas, sort each scenic spot in the city from large to small according to the popularity of the scenic spot to obtain a scenic spot popularity ranking. According to the scenic spot popularity ranking, starting from the center position of the rectangular space corresponding to the city, place the scenic spot labels corresponding to each scenic spot in sequence until the layout of all scenic spots in the rectangular space of the city is completed. Traverse all cities until the visual layout of all cities in the post-layout canvas is completed, and display the visual layout.
[0037] Optionally, starting from the central position of the rectangular space corresponding to the city, place the scenic spot labels corresponding to each scenic spot in sequence until the layout of all scenic spots in the city in the rectangular space is completed, including: For any scenic spot label, during placement, perform a collision detection with the labels already placed in the rectangular space. In the case of overlap, move outward along the Archimedean spiral path and re-detect until there is no overlap, then the scenic spot label is fixed; Traverse all scenic spots in the order of the scenic spot popularity ranking until all scenic spot labels are placed, completing the layout of all scenic spots in the city in the rectangular space.
[0038] After completing the layout of the rectangular tree map, the present invention further fills the rectangular area corresponding to each city with a place name label cloud to visually display the semantic information of the scenic spots within the city. The generation of the label cloud is based on the d3-cloud library, and its core uses a spiral layout algorithm to optimize the spatial distribution of the labels. The core logic of the spiral layout algorithm is to sort the words according to their weights from large to small and place the labels one by one starting from the center of the canvas. Each label performs a collision detection with the already placed labels during placement. If overlap is found, it moves one step outward along the Archimedean spiral path and re-detects; when there is no overlap, the label can be fixed, and this process is repeated until all labels are placed. This algorithm not only ensures the compactness of the label cloud but also effectively avoids the overlap of labels.
[0039] Optionally, before performing a collision detection with the labels already placed in the rectangular space during placement, the method further includes: For any scenic spot, process the scenic spot label corresponding to the scenic spot according to the font size of the scenic spot, obtaining the scenic spot label after font size processing; Traverse all scenic spots to obtain the scenic spot labels after font size processing corresponding to each scenic spot.
[0040] The present invention will use a variety of visual variables to display the multi-dimensional attribute information of the scenic spots within each city, specifically including: using the font size of the label to identify the popularity attribute of the scenic spot. The higher the scenic spot popularity, the larger the label font size, thereby enhancing the visual prominence of high-popularity scenic spots. At the same time, to facilitate the distinction of the points of interest in different cities, the label clouds within the rectangular space of the same city are identified with a unified color, thereby enhancing the readability of the city dimension in the overall visual layout. In addition, the city name is used as the core label in the label cloud for display, and its font size is set to the maximum value in the label cloud. Therefore, under the spiral layout algorithm, it will ensure that the city name is always located at the center of the label cloud. This design not only strengthens the centrality of the overall semantics of the city but also visually highlights the identification role of the city.
[0041] Optionally, after traversing all cities until the visual layout of all cities in the canvas after the layout is completed, the method further includes: For any rectangular space corresponding to a city in the canvas after the layout, select any current color from a preset number of coloring schemes for assignment, and based on the adjacency matrix, determine whether the current color conflicts with the colors of adjacent rectangular spaces; If a color conflict occurs, discard the current color, select the next color from the preset number of coloring schemes for assignment until the current color does not conflict with the colors of adjacent rectangular spaces; If all colors in the preset number of coloring schemes conflict with the colors of adjacent rectangular spaces, then backtrack to the coloring of the rectangular space corresponding to the previous city and re-adjust the color matching until the rectangular spaces corresponding to all cities do not conflict with the colors of adjacent rectangular spaces, obtaining the canvas after the layout with color coloring.
[0042] Figure 9 It is a schematic diagram of the adjacency matrix provided by the present invention. Figure 10 It is a schematic diagram of the recursive backtracking algorithm provided by the present invention. To avoid visual confusion caused by the same color in adjacent rectangular area spaces, the present invention adopts a recursive backtracking algorithm based on the adjacency matrix to implement the four-color method for color matching. The adjacency matrix is a mathematical representation for recording the adjacent relationships of each rectangular area, and it can clearly reflect the spatial adjacency relationships between each rectangle and other rectangles. On this basis, using the recursive backtracking algorithm, by allocating colors layer by layer, it can be ensured that the color of each rectangle is different from that of its adjacent rectangles, while restricting the total number of color types, thereby improving the overall layout aesthetics and readability while optimizing the efficiency and logic of color matching.
[0043] Specifically, for a certain rectangular space, the algorithm will sequentially select a color from a preset n (in the present invention, n = 4) coloring schemes for assignment, and immediately determine based on the adjacency matrix whether the color conflicts with the colors of its adjacent rectangles. If a color overlap occurs, the algorithm will discard the current color selection and instead try the next color for assignment; if all n colors cannot meet the requirements, the algorithm will backtrack to the previous rectangular space and re-adjust the color matching. Through this recursive backtracking method, the algorithm sequentially completes the color assignment for each rectangular space until all rectangles meet the non-overlapping color matching requirements.
[0044] Optionally, after obtaining the canvas after the layout with color coloring, the method further includes: Adopt Catmull-Rom spline curves, and sequentially connect the central positions of each city in the rectangular space according to the order of cities in the complete list of cities, obtaining the connected canvas after the layout.
[0045] Figure 11 It is a schematic diagram of the broken line path provided by the present invention. Figure 12 It is a schematic diagram of the curved line path provided by the present invention. To show the spatial sequence relationship of the cities along the path, the present invention uses Catmull-Rom spline curves to connect the rectangular areas of the cities. Such curves are smooth and have good visual continuity, and can highlight the coherence and directionality of the path on a global scale, thus helping users quickly understand the overall structure of the path.
[0046] The present invention aims to provide an innovative method that can effectively improve the visualization effect of the path by coupling the place name tag cloud and the TreeMap dissection technology, solve problems such as low information density and imbalance between global and local expressions in traditional path visualization. Different from the traditional linear path expression form, this method maps the cities along the path and their weights to a two-dimensional canvas through the TreeMap rectangular tree map algorithm, making full use of the canvas space. At the same time, through the place name tag cloud technology, the semantic attributes of the points of interest are encoded as visual variables, including font size, color, etc., to intuitively present the distribution and characteristics of the scenic spots inside the city in a multi-dimensional way. Based on the unified expression of the global spatial path structure and local point-of-interest details, the cognitive efficiency of users for multi-level path information can be enhanced.
[0047] Figure 2 It is the second schematic diagram of the process of the visualization method that couples place name tags and TreeMap dissection provided by the present invention. The present invention is carried out around four main steps: path data acquisition and processing, point-of-interest screening and weight calculation, TreeMap space dissection, and tag cloud filling and visual optimization, aiming to efficiently integrate the global structure of the path and the semantic information of local points of interest to achieve a multi-level path visualization expression.
[0048] In path data acquisition and processing, after the user inputs the starting point and the ending point, the system calls the Amap path navigation API to generate detailed path data, and optimizes the spatial curve structure of the path through an improved broken line densification algorithm. During the densification process, the system adopts a strategy of increasing the density of break points at a fixed interval to balance the retention of path geometric features and the optimization of data volume, ensuring the uniformity of node information and processing efficiency. Further, the Turf library is used to match the densified break points with cities to generate a list of cities passed by the path, completely extracting the spatial sequence information of the path and laying a foundation for subsequent analysis.
[0049] In the selection and weight calculation of points of interest, based on the list of cities that the path passes through, the data of points of interest of each city is extracted from the database, sorted according to the popularity of the attractions, and the popularity information is converted into font size through a mapping formula to visually express the importance of the attractions. At the same time, the overall weight of the city is calculated by combining the popularity weight and number of characters of all attractions in the city, and each city is given an importance index in the global path. This method not only takes into account the number of attractions, but also integrates the length of their names and the distribution of popularity, providing a more accurate measurement method for weight calculation.
[0050] In the TreeMap spatial segmentation, the TreeMap rectangular tree map algorithm is used to divide the canvas into regions according to the city weights, and the Squarified layout algorithm is used to optimize the segmentation results to ensure that the rectangular area corresponding to each city is close to a square, enhancing visual recognition and interactive friendliness. The area of each rectangular area directly reflects the weight of the city, and at the same time provides a clear layout basis for subsequent tag cloud filling.
[0051] In the tag cloud filling and visual optimization, after completing the TreeMap segmentation, the system generates a tag cloud in the rectangular area of each city, and optimizes the label arrangement through the spiral layout algorithm to avoid label overlap. Visual variables such as font size and color are used to encode the multidimensional attribute information of the point of interest and enhance the semantic expression effect of the tag cloud. The system also distinguishes adjacent rectangular areas through four-color color matching to avoid color confusion, and connects the city rectangular areas through smooth Catmull-Rom spline curves to show the spatial sequence relationship and directionality of the cities along the path, which improves the overall layout aesthetics and clarity of path expression.
[0052] The core point of the present invention is to combine the traditional rectangular tree map with the word cloud to apply it to the field of spatial path visualization. The specific combination method is: using the spatial segmentation method of the rectangular tree map to map the one-dimensional city sequence into the two-dimensional space, so as to view the cities passed by the path on a global scale; at the same time, the word cloud is used to fill the interior of each city space to obtain the semantic information inside each city on a local scale. Compared with the traditional visualization of spatial paths, it relies on absolute spatial reference and positioning, so it can only be observed on a global scale, and it is difficult to know its local details; after zooming in and observing it, although more detailed information can be obtained, the overall grasp is lost at the same time. This is the classic "user loss" problem in multi-scale maps. The visualization method of the present invention, combined with the rectangular tree map and the word cloud, achieves a visualization effect that takes into account both global context and local details.
[0053] The present invention has introduced a number of innovations in the field of path visualization, comprehensively improving the spatial utilization rate of path data, semantic expression ability, and user interaction experience. By means of the TreeMap technology, the efficient expression of the importance of cities along the path is realized. Through the Squarified layout algorithm, the city weights are mapped into the canvas area, solving the problem of the imbalance between global and local information expression in traditional path maps. The area of the city rectangle not only clearly reflects the weight of its points of interest but also provides an accurate spatial segmentation structure, enhancing the readability of the global path structure. The introduction of the tag cloud technology breaks through the limitation of only showing geometric information in traditional path visualization. Through visual variables such as the font size and color of the tag cloud, the popularity attributes and distribution characteristics of the points of interest are intuitively encoded. The compact arrangement of the tag cloud within each city rectangle effectively avoids tag overlap through the spiral layout algorithm, improving the clarity and expression efficiency of local semantic information. The four-color method is used for color matching and combined with the recursive backtracking algorithm of the adjacency matrix to ensure clear distinction of colors in adjacent rectangle areas while limiting the number of color types to optimize the coordination of the overall layout. In addition, Catmull-Rom spline curves are used to connect the city rectangles to smooth the visual effect of the path curve, further enhancing the expression of path coherence and directionality. This method can be widely applied to scenarios such as tourism planning, business analysis, and regional traffic optimization, providing more intuitive data support for path planning and point-of-interest selection. At the same time, in the future, by combining user behavior data with dynamic path generation technology, intelligent and personalized visual expression of multiple categories of points of interest can be realized, providing new possibilities for the technological development of path visualization. The present invention significantly improves the spatial utilization rate and semantic expression ability of path visualization, solves the problems of insufficient information density and imbalance between global and local perspectives in traditional path maps, and provides an innovative solution for path expression in geographic information science.
[0054] Figure 13 It is a schematic structural diagram of a visualization device coupling place name tags and TreeMap dissection provided by the present invention. The visualization device coupling place name tags and TreeMap dissection includes a receiving unit 1. The receiving unit 1 is used to receive and respond to user input, process the starting point and the ending point according to a preset navigation software, obtain a sequence of spatial coordinate points corresponding to the starting point, all waypoints, and the ending point, process the sequence of spatial coordinate points by using a preset polyline densification algorithm to obtain encrypted breakpoints, perform city matching on the encrypted breakpoints by using the Turf library, identify the city to which each encrypted breakpoint belongs, and generate a complete list of cities. The user input is generated after the user inputs the starting point and the ending point in the preset navigation software. The working principle of the receiving unit 1 can refer to the aforementioned step 101 and will not be elaborated here.
[0055] The visualization device for coupling geographical name tags and TreeMap dissection further includes an extraction unit 2. The extraction unit 2 is used to extract all scenic spots of each city in the complete list of cities, determine the font size of the scenic spots according to the popularity of each scenic spot, and determine the weight of the city according to the weighted number of characters of all scenic spots and the font size of the scenic spots. The working principle of the extraction unit 2 can refer to the aforementioned step 102 and will not be elaborated here.
[0056] The visualization device for coupling geographical name tags and TreeMap dissection further includes an allocation unit 3. The allocation unit 3 is used to allocate each city to the shortest side direction of the preset canvas in the form of a node one by one according to the weight of each city in the complete list of cities by using the Squarified layout algorithm until the layout of all cities in the preset canvas is completed, and a post-layout canvas containing the rectangular space corresponding to each city is obtained. The working principle of the allocation unit 3 can refer to the aforementioned step 103 and will not be elaborated here.
[0057] The visualization device for coupling geographical name tags and TreeMap dissection further includes a display unit 4. For each city in the post-layout canvas, the display unit 4 sorts the scenic spots in descending order according to the popularity of each scenic spot in the city to obtain a scenic spot popularity ranking. According to the scenic spot popularity ranking, starting from the center position of the rectangular space corresponding to the city, the scenic spot labels corresponding to each scenic spot are placed in sequence until the layout of all scenic spots in the city in the rectangular space is completed. All cities are traversed until the visual layout of all cities in the post-layout canvas is completed, and the visual layout is displayed. The working principle of the display unit 4 can refer to the aforementioned step 104 and will not be elaborated here.
[0058] Figure 14 It is a schematic structural diagram of the electronic device provided by the present invention. As Figure 14As shown, the electronic device may include: a processor 110, a communications interface 120, a memory 130, and a communication bus 140. Among them, the processor 110, the communication interface 120, and the memory 130 complete communication with each other through the communication bus 140. The processor 110 can call the logical instructions in the memory 130 to execute a visualization method for coupling place name tags with a TreeMap dissection. The method includes: receiving and responding to user input, processing the starting point and the ending point according to a preset navigation software to obtain a sequence of spatial coordinate points corresponding to the starting point, all waypoints, and the ending point, processing the sequence of spatial coordinate points using a preset polyline densification algorithm to obtain encrypted fold points, performing city matching on the encrypted fold points using the Turf library, identifying the city to which each encrypted fold point belongs, and generating a complete list of cities. The user input is generated after the user inputs the starting point and the ending point in the preset navigation software; for each city in the complete list of cities, extracting all scenic spots in the city, determining the font size of the scenic spots according to the popularity of each scenic spot, and determining the weight of the city according to the weighted character count and the font size of all scenic spots; according to the weight of each city in the complete list of cities, using the Squarified layout algorithm to assign each city to the shortest side direction of a preset canvas in the form of a node one by one until the layout of all cities in the preset canvas is completed, obtaining a post-layout canvas containing the rectangular space corresponding to each city; for each city in the post-layout canvas, sorting the scenic spots in the city from largest to smallest according to the popularity of each scenic spot to obtain a scenic spot popularity ranking, and starting from the center position of the rectangular space corresponding to the city according to the scenic spot popularity ranking, placing the scenic spot labels corresponding to each scenic spot in sequence until the layout of all scenic spots in the rectangular space of the city is completed, traversing all cities until the visualization layout of all cities in the post-layout canvas is completed, and displaying the visualization layout.
[0059] In addition, when the logical instructions in the above-mentioned memory 130 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0060] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0061] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the technical solution, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disc, etc., and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments.
[0062] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of various embodiments of the present invention.
Claims
1. A visualization method for coupling place name labels and TreeMap segmentation, characterized in that: include: Receiving and responding to user input, processing the starting point and the end point according to the preset navigation software, obtaining a spatial coordinate point sequence corresponding to the starting point, all the waypoints and the end point, processing the spatial coordinate point sequence using a preset broken line densification algorithm to obtain encrypted inflection points, performing city matching on the encrypted inflection points using the Turf library, identifying the city to which each encrypted inflection point belongs, and generating a complete city list, wherein the user input is generated after the user inputs the starting point and the end point in the preset navigation software; For each city in the complete list of cities, extract all attractions in the city, determine the font size of the attraction according to the popularity of each attraction, and determine the weight of the city according to the weighted number of characters of all attractions and the font size of the attraction; According to the weight of each city in the complete city list, each city is allocated one by one in the form of a node to the shortest side direction of the preset canvas by using the Squarified layout algorithm, until the layout of all cities in the preset canvas is completed, and a layout canvas containing a rectangular space corresponding to each city is obtained; For each city in the canvas after layout, sort the attractions in the city from large to small according to their popularity to obtain the popularity ranking of the attractions. According to the popularity ranking of the attractions, starting from the center position of the rectangular space corresponding to the city, place the attraction label corresponding to each attraction in turn until the layout of all attractions of the city in the rectangular space is completed, traverse all cities until the visual layout of all cities in the canvas after layout is completed, and display the visual layout.
2. The visualization method for coupling place name labels and TreeMap segmentation according to claim 1 is characterized in that: The step of processing the spatial coordinate point sequence by using a preset broken line densification algorithm to obtain encrypted broken points includes: Using a preset polyline densification algorithm to perform a thinning operation on the spatial coordinate point sequence to obtain encrypted polyline points; Wherein, the spacing between each coordinate point in the encrypted inflection point is the same.
3. The visualization method for coupling place name labels and TreeMap segmentation according to claim 1, characterized in that: Determining the weight of the city according to the weighted number of characters of all attractions and the font size of the attractions includes: ; in, is the total weight of the city, Indicates the total number of attractions in the city. Indicates The number of characters in the POI label. Indicates The font size of each attraction label.
4. The visualization method for coupling place name labels and TreeMap segmentation according to claim 1, characterized in that: The Squarified layout algorithm is used to distribute each city in the form of a node to the shortest side direction of the preset canvas one by one until the layout of all cities in the preset canvas is completed, and a layout canvas containing a rectangular space corresponding to each city is obtained, including: For the weight of any city, in the process of allocating the city in the shortest side direction of the preset canvas in the form of nodes, obtain the first city allocation layout of the city in the largest rectangular space corresponding to the rectangular space allocated to the previous city, and obtain the second city allocation layout of the city in the remaining space to be allocated, where the remaining space to be allocated is the remaining space in the preset canvas after removing all the allocated rectangular spaces; Calculating a first aspect ratio corresponding to the first city allocation layout, calculating a second aspect ratio corresponding to the second city allocation layout, determining a city allocation layout with the smallest absolute value of the difference between the first aspect ratio and the second aspect ratio and 1 as a target allocation layout for the city, and allocating the city in the form of nodes to a preset canvas according to the target allocation layout; All cities are traversed until the layout of all cities in the preset canvas is completed, and a layout canvas containing a rectangular space corresponding to each city is obtained.
5. The visualization method for coupling place name labels and TreeMap segmentation according to claim 1 is characterized in that: Starting from the center position of the rectangular space corresponding to the city, placing the scenic spot label corresponding to each scenic spot in sequence until the layout of all scenic spots of the city in the rectangular space is completed, including: For any scenic spot label, when placing it, a collision check is performed with the label already placed in the rectangular space. In case of overlap, it is moved outward along the Archimedean spiral line and re-checked until there is no overlap, and the scenic spot label is fixed; All attractions are traversed according to the popularity of the attractions until all attraction labels are placed, completing the layout of all attractions of the city in the rectangular space.
6. The visualization method for coupling place name labels and TreeMap segmentation according to claim 5 is characterized in that: Before performing collision detection with a label already placed in the rectangular space during placement, the method further includes: For any scenic spot, processing the scenic spot label corresponding to the scenic spot according to the scenic spot font size of the scenic spot, and obtaining the scenic spot label after the scenic spot font size processing; Traverse all scenic spots and obtain the scenic spot labels corresponding to each scenic spot after the font size is processed.
7. The visualization method for coupling place name labels and TreeMap segmentation according to claim 1, characterized in that: After traversing all cities until the visual layout of all cities in the post-layout canvas is completed, the method further includes: For a rectangular space corresponding to any of the cities in the canvas after the layout, any current color is selected from a preset number of coloring schemes for assignment, and whether the current color conflicts with the color of an adjacent rectangular space is determined based on an adjacency matrix; If a color conflict occurs, the current color is abandoned, and the next color is selected from a preset number of coloring schemes for assignment until the current color does not conflict with the color of the adjacent rectangular space; If all colors in a preset number of coloring schemes conflict with the colors of adjacent rectangular spaces, then go back to the coloring of the rectangular space corresponding to the previous city and readjust the color matching until the rectangular spaces corresponding to all cities do not conflict with the colors of adjacent rectangular spaces, thereby obtaining a color-colored layout canvas.
8. The visualization method for coupling place name labels and TreeMap segmentation according to claim 7 is characterized in that: After obtaining the color-colored layout canvas, the method further includes: A Catmull-Rom spline curve is used to connect the center position of each city in the rectangular space in sequence according to the order of the cities in the complete city list to obtain a connected layout canvas.
9. A visualization device coupling place name labels and TreeMap segmentation, characterized in that: include: A receiving unit, the receiving unit is used to receive and respond to user input, process the starting point and the end point according to the preset navigation software, obtain a spatial coordinate point sequence corresponding to the starting point, all the waypoints and the end point, process the spatial coordinate point sequence using a preset broken line densification algorithm to obtain encrypted inflection points, use the Turf library to perform city matching on the encrypted inflection points, identify the city to which each encrypted inflection point belongs, and generate a complete city list, wherein the user input is generated after the user inputs the starting point and the end point in the preset navigation software; An extraction unit, the extraction unit is used to extract all scenic spots in each city in the complete city list, determine the font size of each scenic spot according to the popularity of each scenic spot, and determine the weight of the city according to the weighted number of characters of all scenic spots and the font size of the scenic spot; An allocation unit, the allocation unit is used to allocate each city in the complete city list in the form of a node to the shortest side direction of the preset canvas one by one by using the Squarified layout algorithm according to the weight of each city in the complete city list, until the layout of all cities in the preset canvas is completed, and a layout canvas containing a rectangular space corresponding to each city is obtained; A display unit, wherein for each city in the canvas after layout, the display unit sorts the popularity of each scenic spot in the city from large to small to obtain a scenic spot popularity ranking, and according to the scenic spot popularity ranking, starting from the center position of the rectangular space corresponding to the city, sequentially places the scenic spot label corresponding to each scenic spot until the layout of all scenic spots of the city in the rectangular space is completed, traverses all cities until the visual layout of all cities in the canvas after layout is completed, and displays the visual layout.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the visualization method for coupling place name labels and TreeMap decomposition as described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Track visualization method supporting expression of uncertainty hierarchical spatial information
CN117609355A
Multi-label POI information encryption query method and system for privacy protection
CN118898085A
Treemap visualization engine
US20040263513A1
Interactive and Scalable Treemap as a Visualization Service
US20120120086A1
Cited By
Business district semantic visualization method based on fine-grained conflict avoidance and special-shaped clearance compensation
CN122489853A
Semantic visualization method for business district based on fine-grained conflict avoidance and special-shaped gap compensation
CN122489853B