geometry-schema.json 3.16 KB
Newer Older
canterafonsj's avatar
canterafonsj committed
1
{
Stefan Wiedemann's avatar
Stefan Wiedemann committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  "$schema": "http://json-schema.org/draft-04/schema#",
  "$id": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json",
  "title": "geometry",
  "description": "One geometry as defined by GeoJSON. Licensed as per original source is https://github.com/fge/sample-json-schemas/blob/master/geojson/geometry.json",
  "type": "object",
  "required": [
    "type",
    "coordinates"
  ],
  "oneOf": [
    {
      "title": "Point",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "Point"
          ]
canterafonsj's avatar
canterafonsj committed
20
        },
Stefan Wiedemann's avatar
Stefan Wiedemann committed
21
22
23
24
25
26
27
28
29
30
31
32
33
        "coordinates": {
          "$ref": "#/definitions/position"
        }
      }
    },
    {
      "title": "MultiPoint",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "MultiPoint"
          ]
canterafonsj's avatar
canterafonsj committed
34
        },
Stefan Wiedemann's avatar
Stefan Wiedemann committed
35
36
37
38
39
40
41
42
43
44
45
46
47
        "coordinates": {
          "$ref": "#/definitions/positionArray"
        }
      }
    },
    {
      "title": "LineString",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "LineString"
          ]
canterafonsj's avatar
canterafonsj committed
48
        },
Stefan Wiedemann's avatar
Stefan Wiedemann committed
49
50
51
52
53
54
55
56
57
58
59
60
61
        "coordinates": {
          "$ref": "#/definitions/lineString"
        }
      }
    },
    {
      "title": "MultiLineString",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "MultiLineString"
          ]
canterafonsj's avatar
canterafonsj committed
62
        },
Stefan Wiedemann's avatar
Stefan Wiedemann committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
        "coordinates": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/lineString"
          }
        }
      }
    },
    {
      "title": "Polygon",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "Polygon"
          ]
canterafonsj's avatar
canterafonsj committed
79
        },
Stefan Wiedemann's avatar
Stefan Wiedemann committed
80
81
        "coordinates": {
          "$ref": "#/definitions/polygon"
canterafonsj's avatar
canterafonsj committed
82
        }
Stefan Wiedemann's avatar
Stefan Wiedemann committed
83
84
85
86
87
88
89
90
91
92
      }
    },
    {
      "title": "MultiPolygon",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "MultiPolygon"
          ]
canterafonsj's avatar
canterafonsj committed
93
        },
Stefan Wiedemann's avatar
Stefan Wiedemann committed
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
        "coordinates": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/polygon"
          }
        }
      }
    }
  ],
  "definitions": {
    "position": {
      "description": "A single position",
      "type": "array",
      "minItems": 2,
      "items": [
        {
          "type": "number"
canterafonsj's avatar
canterafonsj committed
111
        },
Stefan Wiedemann's avatar
Stefan Wiedemann committed
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
        {
          "type": "number"
        }
      ],
      "additionalItems": false
    },
    "positionArray": {
      "description": "An array of positions",
      "type": "array",
      "items": {
        "$ref": "#/definitions/position"
      }
    },
    "lineString": {
      "description": "An array of two or more positions",
      "allOf": [
        {
          "$ref": "#/definitions/positionArray"
canterafonsj's avatar
canterafonsj committed
130
        },
Stefan Wiedemann's avatar
Stefan Wiedemann committed
131
132
133
134
135
136
137
138
139
140
        {
          "minItems": 2
        }
      ]
    },
    "linearRing": {
      "description": "An array of four positions where the first equals the last",
      "allOf": [
        {
          "$ref": "#/definitions/positionArray"
canterafonsj's avatar
canterafonsj committed
141
        },
Stefan Wiedemann's avatar
Stefan Wiedemann committed
142
143
        {
          "minItems": 4
canterafonsj's avatar
canterafonsj committed
144
        }
Stefan Wiedemann's avatar
Stefan Wiedemann committed
145
146
147
148
149
150
151
152
      ]
    },
    "polygon": {
      "description": "An array of linear rings",
      "type": "array",
      "items": {
        "$ref": "#/definitions/linearRing"
      }
canterafonsj's avatar
canterafonsj committed
153
    }
Stefan Wiedemann's avatar
Stefan Wiedemann committed
154
  }
canterafonsj's avatar
canterafonsj committed
155
}