Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Data-Driven Symbology Parameters in Mapnik

List of Parameters in Carto that can accept a data field instead of an absolute value, as of Tilemill 0.10.0:

  • marker-width
  • marker-height
  • shield-name
  • text-name
  • text-orientation
  • building-height
  • marker-transform
  • point-transform

Source syntax, derived from the current Mapnik JSON reference guide:

  "width": {
                 "css": "marker-width",
                 "default-value": 10,
                 "doc": "The height of the marker, if using one of the default types.",
                 "type": "expression"
             },
 
 "height": {
                 "css": "marker-height",
                 "default-value": 10,
                 "doc": "The height of the marker, if using one of the default types.",
                 "type": "expression"
             },
 
 "name": {
                 "css": "shield-name",
                 "type": "expression",
                 "required": true,
                 "serialization": "content",
                 "doc": "Value to use for a shield\"s text label. Data columns are specified  using brackets like [column_name]"
             },
 
  "name": {
                 "css": "text-name",
                 "type": "expression",
                 "required": true,
                 "default-value": "",
                 "serialization": "content",
                 "doc": "Value to use for a text label. Data columns are specified using brackets like [column_name]"
             },
 
  "orientation": {
                 "css": "text-orientation",
                 "type": "expression",
                 "doc": "Rotate the text."
             },
 
  "height": {
                 "css": "building-height",
                 "doc": "The height of the building in pixels.",
                 "type": "expression",
                 "default-value": "0"
             }
 
  "transform": {
                 "css": "marker-transform",
                 "type": "functions",
                 "functions": [
                     ["matrix", 6],
                     ["translate", 2],
                     ["scale", 2],
                     ["rotate", 3],
                     ["skewX", 1],
                     ["skewY", 1]
                 ],
                 "default-value": "",
                 "default-meaning": "No transformation",
                 "doc": "SVG transformation definition"
             },
 
 "transform": {
                 "css": "point-transform",
                 "type": "functions",
                 "functions": [
                     ["matrix", 6],
                     ["translate", 2],
                     ["scale", 2],
                     ["rotate", 3],
                     ["skewX", 1],
                     ["skewY", 1]
                 ],
                 "default-value": "",
                 "default-meaning": "No transformation",
                 "doc": "SVG transformation definition"
             },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment