Vector tile style conversion method and device, equipment and medium

By analyzing and converting Mapbox GL style vector tile data to Maptalks style, the compatibility issues between different WebGIS frameworks were resolved, achieving efficient and aesthetically pleasing rendering effects and expanding the application scope of the Maptalks framework.

CN118916437APending Publication Date: 2024-11-08HANGZHOU DT DREAM TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411017345.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

Incompatibility of vector tile styles between different WebGIS frameworks prevents GIS applications from simultaneously supporting multiple service data, affecting rendering quality and interactivity.

Method used

A method and apparatus are provided to analyze vector tile data in the Mapbox GL style, identify the layer type, and convert it to the Maptalks style according to conversion rules, ensuring efficient and aesthetically pleasing rendering without loss of key parameters.

Benefits of technology

It enables vector tile style conversion between different WebGIS frameworks, ensuring both aesthetic appeal and efficiency in rendering, and expanding the application scope of the MapTalks framework.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916437A_ABST
    Figure CN118916437A_ABST
Patent Text Reader

Abstract

The invention provides a vector tile style conversion method and device, equipment and a medium. The method comprises the following steps: obtaining vector tile data to be converted, wherein the vector tile data comprises vector tile data in a mapbox GL style; analyzing layers contained in the obtained vector tile data, and obtaining a layer type of each layer; and on the basis of a conversion rule corresponding to the layer type, converting a layer contained in the vector tile data into a layer of a maptalks style, and obtaining the vector tile data of the maptalks style after conversion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data technology, and in particular to a vector tile style conversion method, device, equipment and medium. Background Art

[0002] Geographic Information System (GIS) is a computer system used to collect, store, manage, process, retrieve, analyze and express geographic information data. It is a general technology for analyzing and processing massive geographic data.

[0003] WebGIS visualization currently mainly uses the GIS framework combined with GIS service data to display map pages. However, when rendering GIS service data, there are differences in service vendors, service standards, service versions, etc. The methods of obtaining service data and the formats of service data are different, which makes it impossible to be compatible with back-end services at the same time, affecting GIS applications. Summary of the invention

[0004] In view of this, this specification provides the following methods, devices, equipment and media.

[0005] In a first aspect of the present application, a method for converting a vector tile style is provided, the method comprising:

[0006] Obtain vector tile data to be converted, wherein the vector tile data includes vector tile data in a mapbox GL style;

[0007] Analyze the layers contained in the acquired vector tile data, and obtain the layer type of each layer;

[0008] Based on the conversion rule corresponding to the layer type, the layer contained in the vector tile data is converted into a maptalks style layer to obtain the converted maptalks style vector tile data.

[0009] In a second aspect of the present application, a vector tile style conversion device is provided, the device comprising:

[0010] A receiving unit, used to obtain vector tile data to be converted, wherein the vector tile data includes vector tile data in a mapbox GL style;

[0011] An acquisition unit, used for analyzing the layers contained in the acquired vector tile data, and acquiring the layer type of each layer;

[0012] The output unit is used to convert the layer contained in the vector tile data into a maptalks style layer based on the conversion rule corresponding to the layer type, so as to obtain the converted maptalks style vector tile data.

[0013] In a third aspect of the present application, an electronic device is provided, comprising a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via the bus;

[0014] The memory stores machine-readable instructions, and the processor executes the following method by calling the machine-readable instructions:

[0015] Obtain vector tile data to be converted, wherein the vector tile data includes vector tile data in a mapbox GL style;

[0016] Analyze the layers contained in the acquired vector tile data, and obtain the layer type of each layer;

[0017] Based on the conversion rule corresponding to the layer type, the layer contained in the vector tile data is converted into a maptalks style layer to obtain the converted maptalks style vector tile data.

[0018] In a fourth aspect of the present application, a machine-readable storage medium is provided, wherein the machine-readable storage medium stores machine-readable instructions, and when the machine-readable instructions are called and executed by a processor, the following method is implemented:

