Creating styles for vector tiles

I+D+i, Mapas, Web, 0 comments



In a previous post, we talked about vector tiles and their advantages in comparison to traditional raster tiles, what have converted them in a high projection technology, more and more used in the implementation of map services. In this post, we want to focus on one of the main characteristics of vector tiles: styles creation. This possibility is a clear advantage of this kind of tiles as it allows map customization, but at the same time, increases complexity in the development of applications.

Different from raster tiles, where visualization style is determined in the server side, in the case of vector tiles, data visualization is performed in the client side (mobile or desktop app, or Internet browser), what offers app developers total flexibility when they create map styles. The main problem these developers have to face comes then from the visualization library they use, where styles configuration can be more or less complex depending on the selected option. Therefore, it would be interesting to have a standard mechanism that facilitates styles definition in vector tiles, generally accepted by all visualization libraries, similar to the case of the Styled Layer Descriptor (SLD) specification with the different frameworks for publishing of geographic information by means of standard web services (GeoServer, Deegree, Mapserver, etc).

Mapbox, nowadays the main supplier of web map services based on vector tiles and one of the companies that is strongly backing up this technology, is conscious of this problem and has developed an open specification for the creation of styles definition documents in JSON format. This specification, named Mapbox Style Specification, describes the structure required for these documents, indicating, among other aspects, map server’s URLs, layers to be painted, ways of painting (colours, icons, line thickness, etc.), criteria to select contents to be painted (maximum and minimum scales, filters in function of attributes of the geographic entities, etc.). That is a very powerful specification, with a wide range of configuration possibilities, what would make it difficult to use by non-expert developers.

To facilitate the creation of documents according to Mapbox specification, there is an Open Source project, Maputnik, that provides a graphic editor to define vector tiles styles. This editor, that can be used online or installed in a computer, allows the creation of new map services and the edition of the specific configuration of each of its layers. When edition is finished, outcomes can be exported in JSON format.

















The main problem Maputnik shows is that it needs a map service with XYZ interface as data source. Therefore, if the map service we want to use offers only WMTS or TMS interface, we cannot use it directly as data source of Maputnik. It would be necessary, for instance, to implement a proxy that transforms requests from one interface to another.

Once we have created the JSON file with styles, it can be directly used to configure a viewer built with Mapbox GL JS. Although other libraries don´t offer this possibility , there are already some plugins to upload Mapbox styles in Openlayers and Leaflet. They are expected to evolve to offer proper support to this functionality so demanded among developers.

As it is showed with the examples described before, vector tiles are already an increasingly accepted reality. That is why new technical and technological solutions to improve their performance and facilitate their implementation are emerging constantly.


Add new comment

Related Articles