pnorman / bolder

A new open client-side style for OpenStreetMap data
Other
16 stars 2 forks source link

Client-side rendering engine #4

Closed pnorman closed 6 years ago

pnorman commented 7 years ago

The four maintained browser-based client-side renderers are

VectorGrid and VectorTile both are styled by writing Javascript. There is work to allow VectorGrid to read Mapbox GL JSON, but it's not yet done. Javascript is not a style language, and we want one when dealing with something as complex as a basemap.

This leaves Tangram from Mapzen and Mapbox GL JS. They are similar in many ways:

The big differences I've found are the styling languages, company practices, and multi-lingual names.

Styling languages

Mapbox GL JS is styled with Mapbox GL JSON, a well documented language. Because there aren't typically linebreaks in it, the merge conflicts of SQL in JSON won't occur here but it has no facility for comments. This means we'd need to do something like a yaml2json step that osm-carto used to have.

Mapbox GL JSON has no inheritance, unlike Carto*CSS. This makes writing styles very verbose. It is also designed to primarily be edited with a closed-source SaaS editor, and not by hand. This is a problem for a complex multi-contributor style.

Tangram is styled with Tangram scene files, which are YAML. The documentation is reasonable, although the language is more rapidly evolving than Mapbox GL JSON. There is inheritance - or at least it doesn't feel like I have to duplicate everything many times like with Mapbox GL JSON.

Having written both, I find Tangram scene files a lot more fun to write. We know from the old Mapnik XML stylesheets that having a language that people like is a huge part of attracting contributors.

Non-latin language support

Neither Mapbox GL JS nor Tangram fully support placing a label of any language on a curve, but for different reasons. Mapbox GL uses a custom glyph placement engine, and only supports some languages. Other languages cannot be labelled at all. Tangram uses the browser's placement, but doesn't handle curving the labels for all languages. This is under work (tangrams/tangram#555) and most common languages are supported.

I see Tangram supporting all used languages before Mapbox GL JS.

Other factors are

pnorman commented 7 years ago

I am strongly inclined towards Tangram, primarily because the styling language is better suited to multiple-editor projects with code review.

pnorman commented 6 years ago

Going with tangram, mainly due to the language advantage, and the many closed-source parts needed to have a reasonable editing experience with Mapbox GL JSON.