Mapbox vector datasets

From Maria GDK Wiki
Revision as of 11:21, 5 July 2022 by Mbu (talk | contribs)
Jump to navigation Jump to search

From version 4.3

Maria Map Maker supports the Mapbox vector tiles format, as well as a subset of the Mapbox JSON style specification. This article explains the process of importing and styling vector data with these formats.

Import

Format

Zoomlevels.jpeg

When Maria Map Maker imports vector data, it is translated to Mapbox vector tiles (.mbtiles). This is a very high-performant format, but the translation process requires some tuning and know-how to get the desired result.

The MBTiles format splits the vector data into tiles and zoom levels. Each tile contains 4096 x 4096 nodes, which are roughly equivalent to a pixel in a raster image. When vector data is converted to MBTiles, all vertices are snapped to the nearest node in a tile, losing some precision in the process.

Each tile belongs to a zoom level. Zoom level 0 is a single tile which covers the entire Earth (in Web Mercator projection). With every increasing zoom level, each tile is divided into four. As an example, zoom level 15 roughly equals map scale 1:15 000 at the equator. At this level, the entire Earth consists of around one billion tiles.

When importing vector data to MBTiles, you need to decide which zoom levels (z) to create. This zoom extent is not possible to change later. The vector data simply does not exist on the levels outside the zoom extent you choose. This means that you have to be familiar with your source data and how they are going to be used. Using zoom levels which are not appropriate for the source data can have some negative effects:

Using too low zoom level - too much data is stored in each tile, which would lead to poor performance. To prevent this, after a tile reaches a threshold of 500 KB or 200 000 features, additional features destined for that tile will either be simplified or dropped. Using too high zoom level - large, simple features are split across an exaggerated number of small tiles, which leads to unnecessary large files and long processing time.

Import dialog

The vector data import dialog lists all the layers in the source dataset, with a zoom selector for each. The checkboxes controls wether or not the layer is included in the resulting MBTiles dataset. You can use the top "All layers" control to set a common data range.

You can choose the style format for the output dataset - , or the Mapbox JSON format described in this article, or the legacy MARIA GDK XML format. The MARIA GDK style will be phased out starting with MARIA GDK version 4.3.

M3 vectorimport mbtiles.PNG

Style layers

Style layers are listed by expanding the dataset in a basemap/overlay. The list has several functions:

  • Drag-drop layers to change the drawing order (the top layer in the list will be drawn on top in the map).
  • Show or hide layers with the checkbox.
  • Single-click a layer twice (slow double-click) to change its name

Create new layer

To create a new layer, simply right-click anywhere in the Style layers list, and then select the layer type from the "New layer" submenu. A new layer will be created at that position. Finally, go to the "Data" tab to select a Source layer.

Style tab

Styles are configured by double-clicking a layer and selecting the "Style" tab. Style properties are documented by mousing over the property name. The style properties vary by the type of layer:

Fill

A fill style layer renders one or more filled (and optionally stroked) polygons on a map.

Line

A line style layer renders one or more stroked polylines on the map.

Symbol

A symbol style layer renders icon and text labels at points or along lines on a map.

Background

A layer which covers the entire dataset. Useful if your dataset is not "HELDEKKENDE" and you don't want other datasets to show through.

Label

A text label can be configured on any type of layer. Click the "Label" tab and select an attribute for the "Text field" property to activate the label. You can then configure the appearance of the label with various properties.

M3 vectorstyle label.PNG

Data

The Data tab contains settings related to the data grunnlag of the style layer.

Source layer

Source layers are the named layers in the MBTiles data file. A style layer must always reference a source layer (except for the background layer). The source layer type is indicated with an icon in the list (either Line, Fill, or Symbol).

Layer type

Layer type for this Style layer. This does not have to match the type of source layer it is referencing. By using a different type, you get some additional style options:

Source layer type Style layer type Result
Polygon Line Outline of polygons are drawn
Polygon Symbol Text labels or icons are drawn within the polygon
Line Symbol Text labels or icons are drawn along the line