Beta build 151 -- "style" formula changes

We’ve just pushed beta build 151, which tweaks formula auto-completion behaviour on Mac and also brings some changes to an advanced use case of “style” formulas:

The “style” formulas let you adjust how the locations of your collection are displayed on the map – including having multiple map representations for a single location by using a list/array.

The styles now handle nil values gracefully (rather than returning errors) – which is useful when dealing with collections that use different data formats for different locations. You can then provide a style for each of those formats, and the map will display the style for which the location returns something other than nil.

As an example, let’s say you visualise data from a GeoJSON API that returns points (i.e., GeoJSON Position features) and some of them have an additional GeoJSON point in the properties under the field destination and you want to display those as lines from to the destination and with a circle around the destination, and others with just a circle around their location. You can do that with a “style” formula as follows:

	fixedCircle(200, geometryValue("destination?"))
	LineString(geometryValue("destination?"), coordinate)

There are a few things notable about this:

  1. geometryValue("destination?") returns nil if the property destination does not exist, and if it exists, it parses it as a GeoJSON geometry (i.e., a Position in the example).
  2. fixedCircle(..., center) will draw a circle of 200m radius around the destination if that returned non-nil and around the location if it returned nil.
  3. LineString(..., coordinate) will draw a line from that destination to the coordinate of the location, if that destination returned non-nil and will draw nothing if it did return nil.
  4. The circles are coloured with a red fill and the lines with a yellow stroke, which no longer requires wrapping them in a Style(...).

Quite an advanced use, but good to be aware of in case you need it.

Full change log is below.


  • Formulas: Allow calling .fill/.stroke/.cluster directly on a geometry
  • Formulas: Added pin(..., center), circle(..., center) and fixedCircle(..., center) variants that allow specifying a different center location rather than the one from the location.


  • Views: When using a list for the styles and some of them evaluate to nil, those are now ignored rather than being treated like an error.
  • Formulas: geometryValue is now nil-friendly, i.e., when using a JSON path that has a question mark in it. geometryValue will then return nil rather than an error.
  • Formulas: LineString(...), Polygon(...) and Position/2 are all friendly to nil values in the parameter list. If any parameter value is nil, these will now return nil rather than returning an error.
  • Formulas: LineString(...) and Polygon(...) can take a mix of positions and geometries


  • Fixed auto-completion pop-over on Mac showing when moving cursor around. Now it’ll just show after typing non-whitespace or pressing Esc.
  • Auto-completion pop-over now includes exact match, for quick access to documentation by pressing Escape
  • Fix auto-completion in partial formulas that use a ??
  • Fixes a crash when typing function(value)() in the formula editor
  • Fixes handling of viewing the formula of a preset and pressing “Done” without editing it
  • Style tweak for the “empty state” view on iPhone