@urban-toolkit/autk-grammar 5.0.0 → 5.1.0

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.
@@ -101,6 +101,10 @@
101
101
  "const": "bar",
102
102
  "type": "string"
103
103
  },
104
+ "osmElements": {
105
+ "description": "Plot an OpenStreetMap layer table as one row per OSM element it was built from, each with the element's tags, `osm_type` and `osm_id` (and `building_id` in a buildings table), rather than one row per table row. A table that is not an OSM layer, a surface, and an OSM table an update changed are plotted row by row, as without it. Read by the Autark adapter only.",
106
+ "type": "boolean"
107
+ },
104
108
  "selectFields": {
105
109
  "description": "Columns whose values name the rows a selection in this plot selects, so an app can link the selection to other tables that hold those columns. Neither adapter reads it: the Autark adapter's `plot:selection` events still report feature ids.",
106
110
  "items": {
@@ -163,8 +167,8 @@
163
167
  "type": "number"
164
168
  },
165
169
  "pitch": {
166
- "description": "Tilt from straight down, in degrees.",
167
- "maximum": 90,
170
+ "description": "Tilt from straight down, in degrees, less than 90: at 90 the eye would sit on the ground, edge-on to the map's flat layers, and the map could not pan.",
171
+ "exclusiveMaximum": 90,
168
172
  "minimum": 0,
169
173
  "type": "number"
170
174
  },
@@ -440,6 +444,45 @@
440
444
  "then": {
441
445
  "$ref": "#/definitions/JoinSourceSpec"
442
446
  }
447
+ },
448
+ {
449
+ "if": {
450
+ "properties": {
451
+ "type": {
452
+ "const": "sql",
453
+ "type": "string"
454
+ }
455
+ }
456
+ },
457
+ "then": {
458
+ "$ref": "#/definitions/SqlSourceSpec"
459
+ }
460
+ },
461
+ {
462
+ "if": {
463
+ "properties": {
464
+ "type": {
465
+ "const": "update",
466
+ "type": "string"
467
+ }
468
+ }
469
+ },
470
+ "then": {
471
+ "$ref": "#/definitions/UpdateSourceSpec"
472
+ }
473
+ },
474
+ {
475
+ "if": {
476
+ "properties": {
477
+ "type": {
478
+ "const": "drop",
479
+ "type": "string"
480
+ }
481
+ }
482
+ },
483
+ "then": {
484
+ "$ref": "#/definitions/DropSourceSpec"
485
+ }
443
486
  }
444
487
  ],
445
488
  "description": "One entry of `data`. The `type` field selects which fields apply.",
@@ -452,7 +495,10 @@
452
495
  "geojson",
453
496
  "geotiff",
454
497
  "heatmap",
455
- "join"
498
+ "join",
499
+ "sql",
500
+ "update",
501
+ "drop"
456
502
  ]
457
503
  }
458
504
  },
@@ -461,6 +507,28 @@
461
507
  ],
462
508
  "type": "object"
463
509
  },
510
+ "DropSourceSpec": {
511
+ "description": "Drops a table, so the sources, compute passes, maps and plots after it no longer find it, and `AutkGrammar.data` no longer lists it. Read by the Autark adapter only.",
512
+ "properties": {
513
+ "dataRef": {
514
+ "description": "The table to drop.",
515
+ "type": "string"
516
+ },
517
+ "type": {
518
+ "const": "drop",
519
+ "type": "string"
520
+ },
521
+ "workspace": {
522
+ "$ref": "#/definitions/WorkspaceName",
523
+ "description": "Workspace of the table."
524
+ }
525
+ },
526
+ "required": [
527
+ "type",
528
+ "dataRef"
529
+ ],
530
+ "type": "object"
531
+ },
464
532
  "FromFeatureDirective": {
465
533
  "description": "Reads a uniform's value from a feature of a loaded table instead of writing it inline.",
466
534
  "properties": {
@@ -991,6 +1059,10 @@
991
1059
  },
992
1060
  "column": {
993
1061
  "type": "string"
1062
+ },
1063
+ "normalize": {
1064
+ "description": "Rescale the band's values from 0 to 1 across the grid's cells. It needs an autk-db with urban-toolkit/autark#132, which also adds `_norm` to the band's label; autk-db 4.1.1 builds the band from the values as they are.",
1065
+ "type": "boolean"
994
1066
  }
995
1067
  },