[0019] Obtain vector tile data to be converted, wherein the vector tile data includes vector tile data in a mapbox GL style;

[0020] Analyze the layers contained in the acquired vector tile data, and obtain the layer type of each layer;

[0021] Based on the conversion rule corresponding to the layer type, the layer contained in the vector tile data is converted into a maptalks style layer to obtain the converted maptalks style vector tile data.

[0022] The above embodiments of this specification have at least the following beneficial effects:

[0023] The above technical solution analyzes the style correspondence between mapbox GL style vector tiles and maptalks style vector tile data, determines the conversion rules of vector tile styles corresponding to layers of different layer types, and converts the layers contained in mapbox GL style vector tile data into maptalks style layers without losing the main parameters, and ensures that the converted styles can be more beautiful and efficiently applied. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 is a flow chart of a vector tile style conversion method shown in an exemplary embodiment;

[0025] Figure 2 is a schematic diagram of a layer style conversion shown in an exemplary embodiment;

[0026] Figure 3 is a schematic diagram of converting a Sprite image into a single image according to an exemplary embodiment;

[0027] Figure 4 is a schematic diagram of a vector tile style conversion method shown in an exemplary embodiment;

[0028] Figure 5 is a hardware structure diagram of an electronic device in which a vector tile style conversion device is located, showing an exemplary embodiment;

[0029] Figure 6 It is a block diagram of a vector tile style conversion device shown in an exemplary embodiment. DETAILED DESCRIPTION

[0030] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0031] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.

[0032] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of this specification, the related technologies of furniture traceability involved in the embodiments of this specification are briefly described below.

[0033] Geographic Information System (GIS): A computer system used to collect, store, manage, process, retrieve, analyze and express geographic information data. It is a general technology for analyzing and processing massive geographic data.

[0034] WebGIS Engine: WebGIS Engine is a tool for creating and managing WebGIS applications, which can help users display and interact with map data. It can help developers quickly and easily build and manage complex GIS applications, while also improving the interaction and productivity between users and map data.

[0035] Vector tiles: is an efficient data format for web maps, which stores geographic information data in vector form, such as roads, buildings, and rivers. Compared with traditional raster tiles, vector tiles have higher rendering flexibility, lower data transmission and loading costs, higher map clarity, and stronger interactivity. With vector tiles, users can customize map styles according to their needs, achieve fast map display and interactive operations, and provide accurate, customized, and highly interactive map experience. Therefore, vector tiles are widely used in web map services, mobile map applications, online navigation, and other fields, bringing users an excellent map experience.

[0036] Style: Vector tile style is a specification for defining the rendering effect of vector tiles in WebGIS. It can include the color, fill, opacity, line width, symbol and other attributes of vector elements such as lines, surfaces and points, and is defined and managed through CSS style sheets or JSON format files. The definition of vector tile style can be based on different frameworks and specifications. When using vector tiles, according to the definition of vector tile style, vector data can be stored and rendered in a tile segmented manner, and the expected map effect can be presented. The design and optimization of vector tile style is one of the important technologies to achieve high-performance rendering and interaction in WebGIS.

[0037] Style conversion: Vector tile style conversion is the process of storing and rendering vector data in a tiled manner, and defining corresponding vector styles to present different map effects. It is one of the key technologies for achieving high-performance rendering and interaction in WebGIS. Since different WebGIS frameworks use different vector tile formats and style specifications, the implementation methods of vector tile style conversion will also be different for different frameworks. When converting, it is necessary to select a suitable conversion method based on factors such as the characteristics of the vector data, the requirements for map rendering effects, and the characteristics of the framework itself, and define the corresponding vector style to present the expected map effect.

