protomaps-experiments

Cartographic Scripting

There are two kinds of scripting:

Prototype

This folder has an example of a tileset scripting design written in the Starlark language, a subset of Python.

The program main.go will execute tileset_definition.star against dummy data. Control which features are assigned to which layers by defining functions in the file:

def roads_filter(z,f):
  if z < 2:
    return f["properties"]["highway"] == "motorway"
  else:
    return f["properties"]["highway"]

Other Designs

Mapbox GL Expressions

osm-bright-gl-style

Client scripting. Functional Lisp-inside-JSON. Must run on a unique environment (GL), not turing-complete; limited to built-in functions, can require preprocessor.

Preprocessors

Tangram Styles

refill-style.yaml

Client scripting. Runs in WebGL. Variables, inline shader code, embeddable JavaScript expressions.

Protomaps JS Rules

(disclaimer: i designed this)

default style.ts

Client scripting. Everything is TypeScript, turing complete, variables and parameterization, runs 100% on CPU.

osm2pgsql configuration files

default.style for osm2pgsql

Declarative, custom textual format for creating PostgreSQL tables. geometrytype-based selection, key wildcards.

imposm3 mappings

example-mapping.yml

Declarative YAML for creating PostgreSQL tables.

osmium-tool configuration

osmium-export docs

Declarative JSON format for Simple Features like GeoJSON from OSM.

HOTOSM Export Tool YAML

(disclaimer: i designed this)

default.yml

Declarative YAML specification for transforming OSM to Simple Features. Can embed subset of SQL inside where expressions for layer definitions:

where:
  - amenity IN ('university','school','library','fuel','hospital','fire_station','police','townhall')

Tilemaker LUA

process-openmaptiles.lua

True tileset scripting. Write Lua functions that are executed against OSM features to define tileset features. Depends on Lua C runtime.

Planetiler CustomMap YAML

power.yml

Declarative YAML for transforming OSM into tileset features.