Skip to content

Commit e62df4a

Browse files
committed
Add docs and json definitions
1 parent e0e0c2b commit e62df4a

6 files changed

Lines changed: 211 additions & 0 deletions

File tree

docs/cli.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Workflow in terms of the command order
2+
3+
```
4+
$ validator --geopackage <path-to-geopackage> \
5+
--layers <comma-separated-list-of-layers> \
6+
--columns-all <comma-separated-list-of-columns-in-all-layers> \
7+
--columns-layers <comma-separated-list-of-layers:columns-key:values> \
8+
--assert-nonempty <list-of-columns-to-assert-nonempty-records>
9+
```

docs/json.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Workflow in terms of the json
2+
3+
{
4+
"filename": <path-to-geopackage>,
5+
"type": geopackage,
6+
tasks: {
7+
"check-layers": [list-of-layers],
8+
"check-layer-columns": {
9+
<layer-name> : [list-of-columns-in-layer-name]
10+
},
11+
"check-all-columns": [list-of-columns-in-all-layers],
12+
"check-nonempty": [list-of-columns-to-assert-nonemty]
13+
}
14+
}

docs/scratch.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Scratch
2+
3+
Define a package in terms of a json structure.
4+
```json
5+
{
6+
"name": "PM_{BODY}_{TYPE}_{TOPONYM}_{SPEC}_{VERSION}",
7+
"type": "planmap-package",
8+
"content": {
9+
"type": "files",
10+
"meta.json": {
11+
"type": "json",
12+
"mandatory": "true",
13+
"content": {
14+
# json-schema
15+
}
16+
},
17+
"document": {
18+
"type": "directory",
19+
"mandatory": "true",
20+
"content": {
21+
# filenames-regex
22+
}
23+
},
24+
"vector": {
25+
"type": "directory",
26+
"mandatory": "false",
27+
"content": {
28+
"type": "files",
29+
"*.gpkg": {
30+
"type": "geopackage",
31+
"mandatory": "true",
32+
"content": {
33+
"units": {
34+
"mandatory": "true",
35+
"type": "table",
36+
"content": [
37+
{
38+
"name": "name",
39+
"type": "string",
40+
"mandatory": "true"
41+
},
42+
{
43+
"name": "geometry",
44+
"type": "Polygon",
45+
"mandatory": "true"
46+
}
47+
]
48+
},
49+
"contacts": {
50+
"mandatory": "true",
51+
"type": "table",
52+
"content": [
53+
{
54+
"name": "geometry",
55+
"type": "Linestring",
56+
"mandatory": "true"
57+
}
58+
]
59+
}
60+
}
61+
}
62+
# filenames-regex (e.g., *.gpkg)
63+
}
64+
}
65+
}
66+
}
67+
```

validator/vector/__init__.py

Whitespace-only changes.

validator/vector/definitions.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"definitions": {
3+
4+
"point_coordinates": {
5+
"type": "array",
6+
"items": [
7+
{
8+
"type": "number"
9+
}
10+
],
11+
"minItems": 2,
12+
"maxItems": 3
13+
},
14+
15+
"line_coordinates": {
16+
"type": "array",
17+
"items": [
18+
{
19+
"$ref": "#/definitions/point_coordinates"
20+
}
21+
],
22+
"minItems": 2
23+
},
24+
25+
"polygon_coordinates": {
26+
"type": "array",
27+
"items": [
28+
{
29+
"$ref": "#/definitions/line_coordinates"
30+
},
31+
{ "minItems": 4 }
32+
]
33+
},
34+
35+
"polygon_geometry": {
36+
"type": "object",
37+
"properties": {
38+
"type": {
39+
"const": "Polygon"
40+
},
41+
"coordinates": {
42+
"$ref": "#/definitions/polygon_coordinates"
43+
}
44+
}
45+
}
46+
}
47+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
4+
"title": "Match Geopackage's 'Units' layer columns list",
5+
6+
"$comment": "Works for, e.g., ['name','geometry','code','bla'], but not for ['bla','name','geometry','code']",
7+
"$example": ["name","geometry","code","another-column"],
8+
9+
"definitions": {
10+
11+
"point_coordinates": {
12+
"type": "array",
13+
"items": [
14+
{
15+
"type": "number"
16+
}
17+
],
18+
"minItems": 2,
19+
"maxItems": 3
20+
},
21+
22+
"line_coordinates": {
23+
"type": "array",
24+
"items": [
25+
{
26+
"$ref": "#/definitions/point_coordinates"
27+
}
28+
],
29+
"minItems": 2
30+
},
31+
32+
"polygon_coordinates": {
33+
"type": "array",
34+
"items": [
35+
{
36+
"$ref": "#/definitions/line_coordinates"
37+
},
38+
{ "minItems": 4 }
39+
],
40+
"minItems": 1,
41+
"maxItems": 1
42+
},
43+
44+
"polygon_geometry": {
45+
"type": "object",
46+
"properties": {
47+
"type": {
48+
"const": "Polygon"
49+
},
50+
"coordinates": {
51+
"$ref": "#/definitions/polygon_coordinates"
52+
}
53+
}
54+
}
55+
},
56+
57+
58+
"type": "object",
59+
"properties": {
60+
61+
"Unit": {
62+
"type": "string"
63+
},
64+
65+
"RGB": {
66+
"type": "string"
67+
},
68+
69+
"geometry": {
70+
"$ref": "#/definitions/polygon_geometry"
71+
}
72+
73+
}
74+
}

0 commit comments

Comments
 (0)