[0038] Style Expression: Vector tile style expression is a powerful tool for defining vector tile annotations and layer styles. By using expressions, users can dynamically calculate and generate styles according to their needs, achieving highly flexible and personalized map rendering. This expression language supports conditional judgments, loops, attribute references and function calls, allowing users to customize style attributes such as color, size, opacity, and implement complex data aggregation and classification. The advantage of vector tile style expressions lies in its flexibility, scalability and ease of maintenance, making it one of the key technologies widely used in Web map services and mobile map applications, providing users with a highly customized and interactive map experience.

[0039] CSS (Cascading Style Sheets): A computer language used to add styles (fonts, spacing, colors, etc.) to structured documents (such as HTML documents or XML applications) or

[0040] CSS Sprites is a technique for combining multiple images into a single image file, commonly used in web and game development. By placing multiple images in the same file and using CSS or other programming languages ​​to control the display of different parts, loading time can be reduced and performance can be improved. Sprites can contain buttons, icons, animation frames, etc., and all images are loaded by one request instead of requesting each image separately, thereby reducing the number of network requests and increasing page loading speed.

[0041] Mapbox GL and maptalks are two JavaScript-based WebGIS frameworks for creating interactive map applications. They both have the characteristics of cross-platform, scalability, and rich map style support.

[0042] Mapbox GL has a large developer community, providing a wealth of plug-ins, tools, and tutorial resources to facilitate developers to use and expand functions. Mapbox GL style vector tile data resources are very rich. However, the learning curve of Mapbox GL is relatively steep, and it requires certain JavaScript and map-related knowledge to develop. At the same time, commercial licensing restrictions may also limit its development and use in certain usage scenarios.

[0043] Maptalks is also a lightweight framework that loads quickly and provides an easy-to-use API with good plug-in extensibility. Developers can choose and integrate various plug-ins according to their needs to expand the functions and effects of map applications.

[0044] In addition, maptalks is also an open source project with an active developer community that provides many examples, documents, and support to facilitate developers to learn and solve problems. Maptalks provides an API adapted to mobile devices, which can easily develop mobile map applications. However, compared with mapbox GL, maptalks provides relatively fewer map styles, which may be slightly limited in the selection of styles, and is relatively simplified in terms of functions and tools.

[0045] Many WebGIS frameworks support the mapbox GL style, but the maptalks framework currently does not directly support the mapbox GL style, which limits the use of the maptalks framework.

[0046] In view of this, this specification proposes a general method for converting mapbox GL style vector tiles to maptalks style vector tiles, so that the maptalks framework can directly use mapbox GL style vector tile data for vector tile rendering.

[0047] The present application is described below through specific embodiments and in combination with specific application scenarios.

[0048] See also Figure 1 , Figure 1 The figure is a flowchart of a method for converting a vector tile style, shown in an exemplary embodiment.

[0049] The above method can perform the following steps:

[0050] Step 102: Obtain vector tile data to be converted, wherein the vector tile data includes vector tile data in a mapbox GL style.

[0051] Since there are abundant resources of mapbox GL style vector tile data, when there is mapbox GL style vector tile data, you can convert the mapbox GL style vector tile data into maptalks style, and then render it by the maptalks framework.

[0052] You can first obtain the vector tile data of the Mapbox GL style that needs to be converted.

[0053] Step 104: Analyze the layers contained in the acquired vector tile data, and obtain the layer type of each layer.

[0054] Mapbox GL style vector tile data is a standardized representation of data. Vector tile data is usually composed of multiple layers, and the data of each layer is organized in a fixed style.

[0055] When performing style conversion on vector tile data, the style conversion can be performed on a layer-by-layer basis and corresponding conversion rules can be used for different types of layers.

[0056] The layers contained in the acquired vector tile data may be analyzed, and the layer type of each layer may be acquired. The layer type of the layer may represent the type of the image rendered by the layer.

[0057] In the Mapbox GL style specification, the type property in the layer object represents the layer type of the layer. Layer types can include: area layer, line layer, point layer, circle layer, heat map layer, raster layer, etc.

