A central tag cloud generation method and interactive customization design system
The multi-angle radial shift algorithm is used to calculate the optimal placement position of the tag object, which solves the problem of tag crowding and direction consistency in the generation process of the central tag cloud, and improves the clarity and user interactivity of geographic information visualization.
Patent Information
- Application Number
- CN202410412473.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-04-08
AI Technical Summary
During the generation process of the central tag cloud, due to the imbalance of POI data, the tags are crowded and the layout is confusing, resulting in poor visual effects. Moreover, existing methods are difficult to ensure the consistency of the direction of the tags and the central position, affecting the clarity and visibility of geographic information visualization. interpretive.
A multi-angle radial shift algorithm is used to calculate the optimal placement position of the label object. By obtaining the screen coordinates and attributes of the points of interest within the geographical range delineated by the user on the map, the offset main angle is calculated, and the areas with a low label density are delineated. Sector range, dynamically adjust the radial offset step to ensure the direction consistency of the label and the center position and the compact layout.
It effectively solves the problem of unreasonable distribution of tag clouds, improves the readability and visual effects of information, ensures the direction consistency of tags and the center position, and improves tag layout efficiency and user interactivity.
Smart Images

Figure CN118277497B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of tag clouds, and specifically relates to a central tag cloud generation method and an interactive customization design system. Background Art
[0002] Tag Cloud, also known as word cloud, is a data visualization method that usually directly uses text symbols (or text labels) to express the subject terms or keywords in text materials. Its basic principle involves assigning corresponding visual attributes such as font size, weight, color and font direction to each subject term based on factors such as the category, frequency of occurrence and importance of the subject term, and displaying these tags in two-dimensional or three-dimensional space in a non-overlapping manner, which can help users quickly understand the main information of the text data.
[0003] As a variant of the tag cloud, the centered tag cloud has shown unique potential in the application of geographic information. It centers the tags on a certain geographic location, highlights the subject vocabulary of a specific geographic area, and provides a more accurate and intuitive expression of geographic information. This extended application provides a new way to visualize geospatial data, which helps to deepen the understanding of key concepts and regional characteristics in geographic information, and further promotes research and analysis in fields such as geography.
[0004] However, given the uneven spatial distribution of POI data, the layout space around the central location is very limited. The generation of a central tag cloud may be affected by the accumulation of a large amount of data, which will cause the tags to be crowded and arranged in a chaotic manner, resulting in visual unsightliness and reducing the clarity and interpretability of geographic information visualization. Moreover, after the tags that are close are placed first, the tags that are slightly farther away and in the same direction will be difficult to place normally. In order to ensure that the generated tag cloud layout is compact, the relative direction between the tag and the central location may change, causing its direction to mislead users.
[0005] In addition, in the field of LBS geographic element visualization, most of the existing tag clouds are only used as auxiliary visualization products in a comprehensive system, in which the information transmission effect is relatively limited, and it is difficult to generate more interactions with users and for users to customize the design according to their own needs. Summary of the invention
[0006] In view of this, the present invention proposes a central tag cloud generation method and an interactive customization design system, which are used to solve the problem of unreasonable distribution of existing central tag clouds.
[0007] In a first aspect, the present invention discloses a central tag cloud generation method, the method comprising:
[0008] Obtain the geographical range circled by the user on the map, and filter out points of interest within the geographical range from the database;
[0009] Get the center position selected by the user, calculate the screen coordinates and label attributes of each point of interest based on the attribute data of the filtered points of interest, and create a label list based on the screen coordinates and label attributes of each point of interest;
[0010] Tag objects are created in the canvas in sequence according to the tag list. Based on the main angle of the screen coordinates of the current point of interest relative to the center position, a multi-angle radial shift algorithm is used to calculate the optimal placement of the current tag object to generate a global, non-overlapping, central tag cloud.
[0011] On the basis of the above technical solution, preferably, the calculating the screen coordinates of each point of interest tag according to the attribute data of the screened point of interest specifically includes:
[0012] Extract the latitude and longitude attributes of each point of interest and determine the latitude and longitude range of the point of interest;
[0013] Initialize a blank canvas with a width of w and a length of h;
[0014] Convert the latitude and longitude coordinates of each point of interest to the screen coordinates of each point of interest label on the canvas.
[0015] On the basis of the above technical solution, preferably, the label attributes include the color, font size, font, font weight and offset main angle of the label;
[0016] The data in the tag list are arranged in ascending order according to the Euclidean distance between the screen coordinates of the interest point and the center position.
[0017] On the basis of the above technical solution, preferably, the offset main angle is calculated as follows:
[0018] Get the screen coordinates of the current point of interest from the label list;
[0019] Establish a polar coordinate system with the center position as the pole, and calculate the polar angle of the screen coordinates of the current point of interest in the polar coordinate system;
[0020] The polar angle is taken as the main angle of the offset of the screen coordinates of the current point of interest relative to the center position.
[0021] On the basis of the above technical solution, preferably, the method of calculating the optimal placement position of the current label object by using a multi-angle radial shift algorithm specifically includes:
[0022] Taking the ray where the main angle of the offset is located as the central axis, a sector range with a label density less than a preset threshold is defined by rotating the central axis clockwise or counterclockwise around the center position;
[0023] The sector range is evenly divided into a plurality of offset angles, each offset angle corresponds to a radial offset direction, and the initial placement position and radial offset step length of the label object in each radial offset direction are respectively calculated;
[0024] The label objects are moved radially from the initial placement position along the radial offset direction with the corresponding radial offset step length, and a position closest to the center position and not overlapping with the placed labels in the canvas is selected as the best placement position for the current label object.
[0025] On the basis of the above technical solution, preferably, the method of defining a sector range with a label density less than a preset threshold by rotating the central axis clockwise or counterclockwise around the central position specifically includes:
[0026] Taking the central axis as the starting point, rotate the central axis clockwise around the center position by α degrees as the first expansion starting point. Starting from the first expansion starting point, rotate the central axis clockwise at intervals of δ degrees to expand the range. Calculate the label density at the corresponding angle for each rotation. When the label density is greater than the maximum label density, stop expanding and obtain the minimum value θ of the sector range. min ;
[0027] Taking the central axis as the starting point, rotate the central axis counterclockwise around the center position by α degrees as the second expansion starting point. Starting from the second expansion starting point, rotate the central axis counterclockwise at intervals of δ degrees to expand the range. Calculate the label density at the corresponding angle for each rotation. When the label density is greater than the maximum label density, stop expanding and obtain the maximum value θ of the sector range. max ;
[0028] Finally, we get a sector range [θ min ,θ max ].
[0029] On the basis of the above technical solution, preferably, the formula for calculating the label density at the corresponding angle is:
[0030]
[0031] Wherein, tagDensity(θ) is the tag density at angle θ, tagNum(θ) is the number of placed tags at angle θ, and max(tagNum) is the maximum value of the number of placed tags at all angles.
[0032] On the basis of the above technical solution, preferably, the calculation of the initial placement position of the label object in each radial offset direction specifically includes:
[0033] Assume that the current tag object number is i, and the sector range is divided into J offset angles Each offset angle Corresponding to a radial offset direction j;
[0034] Then the initial placement position of label object i in the jth radial offset direction is:
[0035]
[0036] Among them, r(i, j) represents the initial placement position of tag object i in the jth radial offset direction, tagNum j Indicates the number of labels placed in the jth radial offset direction, wFontSize j Represents the weighted font size in the j-th radial offset direction, fontSize k Indicates the font size of the kth placed label in the jth radial offset direction.
[0037] On the basis of the above technical solution, preferably, the calculation formula of the radial offset step length is:
[0038]
[0039] Wherein, stepLength(i, j) represents the radial offset step length of tag object i in the jth radial offset direction; tagNum j Indicates the number of labels placed in the jth radial offset direction, fontSize i Indicates the font size of label object i.
[0040] In a second aspect of the present invention, based on the method described in the first aspect of the present invention, a central tag cloud interactive customization design system is proposed, the system comprising:
[0041] Data layer: used to provide online map service resources, maintain databases related to points of interest, and store user-defined LBS geographic element data;
[0042] Strategy layer: used to obtain user interaction data from the application layer, filter points of interest from the database of the data layer, generate a global non-overlapping central tag cloud; build a multi-scale model to support tag cloud preview roaming;
[0043] The strategy layer specifically includes:
[0044] Tag cloud generation module: obtain the geographical range circled by the user on the map from the application layer, and filter out the points of interest within the geographical range from the database of the data layer; calculate the screen coordinates and label attributes of each point of interest based on the attribute data of the filtered points of interest, and create a label list based on the screen coordinates and label attributes of each point of interest; create label objects in the canvas in sequence according to the label list, and calculate the main angle of the screen coordinate of the current point of interest relative to the center position; based on the main angle of the offset, use a multi-angle radial shift algorithm to calculate the optimal placement position of the current label object, and generate a global center-type label cloud without overlap;
[0045] Multi-scale model building module: A multi-scale model is built based on hierarchical structure design and interactive map ideas. The multi-scale model performs geographical scaling and label quantity adjustment on the central tag cloud by monitoring mouse wheel zoom events.
[0046] Application layer: used to provide a web interface for user interaction, load maps and points of interest on the web interface, draw the central tag cloud generated by the rendering strategy layer, display tag information, and support users to customize the design of tag attributes.
[0047] Compared with the prior art, the present invention has the following beneficial effects:
[0048] 1) The present invention filters points of interest according to the geographical range circled by the user on the map, creates a label list, uses a multi-angle radial shift algorithm to calculate the optimal placement position of each label object, and generates a global non-overlapping central label cloud, which can effectively solve the data accumulation problem that may occur during the label generation process and improve the readability of the information and the overall visual effect.
[0049] 2) The present invention calculates the main angle of the screen coordinates of the current point of interest relative to the center position, and defines a sector-shaped range with relatively small label density based on the main angle of the offset. A multi-angle radial shift algorithm is used within the sector-shaped range to detect the available space, so that labels in the same orientation are arranged in the same direction as much as possible. This can ensure the consistency of the relative direction between the label and the center position, avoid misleading the user due to the change in relative direction, and achieve a certain balance between the consistency of the relative direction between the label and the center position and the compactness of the label layout.
[0050] 3) The present invention calculates the initial placement position and the radial offset step length based on the number of labels placed in the radial offset direction and the font size, thereby realizing dynamic adjustment of the radial offset step length. This can speed up the search for the best placement position while ensuring compact arrangement of labels, thereby improving label layout efficiency.
[0051] 4) The present invention automatically generates a central tag cloud of the area drawn by the user through an interactive method, displaying the multi-dimensional attribute information of the points of interest within the range; at the same time, it supports the user to personalize the generated tag cloud to meet the user's customized requirements for information presentation.
[0052] 5) The present invention combines the geographical multi-scale effect, refers to the hierarchical structure design and the interactive map concept, and dynamically adjusts the generated tag cloud at different scales to ensure that it presents a clear visual effect at different geographical scales. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0054] Figure 1 A schematic diagram of a flow chart of a central tag cloud generation method of the present invention;
[0055] Figure 2 A schematic diagram of the principle of converting the latitude and longitude coordinates of each point of interest into screen coordinates;
[0056] Figure 3 A schematic diagram for calculating the main angle of deviation of the screen coordinates of the interest point relative to the center position;
[0057] Figure 4 This is an example diagram of the expansion of the fan range;
[0058] Figure 5 The final fan range [θ min ,θ max ]Schematic diagram;
[0059] Figure 6 A schematic diagram for determining the radial offset direction based on the sector range;
[0060] Figure 7 A schematic diagram of the structure of a central tag cloud interactive customization design system of the present invention;
[0061] Figure 8 Generate example graphs for POI screening and center-type tag clouds;
[0062] Fig. 9 Schematic diagram of zooming in on the central tag cloud at two scales. DETAILED DESCRIPTION
[0063] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0064] See also Figure 1 The present invention proposes a central tag cloud generation method, the method comprising:
[0065] S1. Get the geographic range circled by the user on the map, and filter out the points of interest within the geographic range from the database. The user draws a circular range on the initial map of the front end, reads the two parameters of the center latitude and longitude coordinates (loncenter, latcenter) and radius R of the circular range, and transmits the parameters to the backend database; after reading the parameters, the database will use SQL statements to filter the data of the points of interest within the drawn range in the database, and transmit it to the front end again. The selected points of interest are used as data to be involved in drawing the tag cloud. The database stores the data of points of interest (POI) of national scenic spots.
[0066] S2. Obtain the center position O selected by the user, calculate the screen coordinates and label attributes of each point of interest according to the attribute data of the screened points of interest, and create a label list according to the screen coordinates and label attributes of each point of interest.
[0067] S21. Calculate the screen coordinates of each point of interest.
[0068] First, extract the latitude and longitude attributes of each point of interest to determine the latitude and longitude range of the point of interest. That is, obtain the geographical range of the selected points of interest, that is, the minimum longitude (lon min ), minimum latitude (lat min ), maximum longitude (lon max ), maximum latitude (lat max ) to get the longitude span of the geographic range (lon max -lon min ) and latitude span (lat max -lat min ). This step aims to determine the geographical scope of tag cloud generation to ensure that the generated tag cloud can fully cover the specified geographical area.
[0069] Then, initialize a blank canvas with a width of w and a length of h, and convert the latitude and longitude coordinates of each point of interest into the screen coordinates of each point of interest label on the canvas, such as Figure 2The figure shows the principle of converting the longitude and latitude coordinates of each point of interest into screen coordinates. The formula is:
[0070]
[0071]
[0072] Where screenX i is the screen horizontal coordinate of the i-th point of interest label, screenY i is the screen ordinate of the i-th point of interest label, lon i is the longitude of the i-th point of interest tag, lat i is the latitude of the i-th interest point label; lon min ,lon max are the minimum longitude and maximum longitude in the longitude and latitude range, respectively. min ,lat max They are the minimum latitude and maximum latitude in the longitude and latitude range respectively.
[0073] S22: Initialize label attributes.
[0074] The Euclidean distance between the screen coordinates of each point of interest and the center position is calculated, and the interest point labels are arranged in ascending order according to the Euclidean distance. All interest point labels are divided into five categories according to the quintile discretization method, and different color attributes are assigned to each type of label, that is, the color band is mapped according to the distance from the center position.
[0075] Arrange the POI labels in descending order according to the scores (or other quantitative indicators) of each POI, divide all POI labels into 5 categories according to the quintile discretization method, and assign different levels of font size to each label.
[0076] Initially set a uniform font and weight for all labels.
[0077] Calculate the main angle Φ of the screen coordinates of the current point of interest relative to the center position O. Specifically, Figure 3 The figure shows a schematic diagram of calculating the main angle Φ of the screen coordinates of the point of interest relative to the center position, obtaining the screen coordinates of the current point of interest from the label list; establishing a polar coordinate system with the center position as the pole, and calculating the polar angle of the screen coordinates of the current point of interest in the polar coordinate system; and using the polar angle as the main angle Φ of the screen coordinates of the current point of interest relative to the center position.
[0078] Use the above five attributes of color, font size, font, font weight, and offset main angle as tag attributes to create a list of unplaced tags TagList unplaced =[Tag1,Tag2,Tag3,…,Tag n ], Tagsn Indicates the nth point of interest tag, and sorts the data in the tag list in ascending order according to the Euclidean distance between the point of interest and the center position. Initialize the placed tag list TagList placed Is empty.
[0079] S3. Create label objects in the canvas in sequence according to the label list, use a multi-angle radial shift algorithm to calculate the best placement of the current label object, and generate a global center-type label cloud without overlap.
[0080] The present invention uses a newly created label object as a label to be placed, and adopts a multi-angle radial shift algorithm to calculate the optimal placement position of the current label object.
[0081] Step S3 specifically includes the following sub-steps:
[0082] S31. Traverse the tag list TagList one by one unplaced , if TagList unplaced If it is not empty, take out the first tag Tag1 and create a tag object in the canvas according to the corresponding tag attributes.
[0083] S32, taking the ray where the offset main angle Φ of the label object is located as the central axis, and defining a sector range where the label density is less than a preset threshold by rotating the central axis clockwise and counterclockwise around the center position.
[0084] Taking the central axis as the starting point, rotate the central axis clockwise around the center position by α degrees as the first expansion starting point. Starting from the first expansion starting point, rotate the central axis clockwise at intervals of δ degrees to expand the range. Each rotation calculates the label density at the corresponding angle θ = Φ-α-δ*t. When the label density is greater than the maximum label density, stop expanding and obtain the minimum value θ of the fan range. min ; Where t is the number of expansions in a clockwise rotation.
[0085] The formula for calculating the label density at the corresponding angle is:
[0086]
[0087] Wherein, tagDensity(θ) is the tag density at angle θ, tagNum(θ) is the number of placed tags at angle θ, and max(tagNum) is the maximum value of the number of placed tags at all angles.
[0088] Similarly, starting from the central axis, rotate the central axis counterclockwise around the center position by α degrees as the second expansion starting point. Starting from the second expansion starting point, rotate the central axis counterclockwise at intervals of δ degrees to expand the range. Each rotation calculates the label density at the corresponding angle θ'=Φ+α+δ*t' until the label density is greater than the maximum label density. Then stop expanding and obtain the maximum value θ of the fan range. max ; where t' is the number of counterclockwise expansions. The formula for calculating the label density at angle θ' is the same as that for calculating the label density at angle θ.
[0089] For example, Figure 4 The figure shows an example of the expansion of the fan range. The central axis is rotated clockwise and counterclockwise around the center position by α = 10° as the initial fan range, and then the initial fan range is expanded clockwise and counterclockwise at intervals of δ = 1° until the label density is greater than the maximum label density. The expansion is stopped, and finally a fan range [θ min ,θ max ],like Figure 5 The final fan-shaped range [θ min ,θ max ]Schematic diagram.
[0090] In the fan-shaped range [θ min ,θ max ], the label density is small, there is more room for development, and the offset main angle Φ∈[θ min ,θ max ], so the best layout position of the current label object can be found in this sector range.
[0091] S33, dividing the sector range into a plurality of offset angles, each offset angle corresponding to a radial offset direction, and respectively calculating an initial placement position and a radial offset step length of the label object in each radial offset direction.
[0092] Assume that the current tag object number is i, and the sector range is divided into J offset angles like Figure 6 The figure shows a schematic diagram of determining the radial offset direction based on the sector range, assuming that the sector range is divided into 7 offset angles. Each offset angle Corresponding to a radial offset direction j.
[0093] like Figure 6 As shown, the initial placement position of label object i in the jth radial offset direction is:
[0094]
[0095] Among them, r(i, j) represents the initial placement position of tag object i in the jth radial offset direction, tagNum j Indicates the number of labels placed in the jth radial offset direction, wFontSize j Represents the weighted font size in the j-th radial offset direction, fontSize k Indicates the font size of the kth placed label in the jth radial offset direction.
[0096] The radial offset step length of label object i in the jth radial offset direction is:
[0097]
[0098] Wherein, stepLength(i, j) represents the radial offset step length of tag object i in the jth radial offset direction; tagNum j Indicates the number of labels placed in the jth radial offset direction. The larger the value, the denser the labels in direction j. The offset step size in this direction should be appropriately increased. fontSize i Indicates the font size of label object i. The larger the value, the smaller the offset step in this direction should be.
[0099] The present invention calculates the initial placement position and the radial offset step length based on the number of placed labels and the font size in the radial offset direction, thereby realizing dynamic adjustment of the radial offset step length. This can speed up the search for the best placement position while ensuring compact arrangement of labels, thereby improving label layout efficiency.
[0100] S34, starting from the initial placement position, each label object is radially moved outward along the radial offset direction with a corresponding radial offset step, and a position closest to the center position and not overlapping with the placed labels in the canvas is selected as the final placement position of the current label object.
[0101] Specifically, after each radial movement, a cover detection is performed with the placed tags in the canvas. If there is a cover, the label continues to move radially outward until there is no cover, and the position without cover in each radial offset direction is recorded; among all the positions without cover, the position closest to the center position is selected as the final placement position of the current tag object, and the tag is added to the TagList placed .
[0102] S35. If TagList unplaced If it is not empty, return to step S31 and repeat the process of steps S31 to S34 until all tags in the tag list are placed to obtain a global non-overlapping central tag cloud.
[0103] The present invention calculates the main angle of the screen coordinates of the current point of interest relative to the center position, and the main angle of the offset defines a sector-shaped range with a smaller label density. A multi-angle radial shift algorithm is used within the sector-shaped range to detect the available space, so that labels in the same orientation are arranged in the same direction as much as possible, which can ensure the consistency of the relative direction between the label and the center position, avoid misleading the user due to the change in relative direction, and achieve a certain balance between the consistency of the relative direction between the label and the center position and the compactness of the label layout.
[0104] Based on the above method embodiments, the present invention also proposes a central tag cloud interactive customization design system, the structure of which is as follows: Figure 7 As shown, the system comprises:
[0105] Data layer: used to provide online map service resources, maintain databases related to points of interest, and store user-defined LBS geographic element data. The online map service resources provide relevant map services for the application layer; the database stores point of interest (POI) data across the country;
[0106] Strategy layer: used to obtain user interaction data from the application layer, filter points of interest from the database of the data layer according to user input, generate a global non-overlapping central tag cloud; build a multi-scale model to support tag cloud preview roaming.
[0107] The strategy layer specifically includes a tag cloud generation module and a multi-scale model construction module, wherein:
[0108] Tag cloud generation module: obtain the geographical range circled by the user on the map from the application layer, and filter out the points of interest within the geographical range from the database of the data layer; calculate the screen coordinates and label attributes of each point of interest based on the attribute data of the filtered points of interest, and create a label list based on the screen coordinates and label attributes of each point of interest; create label objects in the canvas in sequence according to the label list, and calculate the main angle of the screen coordinate of the current point of interest relative to the center position; based on the main angle of the offset, use a multi-angle radial shift algorithm to calculate the optimal placement position of the current label object, and generate a global center-type label cloud without overlap;
[0109] Multi-scale model building module: It is used to build a multi-scale model based on hierarchical structure design and interactive map ideas, referring to the strategies of traditional maps in dealing with geographic scale effects, so as to support preview and zoom roaming of central tag clouds that take into account both global and local effects. The multi-scale model performs geographic scale scaling and tag quantity adjustment on the central tag cloud by monitoring mouse wheel zoom events.
[0110] The hierarchical structure design refers to the central tag cloud presenting tags at different levels to cope with different geographical scales; specifically, reducing the number of tags at a larger scale and displaying more detailed and sophisticated tag information at a smaller scale. The interactive map concept is derived from the common strategy of modern Web electronic maps in dealing with scale effects, that is, allowing users to freely zoom and switch geographical scales to achieve autonomous exploration and adjustment of the tag cloud.
[0111] Application layer: used to provide a web interface for user interaction, load maps and points of interest on the web interface, draw the central tag cloud generated by the rendering strategy layer, display tag information, and support users to customize the design of tag attributes.
[0112] Specifically, the web interface includes: initially loading the map where the user is located and supporting search and positioning, initially loading the coverage of scenic spots and points of interest across the country and supporting users to upload custom LBS geographic element data, supporting users to draw a circular range to filter the number of points of interest, drawing and rendering a central tag cloud, displaying the specific information of a tag selected by the mouse, supporting users to customize the color band, font size, font weight and other attributes of the drawn tag cloud, and displaying multi-scale preview and zoom roaming of the central tag cloud. Users can use events such as mouse wheel zooming and mouse dragging to achieve zoom roaming of the map in this interface. At the same time, there are map tools such as zoom buttons, scales, and map switching tools in this interface.
[0113] Among them, the data formats of user-defined LBS geographic feature data uploaded include common formats such as csv, excel, and shp. The geographic feature data are required to at least contain the place name, longitude and latitude coordinates, and quantitative indicators similar to scoring of the point data. The coordinates support common coordinate systems such as WGS84, GCJ02, and BD09.
[0114] The generated tag cloud layer can be zoomed and panned. When you click a tag with the mouse, the detailed information of the tag will be displayed in a small window, including the location name, longitude and latitude, distance from the center location and other attribute information of the tag.
[0115] Supports users to customize the color band, font size, font, font weight and other attributes of the drawn tag cloud. Specifically, after the user clicks to select a color band, the system will remap the colors of the drawn tags according to the distance from the center position; after the user clicks to reset the font size of a certain level of tags, the system will regenerate a central tag cloud for the drawn tags according to the font size set by the user; after the user clicks to select a font, the system will change the font of all the drawn tags; after the user clicks to select a font weight, the system will change the font weight of all the drawn tags.
[0116] The above system embodiments are implemented based on the method embodiments. Please refer to the method embodiments for a brief description of the system embodiments.
[0117] The system and effects of the present invention are further described below with reference to specific examples.
[0118] In this embodiment, the POI data of scenic spots across the country are derived from the keyword search in the Amap Web service, and the POI category is retrieved as 110,000 scenic spots. The name, address, longitude and latitude (GCJ-02 coordinate system), and rating attributes of each scenic spot POI are parsed. The system adopts B / S architecture, and the front-end development adopts HTML5 and JavaScript programming languages. The front-end script references Fabric.js, jQuery.js, etc. to implement the system functions.
[0119] (1) Initial map loading
[0120] The JS API of Amap is initially called to automatically obtain the user's current longitude and latitude, and display a vector map of the longitude and latitude. The system also supports users to enter a location in the search box, and the map will automatically zoom and move to the location entered by the user through the search positioning API. Users are supported to use mouse wheel zooming, mouse dragging and other events to zoom and roam the map. At the same time, there are map tools such as zoom buttons, scales, and map switching tools on this interface.
[0121] (2) Loading point of interest overlays
[0122] In the initial map interface, the AutoNavi JS Massive Overlay API will be called to load overlays of scenic spots and points of interest across the country; when the user hovers the mouse over a scenic spot, the name of the scenic spot will be dynamically displayed. At the same time, users are supported to upload customized LBS points of interest data in the front-end window. The data format supports common formats such as csv, excel, and shp. It is required that geographic element data should at least include the place name, longitude and latitude coordinates, and quantitative indicators similar to scoring of point data. The coordinates support common coordinate systems such as WGS84, GCJ02, and BD09.
[0123] (3) Points of interest screening
[0124] The system supports users to draw a circular coverage range on the initial map. The system will automatically read the latitude and longitude coordinates and radius parameters of the circle center of the circular coverage range and transmit the parameters to the backend database. After filtering the data of points of interest in the geographic range in the database, the data will be transmitted to the front end. Figure 8 Shown on the left.
[0125] (4) Draw a rendering-centric tag cloud
[0126] The center drawn by the user is used as the center of the tag cloud, the color band is mapped according to the distance from the center, the font size of the tag is mapped according to the rating of the scenic spot (or the quantitative attribute field customized by the user), and a global non-overlapping central tag cloud is generated based on Fabric.js rendering. The effect is shown in the figure below. Figure 8 Shown on the right.
[0127] Comparing the traditional center-type tag cloud drawing result with the center-type tag cloud drawing result of the present invention, although the traditional center-type tag cloud drawing can ensure that the generated tag cloud has a compact layout, the relative directions between the tag and the center position and between different tags have changed, and the orientation information between the geographical locations has been lost, which may mislead the user and affect the orientation judgment. In addition to the compact layout, the center-type tag cloud drawing result of the present invention can also retain relatively accurate orientation information, which is convenient for users to make orientation judgments between geographical locations and improve the amount of information in the visual expression of geographical targets.
[0128] (5) Label information display
[0129] After clicking a label, the detailed information of the point of interest will be displayed in the form of a floating window, including attribute information such as place name, longitude and latitude, and distance from the center.
[0130] (6) Customized tag cloud design
[0131] Support users to customize the color band, font size, font, and font weight attributes of the generated labels.
[0132] (7) Multi-scale model zoom roaming
[0133] The system will listen to the mouse wheel zoom event and call the generated multi-scale model to optimize the number of hierarchical structures of the central tag cloud. Fig. 9 This is a schematic diagram of zooming in and out of the central tag cloud on two scales by monitoring the mouse wheel event.
[0134] The present invention also discloses an electronic device, comprising: at least one processor, at least one memory, a communication interface and a bus; wherein the processor, memory, and communication interface communicate with each other through the bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to implement the aforementioned method of the present invention.
[0135] The present invention also discloses a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, wherein the computer instructions enable the computer to implement all or part of the steps of the method described in the embodiment of the present invention. The storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk, and other media that can store program codes.
[0136] The system embodiment described above is merely illustrative, wherein 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 distributed to multiple network units. A person skilled in the art may select some or all of the modules according to actual needs to achieve the purpose of the solution of this embodiment without creative effort.
[0137] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A central tag cloud generation method, characterized in that: The method comprises: Obtain the geographical range circled by the user on the map, and filter out points of interest within the geographical range from the database; Get the center position selected by the user, calculate the screen coordinates and label attributes of each point of interest based on the attribute data of the filtered points of interest, and create a label list based on the screen coordinates and label attributes of each point of interest; Create label objects in the canvas in sequence according to the label list. Based on the offset main angle of the screen coordinates of the current point of interest relative to the center position, use a multi-angle radial shift algorithm to calculate the optimal placement of the current label object, and generate a global non-overlapping central label cloud. The step of calculating the screen coordinates of each point of interest tag according to the attribute data of the filtered points of interest specifically includes: Extract the latitude and longitude attributes of each point of interest and determine the latitude and longitude range of the point of interest; Initialize a blank canvas with a width of w and a length of h; Convert the latitude and longitude coordinates of each point of interest into the screen coordinates of each point of interest label on the canvas; The calculation method of the offset main angle is: Get the screen coordinates of the current point of interest from the label list; Establish a polar coordinate system with the center position as the pole, and calculate the polar angle of the screen coordinates of the current point of interest in the polar coordinate system; Taking the polar angle as the main angle of the offset of the screen coordinates of the current point of interest relative to the center position; The method of using a multi-angle radial shift algorithm to calculate the optimal placement position of the current tag object specifically includes: Taking the ray where the main angle of the offset is located as the central axis, a sector range with a label density less than a preset threshold is defined by rotating the central axis clockwise or counterclockwise around the center position; The sector range is evenly divided into a plurality of offset angles, each offset angle corresponds to a radial offset direction, and the initial placement position and radial offset step length of the label object in each radial offset direction are respectively calculated; Starting from the initial placement position, the label objects are radially moved along the radial offset direction with the corresponding radial offset step length, and a position closest to the center position and not overlapping with the placed labels in the canvas is selected as the best placement position for the current label object; The calculation of the initial placement position of the label object in each radial offset direction specifically includes: Assume that the current tag object number is i, and the sector range is divided into J offset angles j = 1, 2, ..., J, each offset angle Corresponding to a radial offset direction j; Then the initial placement position of label object i in the jth radial offset direction is: Among them, r(i, j) represents the initial placement position of tag object i in the jth radial offset direction, tagNum j Indicates the number of labels placed in the jth radial offset direction, wFontSize j Represents the weighted font size in the j-th radial offset direction, fontSize k Indicates the font size of the kth placed label in the jth radial offset direction; The calculation formula of the radial offset step length is: Among them, stepLength(i, j) represents the radial offset step length of tag object i in the jth radial offset direction; tagNumj represents the number of tags placed in the jth radial offset direction, fontSize i Indicates the font size of label object i.
2. The method for generating a central tag cloud according to claim 1, characterized in that: The label attributes include the label's color, font size, font, font weight, and offset main angle; The data in the tag list are arranged in ascending order according to the Euclidean distance between the screen coordinates of the interest point and the center position.
3. The method for generating a central tag cloud according to claim 1, characterized in that: The method of defining a sector range where the label density is less than a preset threshold by rotating the central axis clockwise or counterclockwise around the central position specifically includes: Taking the central axis as the starting point, rotate the central axis clockwise around the center position by α degrees as the first expansion starting point. Starting from the first expansion starting point, rotate the central axis clockwise at intervals of δ degrees to expand the range. Calculate the label density at the corresponding angle for each rotation. When the label density is greater than the maximum label density, stop expanding and obtain the minimum value θ of the sector range. min ; Taking the central axis as the starting point, rotate the central axis counterclockwise around the center position by α degrees as the second expansion starting point. Starting from the second expansion starting point, rotate the central axis counterclockwise at intervals of δ degrees to expand the range. Calculate the label density at the corresponding angle for each rotation. When the label density is greater than the maximum label density, stop expanding and obtain the maximum value θ of the sector range. max ; Finally, we get a sector range [θ min ,θ max ].
4. The method for generating a central tag cloud according to claim 3, characterized in that: The formula for calculating the label density at the corresponding angle is: Wherein, tagDenSity(θ) is the tag density at angle θ, tagNum(θ) is the number of placed tags at angle θ, and max(tagNum) is the maximum value of the number of placed tags at all angles.
5. A central tag cloud interactive customization design system using the method according to any one of claims 1 to 4, characterized in that: The system comprises: Data layer: used to provide online map service resources, maintain databases related to points of interest, and store user-defined LBS geographic element data; Strategy layer: used to obtain user interaction data from the application layer, filter points of interest from the database of the data layer, generate a global non-overlapping central tag cloud; build a multi-scale model to support tag cloud preview roaming; The strategy layer specifically includes: Tag cloud generation module: obtain the geographical range circled by the user on the map from the application layer, and filter out the points of interest within the geographical range from the database of the data layer; calculate the screen coordinates and tag attributes of each point of interest based on the attribute data of the filtered points of interest, and create a tag list based on the screen coordinates and tag attributes of each point of interest; create tag objects in the canvas in sequence according to the tag list, and use a multi-angle radial shift algorithm to calculate the optimal placement position of the current tag object based on the main angle of the screen coordinates of the current point of interest relative to the center position, and generate a global center-type tag cloud without overlap; Multi-scale model building module: used to build a multi-scale model based on hierarchical structure design and interactive map ideas. The multi-scale model performs geographical scaling and label quantity adjustment on the central tag cloud by monitoring mouse wheel zoom events. Application layer: used to provide a web interface for user interaction, load maps and points of interest on the web interface, draw the central tag cloud generated by the rendering strategy layer, display tag information, and support users to customize the design of tag attributes.
