Skip to content

Commit 04c1a50

Browse files
authored
feat: add carto symbol schema to main (#385)
### Motivation add carto symbol schema to main
1 parent b0b844b commit 04c1a50

3 files changed

Lines changed: 145 additions & 0 deletions

File tree

packages/schema/src/features/main.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import "./landuse_point.tsp";
1818
import "./marine.tsp";
1919
import "./marine_point.tsp";
2020
import "./nztopo50_carto_text.tsp";
21+
import "./nztopo50_carto_symbol.tsp";
2122
import "./nztopo50_coastline_island.tsp";
2223
import "./nztopo50_dms_grid.tsp";
2324
import "./nztopo50_grid.tsp";
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import "@typespec/json-schema";
2+
import "./common.tsp";
3+
4+
using TypeSpec.JsonSchema;
5+
6+
@jsonSchema("nztopo50_carto_symbol")
7+
@extension("additionalProperties", false)
8+
model nztopo50_carto_symbol {
9+
...ProductFeature;
10+
created_at: utcDateTime;
11+
updated_at: utcDateTime;
12+
13+
/**
14+
* id (UUID) of the feature this symbol annotates: the landuse polygon it sits within, or
15+
* the road centreline it labels.
16+
*
17+
* Null where no feature was close enough to match.
18+
*/
19+
source_id: string | null;
20+
21+
type: carto_symbol_type;
22+
label: string | null;
23+
24+
/** Label rotation in degrees clockwise from east. Null for symbols drawn unrotated. */
25+
orientation: int32 | null;
26+
27+
...GeoParquet;
28+
}
29+
30+
enum carto_symbol_type {
31+
ContourNumber: "contour_number",
32+
GolfCourse: "golf_course",
33+
HighwayShield: "highway_shield",
34+
MineOpencast: "mine_opencast",
35+
MineTraining: "mine_training",
36+
MineUnderground: "mine_underground",
37+
}

schema/nztopo50_carto_symbol.json

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "nztopo50_carto_symbol",
4+
"type": "object",
5+
"properties": {
6+
"id": {
7+
"type": "string",
8+
"description": "UUIDv7 of the feature"
9+
},
10+
"t50_fid": {
11+
"anyOf": [
12+
{
13+
"type": "integer",
14+
"minimum": 0,
15+
"maximum": 4294967295
16+
},
17+
{
18+
"type": "null"
19+
}
20+
],
21+
"description": "Reference topo50 feature ID.\n\nWill be null if the feature is new and has not been published in a Topo50 edition."
22+
},
23+
"created_at": {
24+
"type": "string",
25+
"format": "date-time"
26+
},
27+
"updated_at": {
28+
"type": "string",
29+
"format": "date-time"
30+
},
31+
"source_id": {
32+
"anyOf": [
33+
{
34+
"type": "string"
35+
},
36+
{
37+
"type": "null"
38+
}
39+
],
40+
"description": "id (UUID) of the feature this symbol annotates: the landuse polygon it sits within, or\nthe road centreline it labels.\n\nNull where no feature was close enough to match."
41+
},
42+
"type": {
43+
"$ref": "#/$defs/carto_symbol_type"
44+
},
45+
"label": {
46+
"anyOf": [
47+
{
48+
"type": "string"
49+
},
50+
{
51+
"type": "null"
52+
}
53+
]
54+
},
55+
"orientation": {
56+
"anyOf": [
57+
{
58+
"type": "integer",
59+
"minimum": -2147483648,
60+
"maximum": 2147483647
61+
},
62+
{
63+
"type": "null"
64+
}
65+
],
66+
"description": "Label rotation in degrees clockwise from east. Null for symbols drawn unrotated."
67+
},
68+
"geometry": {
69+
"description": "GeoParquet 1.1 covering geometry struct.",
70+
"not": {
71+
"type": "null"
72+
}
73+
},
74+
"bbox": {
75+
"$ref": "#/$defs/BBox",
76+
"description": "GeoParquet 1.1 covering bbox struct."
77+
}
78+
},
79+
"required": ["id", "t50_fid", "created_at", "updated_at", "source_id", "type", "label", "orientation", "geometry"],
80+
"additionalProperties": false,
81+
"$defs": {
82+
"carto_symbol_type": {
83+
"type": "string",
84+
"enum": ["contour_number", "golf_course", "highway_shield", "mine_opencast", "mine_training", "mine_underground"]
85+
},
86+
"BBox": {
87+
"type": "object",
88+
"properties": {
89+
"xmin": {
90+
"type": "number"
91+
},
92+
"ymin": {
93+
"type": "number"
94+
},
95+
"xmax": {
96+
"type": "number"
97+
},
98+
"ymax": {
99+
"type": "number"
100+
}
101+
},
102+
"required": ["xmin", "ymin", "xmax", "ymax"],
103+
"description": "GeoParquet 1.1 covering bbox struct.",
104+
"additionalProperties": false
105+
}
106+
}
107+
}

0 commit comments

Comments
 (0)