[0058] The attribute value of the layer's type attribute is fill, indicating that the layer is a surface layer and can be rendered as a filled polygon with an optional stroke border; the attribute value of the layer's type attribute is line, indicating that the layer is a line layer and can be rendered as a stroked line; the attribute value of the layer's type attribute is symbol, indicating that the layer is a point layer and can be rendered as an icon or text label; the attribute value of the layer's type attribute is ciecle, indicating that the layer is a surface layer and can be rendered as a filled circle.

[0059] Step 106: based on the conversion rule corresponding to the layer type, convert the layer included in the vector tile data into a maptalks style layer to obtain the converted maptalks style vector tile data.

[0060] After determining the layer types of each layer contained in the obtained vector tile data, the corresponding conversion rules can be determined according to the layer type to convert the mapbox GL style layer into a maptalks style layer. Maptalks style layers can usually be organized in the form of vector rendering plug-ins. Layers of different layer types can be converted into vector rendering plug-ins corresponding to the layer type.

[0061] In both mapbox GL style and maptalks style vector tile data, json statements are used to describe the layers, mainly in the form of parameter key-value pairs to describe the layer content, and the values ​​of the parameter key-value pairs can be represented by expressions; in mapbox GL style layers, image files are usually referenced in the form of sprites, while in maptalks style layers, image files are referenced as single images.

[0062] Specifically, the statements describing the layer can be converted from the mapbox GL style to the maptalks style, including the style of the parameter key-value pairs in the statement, the style of the parameter expression, and the style of the referenced image file.

[0063] After each layer completes the style conversion, the vector tile data is converted into vector tile data called maptalks style, which can be directly rendered by the maptalks framework.

[0064] The above embodiment analyzes the style correspondence between the vector tile data of the mapbox GL style and the vector tile data of the maptalks style, and determines the conversion rules of the vector tile styles corresponding to the layers of different layer types, so as to convert the layers contained in the vector tile data of the mapbox GL style into the layers of the maptalks style without losing the main parameters, and ensure that the converted styles can be more beautiful and efficiently applied.

[0065] See also Figure 2 , Figure 2 It is a schematic diagram of a layer style conversion shown in an exemplary embodiment.

[0066] In both mapbox GL style and maptalks style vector tile data, json statements can be used to describe the layer, mainly in the form of parameter key-value pairs to describe the layer content, and the value of the parameter key-value pair can be represented by an expression; in mapbox GL style layers, image files are usually referenced in the form of sprites, while in maptalks style layers, image files are referenced as single images.

[0067] Specifically, the style conversion of the layer can be decomposed into converting the statement describing the layer from the mapbox GL style to the maptalks style, including the style of the parameter key-value pairs in the statement, the style of the parameter expression, and the style of the referenced image file.

[0068] The following introduces the style transfer rules for different types of layers.

[0069] Mapbox GL style layers of different layer types, converted to maptalks style, different plugin properties of rendering plugin.

[0070] Taking the surface layer as an example, the plugin properties of the maptalks-style rendering plugin can usually be expressed as follows:

[0071] / / [Required] Plugin type, fixed as icon

[0072] type:"icon",

[0073] / / [Required]Data configuration

