@urban-toolkit/autk-grammar 4.3.0 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -76,8 +76,9 @@ Besides `dataRef`, a layer of `map.layerRefs` takes these styling options:
76
76
  | `stroke` | A polygon layer's outline: its color, `#rrggbb`, or `false` for none. |
77
77
  | `width` | The width of a polylines or roads layer's lines, in the map's planar units (autk-map's `polylinesWidth`). |
78
78
  | `colorMapInterpolator` | The color scheme. A raster layer's cells and its legend's labels follow it. |
79
- | `colorMapCenter` | On a raster layer, the value at the middle of the color scale. The scale then runs from the center less the farthest value's distance to it, to the center plus that distance. |
80
- | `colorMapReverse` | On a raster layer, runs the color scale from the highest value to the lowest. |
79
+ | `colorMapRange` | The ends of the color scale, `[low, high]` with low less than high. The layer is colored over this range instead of its own lowest and highest values, so layers that set the same range, in one map or in maps side by side, color the same value alike. Raster and vector layers. A categorical scheme ignores it, and a layer cannot set both `colorMapRange` and `colorMapDomain`. On a raster layer, a `transferFunction` still sets opacity from the layer's own values. |
80
+ | `colorMapCenter` | On a raster layer, the value at the middle of the color scale. With `colorMapRange`, the scale runs from the range's low through the center to its high (a sequential scheme keeps only the ends). Without it, the scale runs from the center less the farthest value's distance to it, to the center plus that distance. |
81
+ | `colorMapReverse` | On a raster layer, runs the color scale from the highest value to the lowest, or from `colorMapRange`'s high to its low. |
81
82
  | `transferFunction` | On a raster layer, how opaque its cells are by value: autk-map's transfer function (`mode`, `opacityMin`, `opacityMax`, `gamma`, `zeroCenter`). `{ opacityMin: 1, opacityMax: 1 }` draws every cell with a value fully opaque. |
82
83
 
83
84
  After a run, `grammar.mapLayer(dataRef)` finds the layer a map draws for a table: the `AutkMap` and the layer's id in it. `highlightOnMap`, `clearHighlightOnMap` and a plot's `mapRef` also name a layer by its `dataRef`.
@@ -1278,6 +1278,11 @@
1278
1278
  },
1279
1279
  "MapLayerSpec": {
1280
1280
  "description": "One layer drawn by a map.",
1281
+ "if": {
1282
+ "required": [
1283
+ "colorMapRange"
1284
+ ]
1285
+ },
1281
1286
  "properties": {
1282
1287
  "catchAllCategory": {
1283
1288
  "type": "string"
@@ -1287,11 +1292,11 @@
1287
1292
  "description": "Color of the layer, as `#rrggbb`. A layer with a color is drawn in it rather than by its `getFnv` value, unless `isColorMap` is `true`. Raster layers are always colored by value. Read by the Autark adapter; the deck.gl adapter ignores it."
1288
1293
  },
1289
1294
  "colorMapCenter": {
1290
- "description": "Value at the middle of a raster layer's color scale: the scale runs from this value less the farthest value's distance to it, to this value plus that distance, so a diverging scheme's middle color marks it. Read by the Autark adapter for raster layers; other layers and the deck.gl adapter ignore it.",
1295
+ "description": "Value at the middle of a raster layer's color scale, so a diverging scheme's middle color marks it. With `colorMapRange`, the scale runs from the range's low through this value to its high (a sequential scheme keeps only the ends); without it, from this value less the farthest value's distance to it, to this value plus that distance. Read by the Autark adapter for raster layers; other layers and the deck.gl adapter ignore it.",
1291
1296
  "type": "number"
1292
1297
  },
1293
1298
  "colorMapDomain": {
1294
- "description": "Allowed category values; anything else is drawn as the catch-all category. Only used when `getFnvType` is `categorical`.",
1299
+ "description": "Allowed category values; anything else is drawn as the catch-all category. Only used when `getFnvType` is `categorical`. Not with `colorMapRange`.",
1295
1300
  "items": {
1296
1301
  "type": "string"
1297
1302
  },
@@ -1308,8 +1313,25 @@
1308
1313
  },
1309
1314
  "type": "array"
1310
1315
  },
1316
+ "colorMapRange": {
1317
+ "description": "Ends of the layer's color scale, as `[low, high]` with low less than high. The layer is colored over this range instead of its own lowest and highest values, so layers that set the same range color the same value alike, in one map or in maps side by side. On a raster layer, `colorMapCenter` and `colorMapReverse` apply within it, and a `transferFunction` still sets opacity from the layer's own values. A categorical scheme ignores it, and it cannot be set with `colorMapDomain`. Read by the Autark adapter for raster and vector layers; the deck.gl adapter ignores it.",
1318
+ "items": [
1319
+ {
1320
+ "title": "low",
1321
+ "type": "number"
1322
+ },
1323
+ {
1324
+ "title": "high",
1325
+ "type": "number"
1326
+ }
1327
+ ],
1328
+ "maxItems": 2,
1329
+ "minItems": 2,
1330
+ "type": "array",
1331
+ "uniqueItems": true
1332
+ },
1311
1333
  "colorMapReverse": {
1312
- "description": "Run a raster layer's color scale from its highest value to its lowest, so the scheme's first color marks the highest value. Read by the Autark adapter for raster layers; other layers and the deck.gl adapter ignore it.",
1334
+ "description": "Run a raster layer's color scale from its highest value to its lowest, so the scheme's first color marks the highest value; with `colorMapRange`, from the range's high to its low. Read by the Autark adapter for raster layers; other layers and the deck.gl adapter ignore it.",
1313
1335
  "type": "boolean"
1314
1336
  },
1315
1337
  "dataRef": {
@@ -1414,6 +1436,13 @@
1414
1436
  "required": [
1415
1437
  "dataRef"
1416
1438
  ],
1439
+ "then": {
1440
+ "not": {
1441
+ "required": [
1442
+ "colorMapDomain"
1443
+ ]
1444
+ }
1445
+ },
1417
1446
  "type": "object"
1418
1447
  },
1419
1448
  "MapSpec": {