996
1068
  "required": [
@@ -1107,6 +1179,10 @@
1107
1179
  "const": "heatmatrix",
1108
1180
  "type": "string"
1109
1181
  },
1182
+ "osmElements": {
1183
+ "description": "Plot an OpenStreetMap layer table as one row per OSM element it was built from, each with the element's tags, `osm_type` and `osm_id` (and `building_id` in a buildings table), rather than one row per table row. A table that is not an OSM layer, a surface, and an OSM table an update changed are plotted row by row, as without it. Read by the Autark adapter only.",
1184
+ "type": "boolean"
1185
+ },
1110
1186
  "selectFields": {
1111
1187
  "description": "Columns whose values name the rows a selection in this plot selects, so an app can link the selection to other tables that hold those columns. Neither adapter reads it: the Autark adapter's `plot:selection` events still report feature ids.",
1112
1188
  "items": {
@@ -1444,6 +1520,10 @@
1444
1520
  ],
1445
1521
  "type": "string"
1446
1522
  },
1523
+ "osmElements": {
1524
+ "description": "Plot an OpenStreetMap layer table as one row per OSM element it was built from, each with the element's tags, `osm_type` and `osm_id` (and `building_id` in a buildings table), rather than one row per table row. A table that is not an OSM layer, a surface, and an OSM table an update changed are plotted row by row, as without it. Read by the Autark adapter only.",
1525
+ "type": "boolean"
1526
+ },
1447
1527
  "selectFields": {
1448
1528
  "description": "Columns whose values name the rows a selection in this plot selects, so an app can link the selection to other tables that hold those columns. Neither adapter reads it: the Autark adapter's `plot:selection` events still report feature ids.",
1449
1529
  "items": {
@@ -1639,6 +1719,10 @@
1639
1719
  "description": "Layer opacity, from 0 to 1.",
1640
1720
  "type": "number"
1641
1721
  },
1722
+ "osmElements": {
1723
+ "description": "Draw an OpenStreetMap layer table as one feature per OSM element it was built from, each with the element's tags, `osm_type` and `osm_id` as its properties (and `building_id` in a buildings table, whose parts are elements of their own), rather than one feature per row. A table that is not an OSM layer, a surface, and an OSM table an update changed are drawn row by row, as without it. Read by the Autark adapter only.",
1724
+ "type": "boolean"
1725
+ },
1642
1726
  "pickedComps": {
1643
1727
  "description": "Feature ids drawn as picked. Read by the deck.gl adapter; the Autark adapter ignores it.",
1644
1728
  "items": {
@@ -1878,10 +1962,19 @@
1878
1962
  },
1879
1963
  "OsmDataSourceSpec": {
1880
1964
  "description": "Loads OpenStreetMap data for a named area or a box, from Overpass or from a PBF extract.",
1965
+ "if": {
1966
+ "required": [
1967
+ "pbfFileUrl"
1968
+ ]
1969
+ },
1881
1970
  "properties": {
1882
1971
  "autoLoadLayers": {
1883
1972
  "description": "Split the raw OSM table into one table per layer, named `<outputTableName>_<layer>`.",
1884
1973
  "properties": {
1974
+ "coordinateFormat": {
1975
+ "description": "CRS of the OpenStreetMap data's coordinates, as an EPSG string. Defaults to `'EPSG:4326'`, the degrees the Overpass API and OpenStreetMap's extracts give. The layers and the tag sets are read in it. Read by the Autark adapter only.",
1976
+ "type": "string"
1977
+ },
1885
1978
  "dropOsmTable": {
1886
1979
  "description": "Currently ignored by both adapters.",
1887
1980
  "type": "boolean"
@@ -1898,6 +1991,10 @@
1898
1991
  ],
1899
1992
  "type": "object"
1900
1993
  },
1994
+ "forceRefresh": {
1995
+ "description": "Query the Overpass API again rather than read the answer the browser cached for this area, its layers and its tag sets, which autk-db keeps for 24 hours. A source with `pbfFileUrl` reads its file each time and ignores it. Read by the Autark adapter only.",
1996
+ "type": "boolean"
1997
+ },
1901
1998
  "outputTableName": {
1902
1999
  "description": "Name of the table this source creates. Later sources, compute passes, maps and plots refer to it by this name.",
1903
2000
  "type": "string"
@@ -1917,6 +2014,14 @@
1917
2014
  ],
1918
2015
  "description": "Area to load: sub-areas inside a geocoded region (`geocodeArea` with `areas`), or a box (`bbox`), not both."
1919
2016
  },
2017
+ "tagSets": {
2018
+ "description": "Features chosen by their tags, each set as a table of its own, `<outputTableName>_<name>_<type>`, cut to the area. A set that matches no feature in the area makes no table. Read from the Overpass API only: a source with `pbfFileUrl` cannot take them. Read by the Autark adapter only.",
2019
+ "items": {
2020
+ "$ref": "#/definitions/OsmTagSet"
2021
+ },
2022
+ "maxItems": 8,
2023
+ "type": "array"
2024
+ },
1920
2025
  "type": {
1921
2026
  "const": "osm",
1922
2027
  "type": "string"
@@ -1931,6 +2036,18 @@
1931
2036
  "queryArea",
1932
2037
  "type"
1933
2038
  ],
2039
+ "then": {
2040
+ "not": {
2041
+ "properties": {
2042
+ "tagSets": {
2043
+ "minItems": 1
2044
+ }
2045
+ },
2046
+ "required": [
2047
+ "tagSets"
2048
+ ]
2049
+ }
2050
+ },
1934
2051
  "type": "object"
1935
2052
  },
1936
2053
  "OsmNamedArea": {
@@ -1958,6 +2075,60 @@
1958
2075
  ],
1959
2076
  "type": "object"
1960
2077
  },
2078
+ "OsmTagFilter": {
2079
+ "description": "An OpenStreetMap tag a tag set matches: the tag `key` with the value `value`, or with any value when `value` is omitted.",
2080
+ "properties": {
2081
+ "key": {
2082
+ "description": "The tag's key, such as `amenity` or `addr:street`: letters, digits, `_`, `:`, `.` and `-`, starting with a letter or a digit.",
2083
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_:.-]{0,254}$",
2084
+ "type": "string"
2085
+ },
2086
+ "value": {
2087
+ "description": "The tag's value, such as `cafe`. Without it, the key with any value matches.",
2088
+ "maxLength": 255,
2089
+ "minLength": 1,
2090
+ "type": "string"
2091
+ }
2092
+ },
2093
+ "required": [
2094
+ "key"
2095
+ ],
2096
+ "type": "object"
2097
+ },
2098
+ "OsmTagSet": {
2099
+ "description": "OpenStreetMap features chosen by their tags, as one table of one geometry type.",
2100
+ "properties": {
2101
+ "name": {
2102
+ "description": "Names the set's table, `<outputTableName>_<name>_<type>`: a lowercase letter, then up to 31 lowercase letters, digits or `_`. No two sets of a source share a name.",
2103
+ "pattern": "^[a-z][a-z0-9_]{0,31}$",
2104
+ "type": "string"
2105
+ },
2106
+ "tags": {
2107
+ "description": "The tags a feature is chosen by: it is in the set when it has any one of them.",
2108
+ "items": {
2109
+ "$ref": "#/definitions/OsmTagFilter"
2110
+ },
2111
+ "maxItems": 64,
2112
+ "minItems": 1,
2113
+ "type": "array"
2114
+ },
2115
+ "type": {
2116
+ "description": "The geometry the table holds: `points`, the tagged nodes; `polylines`, the open ways and the ways tagged as lines (`highway`, `barrier`, `railway`, `waterway`, or `area=no`); `polygons`, the other closed ways and the multipolygon relations.",
2117
+ "enum": [
2118
+ "points",
2119
+ "polylines",
2120
+ "polygons"
2121
+ ],
2122
+ "type": "string"
2123
+ }
2124
+ },
2125
+ "required": [
2126
+ "name",
2127
+ "type",
2128
+ "tags"
2129
+ ],
2130
+ "type": "object"
2131
+ },
1961
2132
  "ParallelCoordinatesPlotSpec": {
1962
2133
  "description": "Parallel coordinates over the plotted columns.",
1963
2134
  "properties": {
@@ -2022,6 +2193,10 @@
2022
2193
  "const": "parallel-coordinates",
2023
2194
  "type": "string"
2024
2195
  },
2196
+ "osmElements": {
2197
+ "description": "Plot an OpenStreetMap layer table as one row per OSM element it was built from, each with the element's tags, `osm_type` and `osm_id` (and `building_id` in a buildings table), rather than one row per table row. A table that is not an OSM layer, a surface, and an OSM table an update changed are plotted row by row, as without it. Read by the Autark adapter only.",
2198
+ "type": "boolean"
2199
+ },
2025
2200
  "selectFields": {
2026
2201
  "description": "Columns whose values name the rows a selection in this plot selects, so an app can link the selection to other tables that hold those columns. Neither adapter reads it: the Autark adapter's `plot:selection` events still report feature ids.",
2027
2202
  "items": {
@@ -2626,6 +2801,10 @@
2626
2801
  "const": "scatter",
2627
2802
  "type": "string"
2628
2803
  },
2804
+ "osmElements": {
2805
+ "description": "Plot an OpenStreetMap layer table as one row per OSM element it was built from, each with the element's tags, `osm_type` and `osm_id` (and `building_id` in a buildings table), rather than one row per table row. A table that is not an OSM layer, a surface, and an OSM table an update changed are plotted row by row, as without it. Read by the Autark adapter only.",
2806
+ "type": "boolean"
2807
+ },
2629
2808
  "selectFields": {
2630
2809
  "description": "Columns whose values name the rows a selection in this plot selects, so an app can link the selection to other tables that hold those columns. Neither adapter reads it: the Autark adapter's `plot:selection` events still report feature ids.",
2631
2810
  "items": {
@@ -2655,6 +2834,38 @@
2655
2834
  ],
2656
2835
  "type": "object"
2657
2836
  },
2837
+ "SqlSourceSpec": {
2838
+ "description": "Saves the rows of a SQL query over the workspace's tables as a new table. Read by the Autark adapter only.",
2839
+ "properties": {
2840
+ "layerType": {
2841
+ "$ref": "#/definitions/LayerType",
2842
+ "description": "How a map draws the new table, whose geometry must then be in a column named `geometry`, in the workspace's CRS, as the workspace's tables hold it. Without it, the table has no layer type: a plot draws its rows, while a map does not draw it and `AutkGrammar.data` does not list it."
2843
+ },
2844
+ "outputTableName": {
2845
+ "description": "Name of the table this source creates. Later sources, compute passes, maps and plots refer to it by this name.",
2846
+ "type": "string"
2847
+ },
2848
+ "query": {
2849
+ "description": "A `SELECT`, or a `WITH` query that ends in one, in DuckDB's SQL, over the tables of the source's workspace by their names. autk-db refuses any other statement, and any query in which `insert`, `update`, `delete`, `create`, `alter`, `drop`, `truncate` or `replace` appears as a word, even inside a string.",
2850
+ "minLength": 1,
2851
+ "type": "string"
2852
+ },
2853
+ "type": {
2854
+ "const": "sql",
2855
+ "type": "string"
2856
+ },
2857
+ "workspace": {
2858
+ "$ref": "#/definitions/WorkspaceName",
2859
+ "description": "Workspace the table is created in."
2860
+ }
2861
+ },
2862
+ "required": [
2863
+ "outputTableName",
2864
+ "query",
2865
+ "type"
2866
+ ],
2867
+ "type": "object"
2868
+ },
2658
2869
  "TablePlotSpec": {
2659
2870
  "description": "A table. A transform, when given, must be `sort`.",
2660
2871
  "properties": {
@@ -2719,6 +2930,10 @@
2719
2930
  "const": "table",
2720
2931
  "type": "string"
2721
2932
  },
2933
+ "osmElements": {
2934
+ "description": "Plot an OpenStreetMap layer table as one row per OSM element it was built from, each with the element's tags, `osm_type` and `osm_id` (and `building_id` in a buildings table), rather than one row per table row. A table that is not an OSM layer, a surface, and an OSM table an update changed are plotted row by row, as without it. Read by the Autark adapter only.",
2935
+ "type": "boolean"
2936
+ },
2722
2937
  "selectFields": {
2723
2938
  "description": "Columns whose values name the rows a selection in this plot selects, so an app can link the selection to other tables that hold those columns. Neither adapter reads it: the Autark adapter's `plot:selection` events still report feature ids.",
2724
2939
  "items": {
@@ -2748,6 +2963,102 @@
2748
2963
  ],
2749
2964
  "type": "object"
2750
2965
  },
2966
+ "UpdateSourceSpec": {
2967
+ "description": "Replaces or changes the rows of a table already loaded, with rows given inline: a FeatureCollection for a table with a geometry, an array of objects for a table without one. Read by the Autark adapter only.",
2968
+ "else": {
2969
+ "if": {
2970
+ "properties": {
2971
+ "strategy": {
2972
+ "const": "update"
2973
+ }
2974
+ },
2975
+ "required": [
2976
+ "strategy"
2977
+ ]
2978
+ },
2979
+ "required": [
2980
+ "jsonObject"
2981
+ ],
2982
+ "then": {
2983
+ "required": [
2984
+ "idColumn"
2985
+ ]
2986
+ }
2987
+ },
2988
+ "if": {
2989
+ "required": [
2990
+ "geojsonObject"
2991
+ ]
2992
+ },
2993
+ "properties": {
2994
+ "dataRef": {
2995
+ "description": "The table to change.",
2996
+ "type": "string"
2997
+ },
2998
+ "geojsonObject": {
2999
+ "$ref": "#/definitions/InlineFeatureCollection",
3000
+ "description": "The rows of a table with a geometry. autk-db stores their coordinates as they come, so they are in the workspace's CRS, as `AutkGrammar.data` gives a table's features."
3001
+ },
3002
+ "idColumn": {
3003
+ "description": "With `update`, the column that matches a given row to the table's rows: a column such as `month`, or a feature property as `properties.<name>`, such as `properties.parcel_id`.",
3004
+ "minLength": 1,
3005
+ "type": "string"
3006
+ },
3007
+ "jsonObject": {
3008
+ "description": "The rows of a table without a geometry, such as a CSV or JSON table loaded without `geometryColumns`.",
3009
+ "items": {
3010
+ "additionalProperties": {},
3011
+ "type": "object"
3012
+ },
3013
+ "minItems": 1,
3014
+ "type": "array"
3015
+ },
3016
+ "strategy": {
3017
+ "description": "`replace` swaps every row of the table for the given rows. `update` changes the rows whose `idColumn` value a given row has: in a table with a geometry, each takes the given row's geometry and properties, and no row is added; in a table without one, the given rows replace them, and those that match no row are added.",
3018
+ "enum": [
3019
+ "replace",
3020
+ "update"
3021
+ ],
3022
+ "type": "string"
3023
+ },
3024
+ "type": {
3025
+ "const": "update",
3026
+ "type": "string"
3027
+ },
3028
+ "workspace": {
3029
+ "$ref": "#/definitions/WorkspaceName",
3030
+ "description": "Workspace of the table."
3031
+ }
3032
+ },
3033
+ "required": [
3034
+ "type",
3035
+ "dataRef",
3036
+ "strategy"
3037
+ ],
3038
+ "then": {
3039
+ "if": {
3040
+ "properties": {
3041
+ "strategy": {
3042
+ "const": "update"
3043
+ }
3044
+ },
3045
+ "required": [
3046
+ "strategy"
3047
+ ]
3048
+ },
3049
+ "not": {
3050
+ "required": [
3051
+ "jsonObject"
3052
+ ]
3053
+ },
3054
+ "then": {
3055
+ "required": [
3056
+ "idColumn"
3057
+ ]
3058
+ }
3059
+ },
3060
+ "type": "object"
3061
+ },
2751
3062
  "UrbanSpec": {
2752
3063
  "description": "An Autark grammar specification. It names at least one of `data`, `compute`, `map` or `plot`.",
2753
3064
  "properties": {
@@ -2807,6 +3118,13 @@
2807
3118
  }
2808
3119
  ],
2809
3120
  "description": "One plot, or several."
3121
+ },
3122
+ "workspaces": {
3123
+ "description": "How workspaces store their tables, one entry per workspace, set before the first source loads. A workspace without an entry keeps autk-db's CRS and grid. Read by the Autark adapter only.",
3124
+ "items": {
3125
+ "$ref": "#/definitions/WorkspaceSpec"
3126
+ },
3127
+ "type": "array"
2810
3128
  }
2811
3129
  },
2812
3130
  "type": "object"
@@ -2831,6 +3149,30 @@
2831
3149
  "description": "Name of a workspace: an isolated set of tables with its own extent. The first source loaded into a workspace sets its extent and later sources are cut to it, so two areas that must not clip each other go in two workspaces. A table is found by its name inside its workspace, so two workspaces may hold tables of the same name. Entries without a workspace use the default one. Read by the Autark adapter only.",
2832
3150
  "minLength": 1,
2833
3151
  "type": "string"
3152
+ },
3153
+ "WorkspaceSpec": {
3154
+ "description": "How a workspace stores its tables: the coordinate system they are kept in, and the grid their coordinates are rounded to. Read by the Autark adapter only.",
3155
+ "properties": {
3156
+ "coordinateFormat": {
3157
+ "description": "CRS the workspace stores its tables in, as an EPSG string such as `'EPSG:3857'`. Each source is transformed to it as it loads, its maps draw in its units, and so are the lengths given in workspace units, such as a join's `near.distance`. autk-db's default is `'EPSG:3395'`, World Mercator, in meters.",
3158
+ "minLength": 1,
3159
+ "type": "string"
3160
+ },
3161
+ "name": {
3162
+ "$ref": "#/definitions/WorkspaceName",
3163
+ "description": "The workspace, by the name sources, compute passes, maps and plots give as their `workspace`. Without it, the default workspace."
3164
+ },
3165
+ "precisionGrid": {
3166
+ "description": "Grid every stored coordinate is rounded to, in the CRS's units. autk-db's default is `0.01`, a centimeter in World Mercator. A geometry the grid collapses is refused as it loads.",
3167
+ "exclusiveMinimum": 0,
3168
+ "type": "number"
3169
+ }
3170
+ },
3171
+ "required": [
3172
+ "coordinateFormat",
3173
+ "precisionGrid"
3174
+ ],
3175
+ "type": "object"
2834
3176
  }
2835
3177
  }
2836
3178
  }