[0074] dataConfig:{

[0075] / / [Required] Data type, fixed as point

[0076] type:"point",

[0077] / / [optional]Default is false

[0078] / / Declare whether to include only 2D data.

[0079] only2D:true

[0080] Specifically, for a surface layer whose layer type value is fill, the plug-in type value of the converted vector rendering plug-in is fill; the data type value is fill;

[0081] For a line layer whose layer type value is line, the plug-in type value of the converted vector rendering plug-in is line; the data type value is line;

[0082] For a point layer whose layer type value is symbol, the plug-in type value of the converted vector rendering plug-in is icon; the data type value is point;

[0083] For a circle layer whose layer type value is circle, the type value of the converted vector rendering plug-in is also icon; the data type value is point.

[0084] The above is the conversion of the style of the layer type. According to the layer type, the style conversion can be performed on the parameter key-value pairs that describe the layer content.

[0085] For example, the parameter key-value pairs in the area layer can be converted as follows:

[0086] The fill color parameter 'fill-color' is converted to the polygon fill parameter polygonFill; the fill opacity parameter 'fill-opacity' is converted to the polygon opacity parameter polygonOpacity; the fill outline color parameter 'fill-outline-color' is converted to the line color parameter lineColor; the fill outline width parameter 'fill-outline-width' is converted to the line width parameter lineWidth; the fill pattern parameter 'fill-pattern' is converted to the polygon fill pattern file parameter polygonPatternFile.

[0087] The representation of the parameter value of the corresponding parameter can also be converted in style. For example, the value of the fill-pattern parameter points to the pattern read from the sprite image, and the polygon fill pattern file parameter polygonPatternFile points to the address of a separate image file.

[0088] For another example, the visibility parameter 'visibility' of a layer can be converted to the visible parameter visible, and the values ​​of the visibility parameter 'visibility', 'visible' and 'none', can be converted to the values ​​'true' and 'false' respectively.

[0089] Similar to the parameters in the surface layer, the line color parameter 'line-color', line opacity parameter 'line-opacity', line width parameter 'line-width', dashed line array parameter 'line-dasharray', line type parameter 'line-pattern' and other parameters in the line layer can be converted to line color parameter lineColor, line opacity parameter lineOpacity, line width parameter lineWidth, dashed line array parameter lineDasharray, line pattern file parameter linePatternFile and other parameters respectively.

[0090] When converting from Mapbox GL to Maptalks, there may be parameters that do not correspond one-to-one. You can convert one Mapbox GL style parameter to one or more Maptalks style parameters; you can also convert multiple Mapbox GL style parameters to one or more Maptalks style parameters; so that the parameters before and after the conversion describe the same rendered graphics.

[0091] For example, for the point layer, parameters such as whether icon overlap is allowed 'icon-allow-overlap', whether icon position is ignored 'icon-ignore-placement', icon image parameter 'icon-image', icon rotation angle parameter 'icon-rotate', icon opacity parameter 'icon-opacity' can be converted into parameters such as whether icon overlap is allowed markerAllowOverlap, whether icon position is ignored markerIgnorePlacement, icon file parameter markerFile, icon rotation angle parameter markerRotation, icon opacity parameter markerOpacity, etc.

[0092] However, there are no corresponding maptalks style parameters for the icon offset parameter 'icon-offset' and the icon size 'icon-size'.

[0093] The icon offset parameter 'icon-offset' can be converted into two parameters: the icon x-direction offset parameter markerDx, and the icon y-direction offset parameter markerDy;

[0094] Similarly, the icon size parameter 'icon-size' can be converted into two parameters: the icon width parameter markerWidth, and the icon height parameter markerHeight.

[0095] The above are just examples of the conversion rules of parameter key-value pairs in some layers. The parameter key-value pairs in each layer of the mapbox GL style vector tile data can be converted as above according to the corresponding conversion rules, and this manual will not list them exhaustively.

[0096] The values ​​of parameter key-value pairs in layers of different styles can be represented by expressions, but the formats of expressions supported by different styles are also different.

[0097] When performing style conversion, the style of the expression needs to be converted.

[0098] For example, the color parameter 'circle-color' of the circle represents the color of the circle. The value of the following parameter 'circle-color' is expressed in a case expression, which means that the color of the circle is determined according to the value of the parameter speed. The color of the circle is represented by the RGBA parameter rgba. RGBA is a color space model consisting of an RGB color space and an alpha channel. The four parameters of rgba represent red, green, blue, and alpha channels respectively. The alpha channel can describe the opacity of the color.

[0099] 'circle-color':[

[0100] 'case',

[0101] ['<',['get','speed'],10.8],'rgba(0,0,0,0)', / / When it is less than 10.8, the color is transparent black

[0102] ['<',['get','speed'],17.2],'rgba(153,255,153,.9)', / / When it is greater than or equal to 10.8 and less than 17.2, the color is light green

[0103] ['<',['get','speed'],24.5],'rgba(102,204,255,.9)', / / When it is greater than or equal to 17.2 and less than 24.5, the color is light blue

[0104] ['<',['get','speed'],32.7],'rgba(255,255,102,.9)', / / When it is greater than or equal to 24.5 and less than 32.7, the color is light yellow

[0105] ['<',['get','speed'],41.5],'rgba(253,139,0,.9)', / / When it is greater than or equal to 32.7 and less than 41.5, the color is orange

[0106] ['<',['get','speed'],50.1],'rgba(255,51,0,.9)', / / When it is greater than or equal to 41.5 and less than 50.1, the color is red

[0107] 'rgba(255,0,255,.9)' / / Default value, when it is greater than or equal to 50.1, the color is purple ]

[0109] The case expression is used in the above parameters to select the corresponding color value according to the truth of each condition. ['get','speed'] means to get the value of the speed parameter of the feature and compare it with each threshold. Each condition corresponds to a color value, which indicates the color of the feature when the condition is met.

[0110] The converted maptalks style polygon filling parameter polygonFill with the same meaning can be expressed as follows:

[0111] "polygonFill":{

[0112] "property":"speed", / / Set the style according to the 'speed' property value

[0113] "type":"interval", / / Use interval type rendering

[0114] "stops":[

[0115] [10.8,"rgba(0,0,0,0)"], / / When the 'speed' attribute value is less than 10.8, the polygon fill color is transparent

[0116] [17.2,"rgba(153,255,153,.9)"], / / When the 'speed' attribute value is greater than or equal to 10.8 and less than 17.2, the polygon fill color is light green

[0117] [24.5,"rgba(102,204,255,.9)"], / / When the 'speed' attribute value is greater than or equal to 17.2 and less than 24.5, the polygon fill color is light blue

[0118] [32.7,"rgba(255,255,102,.9)"], / / When the 'speed' attribute value is greater than or equal to 24.5 and less than 32.7, the polygon fill color is light yellow

[0119] [41.5,"rgba(253,139,0,.9)"], / / When the 'speed' attribute value is greater than or equal to 32.7 and less than 41.5, the polygon fill color is orange

[0120] [50.1,"rgba(255,51,0,.9)"] / / When the 'speed' attribute value is greater than or equal to 41.5 and less than 50.1, the polygon fill color is red

[0121] ],

[0122] "default":"rgba(255,0,255,.9)" / / The default polygon fill color is purple

[0123] }

[0124] In the above parameters, the polygonFill attribute is used to set the fill color of the polygon feature, and the color is set according to the different values ​​of the 'speed' attribute. The rendering method type is interval (interval type), that is, the color is set according to the interval of the attribute value. The stops array defines the color settings for different intervals, and default specifies the default fill color.

[0125] It can be seen that the representation of the parameter value after the expression style conversion has changed, but the meaning remains the same and the rendering result remains unchanged.

[0126] In the mapbox GL style vector tile data, the part involving pictures is read using sprite images and their index files; while in the maptalks style vector tile data, pictures are usually directly represented by pictures or base64 encoding.

[0127] Since a Sprite image is a single image file that combines multiple images, each image needs to be extracted from the Sprite image and converted into an independent image file.

[0128] See also Figure 3 , Figure 3 The diagram is a schematic diagram showing a method of converting a Sprite image into a single image according to an exemplary embodiment.

[0129] First, the sprite image file and the sprite image index file corresponding to the sprite image can be extracted. The sprite image is usually a png format file, and can also be a jpg format or other commonly used image format file.

[0130] The sprite image index file can indicate the position of each individual image on the sprite image. Usually, the sprite image index file can use four parameters x, y, width and height to indicate the position of a single image on the sprite image. Among them, the parameters x and y indicate the starting position of the image, width indicates the width of the image, and height indicates the height of the image.

[0131] Two virtual canvas elements can be created. The virtual canvas element, or virtual canvas element, can be used to create the concept of graphics or images in memory and perform various drawing operations on them.

[0132] Then, the sprite image file is read into memory and drawn onto a virtual canvas element canvas1.

[0133] Based on the parameters in the index file, you can capture a single image from canvas1. Specifically, you can traverse the index file and capture a single image based on each set of x, y, width and height parameters in the index file.

[0134] Draw the captured single image onto another virtual canvas element cavans2 and export it to get a single image.

[0135] In vector tile data, images are usually not large, and can be represented in base64 format encoding, without having to store them separately as image files and then reference them. Therefore, the single image in the canvas2 above can be directly exported to base64 format.

[0136] In an exemplary embodiment shown in this specification, after the vector tile data is converted into a maptalks style, the maptalks framework can be used to render the vector tiles after the style conversion on a map to obtain a map graphic.

[0137] An embodiment of a method for converting a vector tile style in this specification is described in detail below.

[0138] See also Figure 4 , Figure 4 It is a schematic diagram of a vector tile style conversion method shown in an exemplary embodiment.

[0139] If you need to render mapbox GL style vector tile data in the maptalks framework, you can convert mapboxGL style vector tile data to maptalks style.

[0140] Specifically, first obtain the vector tile data of the mapbox GL style to be converted and rendered;

[0141] Vector tile data is usually organized in layers. When converting the style of vector tile data, you can convert the style of vector tiles based on the layer.

[0142] It can identify the layer type of each layer contained in the vector tile data, convert the layer style of each layer from the mapbox GL style to the corresponding maptalks vector rendering plug-in, and convert the style of the parameter key-value pairs in the layer and the style of the expression of the parameter value to the maptalks style according to their corresponding conversion rules to ensure that their content and meaning remain unchanged.

[0143] The sprite image referenced in the vector tile data is intercepted by the parameters in the index file, and converted into base64 format encoding, and the mapbox GL style image reference is converted into a maptalks style image file.

[0144] After the above conversion is completed, you can get the maptalks style vector tiles;

[0145] The obtained maptalks-style vector tile is rendered using the maptalks framework, and the content of the vector tile can be displayed on the map.

[0146] See also Figure 5 , Figure 5 It is a hardware structure diagram of an electronic device in which a vector tile style conversion device is located, which is shown as an illustrative embodiment. At the hardware level, the device includes a processor 502, an internal bus 504, a network interface 506, a memory 508, and a non-volatile memory 510, and of course may also include hardware required for other services. One or more embodiments of this specification can be implemented based on software, such as the processor 502 reading the corresponding computer program from the non-volatile memory 510 into the memory 508 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0147] See also Figure 6 , Figure 6 It is a block diagram of a vector tile style conversion device shown in an exemplary embodiment.

