Skip to content

Commit 205d8a7

Browse files
committed
[wip] add some structure to layer_styles (temporary)
1 parent d12581a commit 205d8a7

2 files changed

Lines changed: 29 additions & 8 deletions

File tree

json_schema/geopackage_layers.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,17 @@ def validate(gpkg_path):
1212
# data = fiona.listlayers(gpkg_path)
1313
gpkg = gpt.read_file(gpkg_path)
1414

15+
# print("\nGeoPackage layers/columns:")
16+
# for name,table in gpkg.layers:
17+
# print(name)
18+
# print(table.columns)
19+
# print()
20+
1521
# This is a workaround during devel, until I understand how to tell jsonschema about the DataFrames
16-
data = {ln:ln for ln in gpkg.list()}
22+
data = {ln:{} for ln in gpkg.list()}
23+
data['layer_styles']['geometry'] = list(gpkg['layer_styles']['geometry'].values)
24+
data['layer_styles']['geometry'] = []
25+
# print(data)
1726

1827
import jsonschema
1928
res = jsonschema.validate(data, schema)

json_schema/geopackage_layers.schema.json

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@
99
"type": "object",
1010

1111
"properties": {
12-
"layer_styles" : { "type" : "string" },
13-
"geologic_units" : { "type" : "string" },
14-
"linear_features" : { "type" : "string" },
15-
"surface_features" : { "type" : "string" },
16-
"geologic_contacts" : { "type" : "string" }
12+
"layer_styles" : {
13+
"type" : "object",
14+
"properties" : {
15+
"geometry" : {
16+
"type" : "array"
17+
}
18+
},
19+
"required" : [
20+
"geometry"
21+
],
22+
"additionalProperties": true
23+
},
24+
"geologic_units" : { "type" : "object" },
25+
"linear_features" : { "type" : "object" },
26+
"surface_features" : { "type" : "object" },
27+
"geologic_contacts" : { "type" : "object" }
1728
},
1829

1930
"required" : [
@@ -25,8 +36,9 @@
2536
],
2637

2738
"patternProperties" : {
28-
"^[A-Za-z][A-Za-z0-9_]*$" : { "type" : "string" }
39+
"^[A-Za-z][A-Za-z0-9_]*$" : { "type" : "object" }
2940
},
3041

31-
"additionalProperties" : { "type" : "string" }
42+
"additionalProperties" : { "type" : "object" }
43+
3244
}

0 commit comments

Comments
 (0)