A method and system for dynamic visualization of vector data
By acquiring map tile requests and generating MVT vector tiles, the problems of latency and complex configuration in CGCS2000 geographic vector data display were solved, enabling fast loading and display, and improving transmission efficiency and convenience.
Patent Information
- Application Number
- CN202410131716.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2044-01-31
AI Technical Summary
Existing technologies suffer from latency and stuttering issues when displaying large-scale CGCS2000 geographic vector data, and their configuration is complex, failing to meet user experience requirements.
By establishing a communication connection between the client and the server, map tile requests are obtained, it is determined whether to use caching, format conversion and image compression are performed, and MVT vector tiles are generated according to the latitude and longitude range of the map tiles. This supports front-end or back-end rendering, reduces data volume, and improves transmission efficiency.
It effectively solves the latency and stuttering problem when dealing with large amounts of geographic vector data, improves the convenience of configuration queries and transmission efficiency, supports 2000 national geodetic coordinate systems, and is suitable for rendering needs in different application scenarios.
Smart Images

Figure CN118069767B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data visualization, in particular to a vector data dynamic visualization method and system. BACKGROUND
[0002] In geographic information applications, geographic vector data is one of the most important data types. With the continuous development of Web GIS (an interactive, distributed and dynamic geographic information system composed of multiple hosts, multiple databases of wireless terminals and connected by client and server) technology and the expansion of application scenarios, the data size and complexity of geographic vector data are increasing, and the business attributes of vector elements will dynamically change with the changes of application business. After July 2018, the 2000 national geodetic coordinate system (CGCS2000) is used comprehensively, and domestic geographic data processing and application also need to be carried out under this coordinate system. How to dynamically and efficiently display large-scale CGCS2000 vector data on the Web has become a problem to be solved.
[0003] The existing solution is generally to use open source GeoServer (a system software for rapidly sharing spatial geographic information) to publish 2000 national geodetic coordinate system map services, and load and display them through OpenLayers (a JavaScript class library package specially developed for Web GIS client development, used to realize access to map data published in standard format) map engine on the browser front end. The main process is as follows:
[0004] Step one, install GeoServer and configure data source, import CGCS2000 map vector data into PostgreSQL, select PG as data source and configure loading; Step two, create a working area for managing published map services; Step three, create a style for defining the style and symbol of the map service; Step four, create a layer to associate the data source and the style; Step five, publish the map service and set related parameters and permissions, which can be accessed through WMS (WebMap Service, a dynamic map service protocol) or WMTS (Web Map Tile Service, a tile-based map service protocol) protocol; Step six, use the front-end framework OpenLayers to call the WMS or WMTS service published by GeoServer to display the map in the web page; by configuring the data source, creating a working area, creating a style, creating a layer, publishing a map service and displaying it on the front end, the map data under the 2000 national geodetic coordinate system can be displayed.
[0005] However, there are some drawbacks to using GeoServer to publish map services and application demonstrations for the 2000 national geodetic coordinate system:
[0006] When querying and displaying millions of vector data, severe delays and stuttering occur when loading maps using WMS or WMTS services, resulting in a poor user experience and failing to achieve the expected results. Moreover, GeoServer is highly complex to learn and configure, and its configuration for 2000 national geodetic coordinate system tiles and symbolization is quite complicated, requiring a certain level of technical knowledge and time investment.
[0007] To address this problem, the present invention provides a method and system for dynamic visualization of vector data, thereby solving the aforementioned issues. Summary of the Invention
[0008] To address the problems existing in the prior art, this invention innovatively proposes a dynamic visualization method and system for vector data. It effectively solves the issues of latency and stuttering in querying and displaying large amounts of geographic vector data, as well as the complexity of query configuration caused by existing technologies. This invention effectively reduces data volume, improves transmission efficiency, and enables faster loading and display of map content. It supports both front-end and back-end rendering of vector tiles according to different application scenarios, supports 2000 national geodetic coordinate systems, and improves the convenience of configuring and querying geographic vector data.
[0009] The first aspect of this invention provides a method for dynamic visualization of vector data, applied to a server, comprising:
[0010] Establish a communication connection between the client browser and the server, and obtain the map tile request sent by the client browser; the coordinate system of the map is the 2000 National Geodetic Coordinate System;
[0011] Based on the map tile request sent by the client browser, obtain the map service name, the geographic vector data type in the map, and the ZXY index of the tiled map;
[0012] The system determines whether to use caching based on the geographic vector data type in the map. If caching is used, when the corresponding map tile is found in the cache, the map tile is format-converted and image-compressed, and the image result is returned to the front end for display.
[0013] If the cache is not used, or if the corresponding map tile does not exist in the cache, the ZXY index of the map tile is converted to a pixel coordinate system, and then the latitude and longitude coordinates are calculated using the pixel coordinates to obtain the latitude and longitude range of the map tile.
[0014] Generate MVT vector tiles in binary format based on the latitude and longitude range of the map tiles;
[0015] According to the rendering mode of the MVT vector tile, the MVT vector tile is dynamically rendered and displayed on a client browser or a server.
[0016] Optionally, the determining whether to use the cache according to the type of the geographic vector data in the map comprises: determining whether the type of the geographic vector data in the map is static geographic vector data, if the type of the geographic vector data in the map is static geographic vector data, the geographic vector data in the map uses the cache; and if the type of the geographic vector data in the map is dynamic geographic vector data, the geographic vector data in the map does not use the cache.
[0017] Optionally, the ZXY index of the map tile is converted into a pixel coordinate system, and then the longitude and latitude coordinates are calculated through the pixel coordinates to obtain the longitude and latitude range of the map tile, which specifically comprises:
[0018] The XY index of the current map tile is multiplied by the pixel coordinates of a single map tile to obtain the pixel coordinates of the upper left corner of the current map tile.
[0019] The pixel coordinates of the upper left corner of the current map tile are summed with the pixel coordinates of the map tile to obtain the pixel coordinates of the lower right corner of the current map tile.
[0020] The pixel coordinates of the upper left corner and the lower right corner of the current map tile are divided by the pixel resolution at the Z index level of the current map tile, respectively, to obtain the geographic longitude and latitude coordinates of the upper left corner and the lower right corner of the current map tile based on the original point when the map tile is operated; and the geographic longitude and latitude coordinates of the upper left corner and the lower right corner of the current map tile based on the original point when the map tile is operated are added and subtracted by the offset between the default starting point and the original point of the map tile operation, respectively, to obtain the actual geographic longitude and latitude of the upper left corner and the lower right corner of the current map tile.
[0021] The geographic longitude and latitude range of the current map tile is obtained according to the actual geographic longitude and latitude of the upper left corner and the lower right corner of the current map tile.
[0022] Further, the XY index of the current map tile is multiplied by the pixel coordinates of a single map tile to obtain the pixel coordinates of the upper left corner of the current map tile, which specifically comprises:
[0023] The X index of the current map tile is multiplied by the horizontal pixel coordinates of a single map tile to obtain the horizontal pixel coordinates of the upper left corner of the current map tile.
[0024] The Y index of the current map tile is multiplied by the vertical pixel coordinates of a single map tile to obtain the vertical pixel coordinates of the upper left corner of the current map tile.
[0025] Optionally, the generating the MVT vector tile in binary format according to the longitude and latitude range of the map tile specifically comprises:
[0026] Construct the latitude and longitude grid vector data mapLayer, and import it into the PostgreSQL spatial database; the coordinate system of the latitude and longitude grid vector data mapLayer is the 2000 national geodetic coordinate system;
[0027] Create a GIST spatial index for the spatial field Geom of the latitude and longitude grid vector data MapLayer in the PostgreSQL spatial database;
[0028] Create a latitude and longitude Envelope object according to the latitude and longitude range of the map slice, and perform spatial screening matching between the created latitude and longitude Envelope object and the GIST spatial index to obtain a geographic vector result dataset within the geographic spatial range;
[0029] Convert the geographic vector result dataset into a binary format MVT vector tile.
[0030] Optionally, according to the rendering mode of the MVT vector tile, the MVT vector tile is dynamically rendered and displayed on the client browser or the server side server, which specifically includes:
[0031] According to the rendering mode of the MVT vector tile, it is judged whether the MVT vector tile is dynamically rendered and displayed on the client browser or the server side server;
[0032] If the MVT vector tile is rendered on the client browser, the MVT vector tile result is directly returned to the client browser for loading, dynamic rendering and display, respectively;
[0033] If the MVT vector tile is rendered on the server side server, the MVT vector tile is parsed on the Java background of the server side server, and the multiple attribute fields in the MVT vector tile are hierarchically, combined and symbolically rendered.
[0034] Further, it also includes:
[0035] It is judged whether the picture corresponding to the rendered MVT vector tile needs to be cached through the Java background of the server side server. If it needs to be cached through the Java background of the server side server, the picture corresponding to the rendered MVT vector tile is written into the local cache library; if it does not need to be cached through the Java background of the server side server, the picture corresponding to the rendered MVT vector tile is converted and compressed according to the requested format, and is responded to the map front end display in the picture format.
[0036] Optionally, the hierarchical, combined and symbolic rendering of the multiple attribute fields in the MVT vector tile is specifically:
[0037] The service end server parses the returned MVT vector tile to obtain vector data of the layer, divides attribute value intervals of each attribute field of the parsed vector data into several segments, each kind of map symbol is used for corresponding representation of combinations between attribute value intervals of different fields of the parsed vector data, the map symbol style supports dynamic self-defined setting, and the rendered effect picture is converted into a picture result.
[0038] Further, when attribute values of each attribute field of the vector data change, corresponding map symbol rendering effects also dynamically change.
[0039] The second aspect of the application provides a vector data dynamic visualization system applied to a service end server and comprising:
[0040] The establishing module establishes a communication connection between the client browser and the service end server, and obtains a map slice request sent by the client browser; the coordinate system of the map is a 2000 national geodetic coordinate system;
[0041] The obtaining module obtains a map service name, a geographic vector data type in the map and a ZXY index of the sliced map slice according to the map slice request sent by the client browser;
[0042] The judging module judges whether to use a cache according to the geographic vector data type in the map, if the cache is used, when it is found that the corresponding map slice exists in the cache, performs format conversion and picture compression on the map slice, and returns the picture result to the front end for display;
[0043] The converting module converts the ZXY index of the map slice into a pixel coordinate system, and then calculates longitude and latitude coordinates through the pixel coordinates to obtain a longitude and latitude range of the map slice, if the cache is not used or when it is found that the corresponding map slice does not exist in the cache;
[0044] The generating module generates a binary format MVT vector tile according to the longitude and latitude range of the map slice;
[0045] The rendering module dynamically renders and displays the MVT vector tile in the client browser or the service end server according to a rendering mode of the MVT vector tile.
[0046] The technical scheme adopted in the application has the following technical effects:
[0047] 1. According to the map tile request sent by the client browser, the map service name, the geographic vector data type in the map, and the ZXY index of the sliced map tile are obtained; according to the geographic vector data type in the map, it is judged whether to use the cache, if the cache is used, when the corresponding map tile exists in the cache, the format conversion and picture compression of the map tile are carried out, and the picture result is returned to the front end display; if the cache is not used, or when the corresponding map tile does not exist in the cache, the ZXY index of the map tile is converted into a pixel coordinate system, and then the latitude and longitude coordinates are calculated through the pixel coordinates to obtain the latitude and longitude range of the map tile; the binary format MVT vector tile is generated according to the latitude and longitude range of the map tile; according to the rendering mode of the MVT vector tile, the MVT vector tile is dynamically rendered and displayed on the client browser or the server side server, effectively solving the problem that when the geographic vector data is large, the query display is prone to delay and lag, and the query configuration is complex, effectively reducing the data volume, improving the transmission efficiency, and enabling the map content to be loaded and displayed more quickly, supporting the front-end rendering and back-end rendering of the vector tile according to different application scenarios, supporting the 2000 national geodetic coordinate system, and improving the convenience of geographic vector data configuration query.
[0048] 2. In the technical scheme of the application, when the ZXY index of the map tile is calculated to obtain the latitude and longitude range of the map tile, not only the ZXY index of the map tile is considered, but also the pixel value of the map tile itself is combined, so that the reliability and accuracy of the obtained latitude and longitude range of the map tile are higher.
[0049] 3. In the technical scheme of the application, the latitude and longitude grid vector data mapLayer is constructed, and imported into the PostgreSQL spatial database; the GIST spatial index is created for the spatial field Geom of the latitude and longitude grid vector data MapLayer in the PostgreSQL spatial database; the latitude and longitude Envelope object is created according to the latitude and longitude range of the map tile, and the spatial screening matching of the created latitude and longitude Envelope object and the GIST spatial index is carried out to obtain the geographic vector result data set within the geographic space range; the geographic vector result data set is converted into the binary format MVT vector tile, the data is compressed through the vector tile technology, the data volume is reduced, the transmission efficiency is improved, and moreover, the spatial screening matching of the created latitude and longitude Envelope object and the GIST spatial index is more suitable for the matching of the million-level geographic vector data, so that the matching query speed of the geographic vector data is faster and the efficiency is higher.
[0050] 4、The technical scheme of the present application, if the MVT vector tile is rendered in the client browser, directly returns the MVT vector tile result to the client browser, and is loaded, dynamically rendered and displayed respectively; if the MVT vector tile is rendered in the server of the server, the MVT vector tile is parsed in the Java background of the server, and the multiple attribute fields in the MVT vector tile are hierarchically, combined and symbolically rendered, the front-end rendering and the back-end rendering of the vector tile can be supported according to different application scenarios, and the convenience and flexibility of the geographic vector data rendering are improved.
[0051] 5、The technical scheme of the present application, the server parses the returned MVT vector tile, obtains the vector data of the layer, divides the attribute value interval of each attribute field of the parsed vector data into several segments, each kind of map symbol is used for corresponding representation of the combination between the attribute value intervals of different fields of the parsed vector data, the map symbol style supports dynamic self-defined setting, and the rendered effect picture is converted into a picture result; the map style is dynamically rendered according to the change of the attribute value field of the geographic vector data, each kind of rendering corresponds to the combination between the attribute value intervals of different fields of the geographic vector data, and a cache picture is generated, so that the transmission and response speed are improved.
[0052] 6、The technical scheme of the present application, the map slice rule and the geographic vector data coordinate system are extended, and the 2000 national geodetic coordinate system is supported.
[0053] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0054] In order to more clearly illustrate the technical scheme in the embodiments of the present application or the prior art, the drawings needed in the embodiment or the prior art description will be briefly introduced below, and obviously, other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0055] Figure 1 A flowchart of the method of embodiment one in the present application scheme is shown in the figure.
[0056] Figure 2 Another flowchart of the method of embodiment one in the present application scheme is shown in the figure.
[0057] Figure 3 A flowchart of step S105 in the method of embodiment one in the present application scheme is shown in the figure.
[0058] Figure 4 A flowchart of step S107 in the method of embodiment one in the present application scheme is shown in the figure.
[0059] Figure 5 FIG. 1 is a flowchart of step S108 in the method of embodiment one in the present solution;
[0060] Figure 6 FIG. 2 is a structural diagram of the system of embodiment two in the present solution. DETAILED DESCRIPTION
[0061] In order to clearly illustrate the technical features of the present solution, the present solution will be described in detail below with specific embodiments and in conjunction with the accompanying drawings. The following disclosure provides many different embodiments or examples for implementing the different structures of the present solution. In order to simplify the disclosure of the present solution, the components and settings of specific examples are described below. In addition, reference numerals and / or letters can be repeatedly referred to in different examples. Such repetition is for the purpose of simplification and clarity, and does not in itself indicate a relationship between the various embodiments and / or settings being discussed. It should be noted that the components illustrated in the drawings are not necessarily drawn to scale. The present solution omits the description of well-known components and processing techniques and processes to avoid unnecessarily limiting the present solution.
[0062] Embodiment one
[0063] As shown in FIG. 1, the present solution provides a vector data dynamic visualization method applied to a server side server, which comprises the following steps: Figures 1-2
[0064] S101, establishing a communication connection between a client side browser and the server side server, and obtaining a map tile request sent by the client side browser; the coordinate system of the map is the 2000 national geodetic coordinate system;
[0065] S102, obtaining a map service name, a geographic vector data type in the map, and a ZXY index of the map tile after slicing according to the map tile request sent by the client side browser;
[0066] S103, judging whether to use a cache according to the geographic vector data type in the map, if the result of the judgment is yes, then executing step S104; if the result of the judgment is no, then executing step 105;
[0067] S104, judging whether the corresponding map tile exists in the cache, if the result of the judgment is yes, then executing step S106; if the result of the judgment is no, then executing step S105;
[0068] S106, performing format conversion and picture compression on the map tile, and returning the picture result to the front end for display;
[0069] S105, converting the ZXY index of the map tile into a pixel coordinate system, and then calculating the latitude and longitude coordinates through the pixel coordinates to obtain the latitude and longitude range of the map tile;
[0070] S107 generates MVT vector tiles in binary format based on the latitude and longitude range of the map tiles;
[0071] S108, based on the rendering method of MVT vector tiles, dynamically renders and displays MVT vector tiles in the client browser or on the server.
[0072] In step S1, a communication connection is established between the client browser and the server. The communication connection can be wireless or wired, and can be flexibly adjusted according to the actual situation. This invention does not impose any restrictions on this.
[0073] A map web engine is used, defining 2000 national geodetic coordinate systems and configuring hierarchical parameters. Leaflet (an open-source JavaScript library for mobile-friendly interactive maps) is used as the display engine, and Mapbox gl (a plugin for Leaflet) is used as an extension component to provide vector tile loading and display functionality for the front end. The map service request interface address is configured on the web side, and the client browser initiates a map tile request when viewing the map.
[0074] In step S102, the server requests a map tile from the client's browser. The map tile request includes configuration information such as the map service name, the geographic vector data type in the map, the ZXY index of the map tile after tiling (i.e., Z, X, and Y indices correspond to the level, row number, and column number, respectively), and whether to use map caching.
[0075] In step 103, determining whether to use caching based on the geographic vector data type in the map specifically involves: determining whether the geographic vector data type in the map is static geographic vector data; if the geographic vector data type in the map is static geographic vector data, the geographic vector data in the map is cached; if the geographic vector data type in the map is dynamic geographic vector data, the geographic vector data in the map is not cached.
[0076] In steps S104 and S106, for static geographic vector data, caching can be used to improve the speed of map web access. After parsing the map service request, the corresponding ZXY result is retrieved from the cache through the tile index. If the map tile exists, format conversion and image compression are performed, and the image result is returned to the front end for display.
[0077] In steps S105 and S107-S108, where, as Figures 2-3 As shown, step S105 specifically includes:
[0078] S1051, Multiply the XY index of the current map tile by the pixel coordinates of a single map tile to obtain the pixel coordinates of the top left corner of the current map tile;
[0079] Specifically, the X index of the current map slice is multiplied by the horizontal pixel coordinate of a single map slice to obtain the horizontal pixel coordinate of the top-left corner of the current map slice; the Y index of the current map slice is multiplied by the vertical pixel coordinate of a single map slice to obtain the vertical pixel coordinate of the top-left corner of the current map slice. That is, the pixel coordinates xy of the slice are obtained by multiplying the XY index of the current slice by the pixel width and height of a single slice, and the starting pixel coordinates xy of the top-left corner of the current map slice are obtained by default.
[0080] S1052, the pixel coordinates of the top-left corner of the current map slice are summed with the map slice pixel coordinates to obtain the pixel coordinates of the bottom-right corner of the current map slice;
[0081] The pixel coordinates of the top-left corner of the current map slice are obtained, and then the pixel width and height of the current map slice are added to obtain the pixel coordinate value x1y1 of the bottom-right corner of the current map slice.
[0082] S1053, the pixel coordinate value of the top-left corner and the pixel coordinate value of the bottom-right corner of the current map slice are divided by the pixel resolution at the Z index level of the current map slice, respectively, to obtain the geographic longitude and latitude coordinates of the top-left corner and the bottom-right corner of the current map slice, respectively, based on the origin of the map slice operation; the geographic longitude and latitude coordinates of the top-left corner and the bottom-right corner of the current map slice, respectively, based on the origin of the map slice operation, are added and subtracted by the offset between the default starting point and the origin of the map slice operation, to obtain the actual geographic longitude and latitude of the top-left corner and the bottom-right corner of the current map slice, respectively.
[0083] In the case of no translation of the map, the pixel coordinate value (xy) of the top-left corner and the pixel coordinate value (x1y1) of the bottom-right corner of the current map slice are divided by the pixel resolution at the current Z level, respectively, to obtain the geographic longitude and latitude coordinates of the top-left corner and the bottom-right corner of the current map slice, respectively, based on the origin (0, 0) of the map slice operation. However, in actual production of map slices, if the default starting point longitude and latitude of the map slicing operation is not at the origin (0, 0), the corresponding offset needs to be added and subtracted to the obtained geographic longitude and latitude to obtain the actual geographic longitude and latitude lnglat. That is, the offset corresponds to the relative position and difference between the default starting point longitude and latitude of the map slicing operation and the origin (0, 0). Here, the pixel scale of the map at different levels is supported for self-defined configuration, such as the scale of the map at the 15th level is self-defined as 21571.688777. Through the above calculation, the ZXY slice index is calculated to [-180, 180], [-90, 90] longitude and latitude coordinates lnglat.
[0084] S1054, the geographic longitude and latitude range of the current map slice is obtained according to the actual geographic longitude and latitude of the top-left corner and the bottom-right corner of the current map slice.
[0085] The geographical longitude and latitude range [x0Min, y0Min, x0Max, y0Max] of the map slice is obtained through the longitude and latitude values of the upper left corner and the lower right corner. The geographical longitude of the upper left corner of the map slice is x0Min, and the geographical latitude of the upper left corner of the map slice is y0Max; the geographical longitude of the lower right corner of the map slice is x0Max, and the geographical latitude of the lower right corner of the map slice is y0Min.
[0086] As shown in Figures 4-5 S1071, constructing a longitude and latitude grid vector data mapLayer and importing it into a PostgreSQL spatial database; the coordinate system of the longitude and latitude grid vector data mapLayer is a 2000 national geodetic coordinate system;
[0087] S1071, constructing a longitude and latitude grid vector data mapLayer and importing it into a PostgreSQL spatial database; the coordinate system of the longitude and latitude grid vector data mapLayer is a 2000 national geodetic coordinate system;
[0088] The geographical longitude and latitude range [x0Min, y0Min, x0Max, y0Max] of the map slice is obtained through the longitude and latitude values of the upper left corner and the lower right corner. The geographical longitude of the upper left corner of the map slice is x0Min, and the geographical latitude of the upper left corner of the map slice is y0Max; the geographical longitude of the lower right corner of the map slice is x0Max, and the geographical latitude of the lower right corner of the map slice is y0Min.
[0089] S1072, creating a GIST spatial index for the spatial field Geom of the longitude and latitude grid vector data MapLayer in the PostgreSQL spatial database;
[0090] S1073, creating a longitude and latitude Envelope object according to the longitude and latitude range of the map slice, and performing spatial screening matching between the created longitude and latitude Envelope object and the GIST spatial index to obtain a geographical vector result data set within the geographical spatial range;
[0091] In the PostgreSQL spatial database, a GIST spatial index is created for the spatial field Geom of MapLayer, a longitude and latitude Envelope object is created through the geographical longitude and latitude range [x0Min, y0Min, x0Max, y0Max] of the map slice, and spatial screening matching is performed between the longitude and latitude Envelope object and the grid layer in the PostgreSQL spatial database to obtain a result data set within the geographical longitude and latitude spatial range of the map slice. An interface is reserved here to support spatial range query and feature quantity statistics for the vector layer, and spatial clustering is supported for point-shaped data.
[0092] S1074, converting the geographical vector result data set into a binary format MVT vector tile.
[0093] Convert the geographic vector result data set to the plane coordinate, and convert the converted geographic vector result data set, i.e., the vector tile of the 2000 national geodetic coordinate system, into a vector tile.
[0094] As shown in Figure 5 S1081, according to the rendering mode of the MVT vector tile, it is judged whether the MVT vector tile is dynamically rendered and displayed in the client browser; if the judgment result is yes, step S1082 is executed, and if the judgment result is no, step S1083 is executed.
[0095] S1081, according to the rendering mode of the MVT vector tile, it is judged whether the MVT vector tile is dynamically rendered and displayed in the client browser; if the judgment result is yes, step S1082 is executed, and if the judgment result is no, step S1083 is executed.
[0096] The configuration information in the map tile request can include the rendering mode of the MVT vector tile, for example, whether it is rendered in the client browser (front-end rendering) or rendered in the server (back-end rendering), according to the configuration information in the map tile request, it can be judged whether the MVT vector tile is dynamically rendered and displayed in the client browser.
[0097] S1082, directly return the MVT vector tile result to the client browser for loading, dynamic rendering and display, respectively;
[0098] When the server does not need to render, the vector tile result is directly returned to the front end for loading, dynamic rendering and display by Mapbox gl, and the map style is updated in the client.
[0099] S1083, then parse the MVT vector tile in the Java background of the server, and render the multiple attribute fields in the MVT vector tile hierarchically, combined and symbolized.
[0100] Specifically, the server parses the returned MVT vector tile to obtain the vector data of the layer, divides the attribute value interval of each attribute field of the parsed vector data into several segments, and each kind of map symbol is used to correspondingly represent the combination between the attribute value intervals of different fields of the parsed vector data.
[0101] The service end uses the PBF dependent tool kit to parse the binary vector MVT vector tile returned by the database to obtain the vector data of the layer. The general rendering mode is single field segmentation rendering processing. According to the actual business needs, the single map element multi-attribute field combination filtering and symbolization are newly added here, and the point, line and face three spatial geometric types are supported. Taking the national grid surface vector data as an example, each attribute value interval of the precipitation, wind level and ground pressure three attribute fields obtained after parsing is divided into 5 (for example) segments, and the three attributes are combined, and different map symbols are used to represent the 5 segment levels of the three fields, that is, each map symbol is used to correspond to represent the combination between the attribute value intervals of the parsed vector data different fields. The map symbol style supports dynamic setting, and the attribute selection and segment interval can be customized. During the background slice rendering, the rendering is performed according to the attribute value of the attribute field in the database each time, and when the attribute value of the attribute field changes, the rendering effect also dynamically changes. Finally, the rendered effect picture is converted into a picture result. By supporting the clustering and statistics of the vector elements in a single slice, the analysis results of a single map slice are customized to be displayed. The implementation of the multi-field custom segmentation, combination and symbolization of different spatial geometric type layers is newly added here.
[0102] In step S1084, it is judged whether the picture corresponding to the rendered MVT vector tile needs to be cached by the Java background of the service end server. If the judgment result is yes, step S1085 is executed; if the judgment result is no, step S1086 is executed.
[0103] The information configured in the map slice request can also include the picture cache setting corresponding to the rendered MVT vector tile, for example, whether the picture corresponding to the rendered MVT vector tile needs to be cached by the Java background of the service end server. According to the information configured in the map slice request, it can be judged whether the picture corresponding to the rendered MVT vector tile needs to be cached by the Java background of the service end server.
[0104] In step S1085, the picture corresponding to the rendered MVT vector tile is written into the local cache library.
[0105] Through the Java background cache configuration, when the cache is enabled, the rendered picture is selected to be written into the local cache library.
[0106] In step S1086, the picture corresponding to the rendered MVT vector tile is converted and compressed according to the requested format, and is responded to the map front end display in the picture format.
[0107] The picture corresponding to the rendered MVT vector tile is converted and compressed according to the requested format, and is responded to the map front end display in the picture format.
[0108] The configuration information in the map slice request can also include a requested format of the rendered MVT vector tile corresponding picture, for example, bmp format, jpg format, etc. According to the configuration information in the map slice request, the rendered MVT vector tile corresponding picture in the requested format can be obtained.
[0109] According to the map slice request sent by the client browser, the application obtains a map service name, a geographic vector data type in a map, and a ZXY index of a sliced map slice; according to the geographic vector data type in the map, it is judged whether to use a cache, if the cache is used, when it is found in the cache that the corresponding map slice exists, the map slice is format-converted and picture-compressed, and the picture result is returned to the front end for display; if the cache is not used, or when it is found in the cache that the corresponding map slice does not exist, the ZXY index of the map slice is converted into a pixel coordinate system, the latitude and longitude coordinates are calculated through the pixel coordinates, and the latitude and longitude range of the map slice is obtained; a binary format MVT vector tile is generated according to the latitude and longitude range of the map slice; and the MVT vector tile is dynamically rendered and displayed on the client browser or the server side server according to the rendering mode of the MVT vector tile, effectively solving the problems of delay and lagging in query display and complex query configuration caused by the prior art when the geographic vector data volume is large, effectively reducing the data volume, improving the transmission efficiency, enabling the map content to be loaded and displayed more quickly, supporting front-end rendering and back-end rendering of the vector tile according to different application scenarios, supporting the 2000 national geodetic coordinate system, and improving the convenience of geographic vector data configuration query.
[0110] In the technical scheme of the application, when the latitude and longitude coordinates of the map slice are calculated from the ZXY index of the map slice, not only the ZXY index of the map slice is considered, but also the pixel value of the map slice itself is combined, so that the reliability and accuracy of the obtained latitude and longitude range of the map slice are higher.
[0111] In the technical scheme of the present application, the latitude and longitude grid vector data mapLayer is constructed and imported into the PostgreSQL spatial database; a GIST spatial index is created for the spatial field Geom of the latitude and longitude grid vector data MapLayer in the PostgreSQL spatial database; a latitude and longitude Envelope object is created according to the latitude and longitude range of the map slice, and the created latitude and longitude Envelope object is subjected to spatial screening matching with the GIST spatial index to obtain a geographic vector result data set within the geographic spatial range; the geographic vector result data set is converted into a binary format MVT vector tile, the data is compressed through the vector tile technology, the data volume is reduced, the transmission efficiency is improved, and moreover, the spatial screening matching of the created latitude and longitude Envelope object with the GIST spatial index is more suitable for the matching of the million-level geographic vector data, so that the matching query speed of the geographic vector data is faster and the efficiency is higher.
[0112] In the technical scheme of the present application, if the MVT vector tile is rendered in the client browser, the MVT vector tile result is directly returned to the client browser for loading, dynamic rendering and display, respectively; if the MVT vector tile is rendered in the server side server, the MVT vector tile is parsed in the Java background of the server side server, and the multiple attribute fields in the MVT vector tile are rendered in a hierarchical, combined and symbolized manner, the front-end rendering and back-end rendering of the vector tile can be supported according to different application scenarios, and the convenience and flexibility of the geographic vector data rendering are improved.
[0113] In the technical scheme of the present application, the server side server parses the returned MVT vector tile to obtain the vector data of the layer, divides the attribute value interval of each attribute field of the parsed vector data into several segments, each kind of map symbol is used to correspond to represent the combination between the attribute value intervals of different fields of the parsed vector data, the map symbol style supports dynamic self-defined setting, and the rendered effect picture is converted into a picture result; the map style is dynamically rendered according to the change of the attribute value field of the geographic vector data, each kind of rendering corresponds to the combination between the attribute value intervals of different fields of the geographic vector data, and a cache picture is generated, so that the transmission and response speed is improved.
[0114] In the technical scheme of the present application, the map slice rule and the geographic vector data coordinate system are extended to support the 2000 national geodetic coordinate system.
[0115] Embodiment two
[0116] As Figure 6 shown, the technical scheme of the present application further provides a vector data dynamic visualization system applied to a server side server, which comprises:
[0117] The establishing module 101 establishes a communication connection between the client browser and the server, and obtains a map tile request sent by the client browser; and the coordinate system of the map is the 2000 national geodetic coordinate system.
[0118] The obtaining module 102 obtains a map service name, a geographic vector data type in the map and a ZXY index of a sliced map tile according to the map tile request sent by the client browser.
[0119] The judging module 103 judges whether to use a cache according to the geographic vector data type in the map, and if the cache is used, when the corresponding map tile is found in the cache, performs format conversion and picture compression on the map tile, and returns the picture result to the front end for display.
[0120] The converting module 104 converts the ZXY index of the map tile into a pixel coordinate system, and then calculates longitude and latitude coordinates through the pixel coordinates to obtain a longitude and latitude range of the map tile if the cache is not used or the corresponding map tile is not found in the cache.
[0121] The generating module 105 generates a binary format MVT vector tile according to the longitude and latitude range of the map tile.
[0122] The rendering module 106 dynamically renders and displays the MVT vector tile on the client browser or the server according to a rendering mode of the MVT vector tile.
[0123] According to the map tile request sent by the client browser, the map service name, the geographic vector data type in the map and the ZXY index of the sliced map tile are obtained; whether to use the cache is judged according to the geographic vector data type in the map, and if the cache is used, when the corresponding map tile is found in the cache, format conversion and picture compression are performed on the map tile, and the picture result is returned to the front end for display; if the cache is not used or the corresponding map tile is not found in the cache, the ZXY index of the map tile is converted into a pixel coordinate system, and then longitude and latitude coordinates are calculated through the pixel coordinates to obtain a longitude and latitude range of the map tile; a binary format MVT vector tile is generated according to the longitude and latitude range of the map tile; and the MVT vector tile is dynamically rendered and displayed on the client browser or the server according to a rendering mode of the MVT vector tile, thereby effectively solving the problems that, due to the prior art, when the geographic vector data is large, query display is prone to delay and lag, and query configuration is complex, effectively reducing the data volume, improving the transmission efficiency, enabling the map content to be loaded and displayed more quickly, supporting front-end rendering and back-end rendering of the vector tile according to different application scenarios, supporting the 2000 national geodetic coordinate system, and improving the convenience of geographic vector data configuration query.
[0124] In the technical scheme of the present application, when calculating the longitude and latitude coordinates of the map slice ZXY index and obtaining the longitude and latitude range of the map slice, not only the ZXY index of the map slice is considered, but also the pixel value of the map slice itself is combined, so that the reliability and accuracy of the obtained longitude and latitude range of the map slice are higher.
[0125] In the technical scheme of the present application, the longitude and latitude grid vector data mapLayer is constructed and imported into a PostgreSQL spatial database; a GIST spatial index is created for the spatial field Geom of the longitude and latitude grid vector data MapLayer in the PostgreSQL spatial database; a longitude and latitude Envelope object is created according to the longitude and latitude range of the map slice, and the created longitude and latitude Envelope object is subjected to spatial screening matching with the GIST spatial index to obtain a geographic vector result data set within the geographic spatial range; the geographic vector result data set is converted into a binary format MVT vector tile, the data is compressed through the vector tile technology, the data volume is reduced, and the transmission efficiency is improved, and moreover, the spatial screening matching of the created longitude and latitude Envelope object with the GIST spatial index is more suitable for the matching of the million-level geographic vector data, so that the matching query speed of the geographic vector data is faster and the efficiency is higher.
[0126] In the technical scheme of the present application, if the MVT vector tile is rendered in the client browser, the MVT vector tile result is directly returned to the client browser for loading, dynamic rendering and display; if the MVT vector tile is rendered in the server, the MVT vector tile is parsed in the Java background of the server, and the multiple attribute fields in the MVT vector tile are rendered in a hierarchical, combined and symbolized manner, so that the front-end rendering and back-end rendering of the vector tile are supported according to different application scenarios, and the convenience and flexibility of the geographic vector data rendering are improved.
[0127] In the technical scheme of the present application, the returned MVT vector tile is parsed by the server to obtain the vector data of the layer, the attribute value interval of each attribute field of the parsed vector data is divided into several segments, each kind of map symbol is used to correspond to represent the combination between the attribute value intervals of different fields of the parsed vector data, the map symbol style supports dynamic self-definition setting, and the rendered effect picture is converted into a picture result; the map style is dynamically rendered according to the change of the attribute value field of the geographic vector data, each kind of rendering corresponds to the combination between the attribute value intervals of different fields of the geographic vector data, and a cache picture is generated, so that the transmission and response speed is improved.
[0128] In the technical scheme of the present application, the map slice rule and the geographic vector data coordinate system are extended, and the 2000 national geodetic coordinate system is supported.
[0129] The above describes the specific embodiments of the present application in combination with the drawings, but is not a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications or variations made by those skilled in the art on the basis of the technical solutions of the present application without creative labor are still within the protection scope of the present application.
Claims
1. A method for dynamic visualization of vector data, characterized by, The application is applied to a server side server, comprising: establishing a communication connection between a client browser and the server side server, and obtaining a map tile request sent by the client browser; the coordinate system of the map is the 2000 national geodetic coordinate system; according to the map tile request sent by the client browser, obtaining a map service name, a geographical vector data type in the map, and a ZXY index of the sliced map tile; determining whether to use a cache according to the geographical vector data type in the map, if the cache is used, when the corresponding map tile exists in the cache, performing format conversion and picture compression on the map tile, and returning the picture result to the front end for display; if the cache is not used, or when the corresponding map tile does not exist in the cache, converting the ZXY index of the map tile into a pixel coordinate system, and then calculating longitude and latitude coordinates through the pixel coordinates to obtain a longitude and latitude range of the map tile; generating a binary format MVT vector tile according to the longitude and latitude range of the map tile; according to a rendering mode of the MVT vector tile, dynamically rendering and displaying the MVT vector tile on the client browser or the server side server.
2. The method for dynamic visualization of vector data according to claim 1, characterized in that, Determining whether to use a cache according to the geographical vector data type in the map specifically includes: determining whether the geographical vector data type in the map is static geographical vector data, if the geographical vector data type in the map is static geographical vector data, the geographical vector data in the map uses the cache; if the geographical vector data type in the map is dynamic geographical vector data, the geographical vector data in the map does not use the cache.
3. The method of claim 1, wherein, Converting the ZXY index of the map tile into a pixel coordinate system, and then calculating longitude and latitude coordinates through the pixel coordinates to obtain a longitude and latitude range of the map tile specifically includes: multiplying the XY index of the current map tile with the pixel coordinates of a single map tile to obtain the pixel coordinates of the left upper corner of the current map tile; summing the pixel coordinates of the left upper corner of the current map tile with the pixel coordinates of the current map tile to obtain the pixel coordinates of the right lower corner of the current map tile; dividing the pixel coordinates of the left upper corner and the right lower corner of the current map tile by the pixel resolution under the Z index level of the current map tile to obtain the geographical longitude and latitude coordinates of the left upper corner and the right lower corner of the current map tile based on the original point of the map tile operation; and performing addition and subtraction operations on the geographical longitude and latitude coordinates of the left upper corner and the right lower corner of the current map tile based on the original point of the map tile operation and the offset between the default starting point and the original point to obtain the actual geographical longitude and latitude of the left upper corner and the right lower corner of the current map tile, respectively. obtaining the geographical longitude and latitude range of the current map tile according to the actual geographical longitude and latitude of the left upper corner and the right lower corner of the current map tile.
4. The method of claim 3, wherein, Multiplying the XY index of the current map tile with the pixel coordinates of a single map tile to obtain the pixel coordinates of the left upper corner of the current map tile specifically includes: multiplying the X index of the current map tile with the horizontal pixel coordinates of a single map tile to obtain the horizontal pixel coordinates of the left upper corner of the current map tile; multiplying the Y index of the current map tile with the vertical pixel coordinates of a single map tile to obtain the vertical pixel coordinates of the left upper corner of the current map tile.
5. The method of claim 1, wherein, The method for generating MVT vector tiles in binary format according to the latitude and longitude range of map slices specifically comprises the following steps: Constructing latitude and longitude grid vector data mapLayer and importing a PostgreSQL spatial database; the coordinate system of the latitude and longitude grid vector data mapLayer is the 2000 national geodetic coordinate system; Creating a GIST spatial index for the spatial field Geom of the latitude and longitude grid vector data MapLayer in the PostgreSQL spatial database; Creating a latitude and longitude Envelope object according to the latitude and longitude range of the map slice, and performing spatial screening matching between the created latitude and longitude Envelope object and the GIST spatial index to obtain a geographic vector result dataset within the geographic spatial range; Converting the geographic vector result dataset into an MVT vector tile in binary format.
6. The method of claim 1, wherein, According to the rendering mode of the MVT vector tile, the MVT vector tile is dynamically rendered and displayed on the client browser or the server side server, specifically comprising the following steps: According to the rendering mode of the MVT vector tile, it is judged whether the MVT vector tile is dynamically rendered and displayed on the client browser or the server side server; If the MVT vector tile is rendered on the client browser, the MVT vector tile result is directly returned to the client browser for loading, dynamic rendering and display, respectively; If the MVT vector tile is rendered on the server side server, the MVT vector tile is parsed in the Java background of the server side server, and the multiple attribute fields in the MVT vector tile are hierarchically combined and symbolically rendered.
7. The method of claim 6, further comprising: Comprise: Judging whether the picture corresponding to the rendered MVT vector tile needs to be cached by the Java background of the server side server, and if so, writing the picture corresponding to the rendered MVT vector tile into a local cache library; If not, the picture corresponding to the rendered MVT vector tile is converted and compressed according to the requested format, and is responded in a picture format for map front-end display.
8. The method of claim 6, wherein, The hierarchical combination and symbolic rendering of the multiple attribute fields in the MVT vector tile specifically comprises the following steps: The server side server parses the returned MVT vector tile to obtain vector data of the layer, divides the attribute value interval of each attribute field of the parsed vector data into several segments, each map symbol is used to correspond to represent the combination between the attribute value intervals of different fields of the parsed vector data, the map symbol style supports self-defined dynamic setting, and the rendered effect picture is converted into a picture result.
9. The method of claim 8, wherein, When the attribute value of each attribute field of the vector data changes, the corresponding map symbol rendering effect also dynamically changes.
10. A system for dynamic visualization of vector data, characterized in that Applied to the server side server, comprising: A building module establishes a communication connection between the client browser and the server side server, and obtains a map slice request sent by the client browser; the coordinate system of the map is the 2000 national geodetic coordinate system; The acquisition module acquires a map service name, a geographic vector data type in a map, and a ZXY index of a sliced map slice according to a map slice request sent by a client browser; The judgment module judges whether to use a cache according to the geographic vector data type in the map. If the cache is used, the map slice is format-converted and picture-compressed when the corresponding map slice is found to exist in the cache, and a picture result is returned to a front end for display. The conversion module converts the ZXY index of the map slice into a pixel coordinate system, calculates longitude and latitude coordinates through the pixel coordinates, and obtains a longitude and latitude range of the map slice if the cache is not used or the corresponding map slice is found to not exist in the cache. The generation module generates a binary format MVT vector tile according to the longitude and latitude range of the map slice. The rendering module dynamically renders and displays the MVT vector tile on the client browser or the server according to a rendering mode of the MVT vector tile.
Citation Information
Patent Citations
Tile map using method adapting to low network bandwidth environment
CN110866132A
A spatial geographic data slicing method and rendering method
CN113032513A