[0148] The above-mentioned vector tile style conversion device may include:

[0149] The receiving unit 610 is used to obtain vector tile data to be converted, wherein the vector tile data includes vector tile data in a mapboxGL style;

[0150] An acquisition unit 620 is used to analyze the layers contained in the acquired vector tile data and acquire the layer type of each layer;

[0151] The output unit 630 is used to convert the layer included in the vector tile data into a maptalks style layer based on the conversion rule corresponding to the layer type, so as to obtain the converted maptalks style vector tile data.

[0152] In one embodiment, converting the layer included in the vector tile data into a maptalks style layer based on the conversion rule corresponding to the layer type includes:

[0153] The style of the statement corresponding to the layer contained in the vector tile data is converted into a maptalks style.

[0154] In one embodiment, converting the style of the statement corresponding to the layer contained in the vector tile data into a maptalks style includes:

[0155] Convert the parameter key-value pairs in the statement to MapTalks style;

[0156] Convert the style of the parameter value expression in the statement to the MapTalks style;

[0157] Break the sprite image referenced in the statement into individual images.

[0158] In one embodiment, decomposing the Sprite image referenced in the statement into individual images includes:

[0159] Extract the image file and index file of the Sprite image referenced in the statement;

[0160] Based on the parameters in the index file, extract a single picture from the picture file;

