Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 1.77 KB

mapcss.md

File metadata and controls

36 lines (22 loc) · 1.77 KB

Understanding mapcss

MapCss is used to specify which elements should be rendered, when and how.

Table of content

Ideas

UtyMap does not follow current OSM's MapCss format in all details. Instead, it adapts the format by introducing new declarations, e.g.:

  • builders - comma separated list of builder names. Builder is essential concept in UtyMap implemented inside native library. In general, builder is responsible for building mesh using raw map data. By default, UtyMap provides various buit-in builders to generate world. However, application is not limited by built-in builders, it is possible to use custom ones. For details, please refer to builder specific sections.
  • color - color represented by color or gradient string.

So, there is no strict schema for declarations: you can use custom names for your builders or treat existing ones differently.

Runtime processing

When UtyMap processes element, it goes through all MapCss rules in the order they are defined (similar to CSS). So, definition order is important as the same declarations are overridden. Then, it looks for builder declaration and invokes corresponding builder.

Please note, that mapcss is used for data import and rendering.

Tag evaluation

Utymap supports tag evaluation by eval keyword:

height: eval("tag('building:levels') * 3.2");
height: eval("tag('height') - tag('roof:height')");
roof-color: eval("tag('building:color')");

This is quite useful if actual property value (e.g. height) depends on element's tag values. It allows to avoid enormous conditional statements in source code. Please note, that syntax is quite limited so far.