[0161] Convert the captured single image into a single image in base64 format.

[0162] In one embodiment, converting the style of the parameter key-value pairs in the statement into a maptalks style includes:

[0163] Convert the style of the parameter key-value pairs describing the layer attributes in the statement to the maptalks style.

[0164] Converts the style of the parameter key-value pairs of the graphics parameters describing the graphics properties in the statement to the MapTalks style.

[0165] In one embodiment, the layer type of the layer includes one or more of the following:

[0166] Area layer, line layer, point layer, circle layer.

[0167] In one embodiment, the apparatus further comprises a rendering device 640, configured to:

[0168] The converted vector tile data is rendered using the maptalks framework.

[0169] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0170] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the objectives of the scheme of this specification. Ordinary technicians in this field can understand and implement it without paying creative work.

[0171] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.

[0172] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0173] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0174] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0175] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, furniture or equipment that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, furniture or equipment. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, furniture or equipment that includes the elements.

[0176] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0177] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "one", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0178] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0179] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.

Claims

1. A method for converting vector tile styles. It is characterized in that The method comprises: Obtain vector tile data to be converted, wherein the vector tile data includes vector tile data in a mapbox GL style; Analyze the layers contained in the acquired vector tile data, and obtain the layer type of each layer; Based on the conversion rule corresponding to the layer type, the layer contained in the vector tile data is converted into a maptalks style layer to obtain the converted maptalks style vector tile data.

2. The method according to claim 1, It is characterized in that The converting the layer contained in the vector tile data into a maptalks style layer based on the conversion rule corresponding to the layer type includes: The style of the statement corresponding to the layer contained in the vector tile data is converted into a maptalks style.

3. The method according to claim 2, It is characterized in that The converting the style of the statement corresponding to the layer contained in the vector tile data into the maptalks style includes: Convert the parameter key-value pairs in the statement to MapTalks style; Convert the style of the parameter value expression in the statement to the MapTalks style; Break the sprite image referenced in the statement into individual images.

4. The method according to claim 3, It is characterized in that Decomposing the Sprite image referenced in the statement into individual images includes: Extract the image file and index file of the Sprite image referenced in the statement; Based on the parameters in the index file, extract a single picture from the picture file; Convert the captured single image into a single image in base64 format.

5. The method according to claim 3, It is characterized in that The method of converting the style of the parameter key-value pairs in the statement into the maptalks style includes: Convert the style of the parameter key-value pairs describing the layer attributes in the statement to the maptalks style. Converts the style of the parameter key-value pairs of the graphics parameters describing the graphics properties in the statement to the MapTalks style.

6. The method according to claim 1, It is characterized in that The layer type of the layer, including one or more of the following: Area layer, line layer, point layer, circle layer.

7. The method according to claim 1, It is characterized in that The method further comprises: The converted vector tile data is rendered using the maptalks framework.

8. A vector tile style conversion device, It is characterized in that The device comprises: A receiving unit, used to obtain vector tile data to be converted, wherein the vector tile data includes vector tile data in a mapbox GL style; An acquisition unit, used for analyzing the layers contained in the acquired vector tile data, and acquiring the layer type of each layer; The output unit is used to convert the layer contained in the vector tile data into a maptalks style layer based on the conversion rule corresponding to the layer type, so as to obtain the converted maptalks style vector tile data.

9. A storage medium, It is characterized in that A computer program is stored thereon, and when the computer program is executed, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer device, It is characterized in that The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 7 is implemented.