Skip to content

Commit 5cb8d7b

Browse files
committed
Implement a custom port of GeoJSON
Signed-off-by: Juan Cruz Viotti <[email protected]>
1 parent 8261a7d commit 5cb8d7b

32 files changed

+3793
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 7946 GeoJSON Bounding Box",
4+
"description": "An array of numbers representing a bounding box that encloses a GeoJSON object, with coordinates in the order: westernmost, southernmost, easternmost, northernmost",
5+
"examples": [
6+
[ -180, -90, 180, 90 ],
7+
[ -122.5, 37.5, -122.0, 38.0 ],
8+
[ -180, -90, 0, 180, 90, 1000 ]
9+
],
10+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
11+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc7946#section-5" ],
12+
"type": "array",
13+
"anyOf": [
14+
{
15+
"description": "2D bounding box",
16+
"maxItems": 4,
17+
"minItems": 4,
18+
"prefixItems": [
19+
{
20+
"description": "Westernmost longitude",
21+
"$comment": "RFC 7946 does not constrain longitude range",
22+
"type": "number"
23+
},
24+
{
25+
"description": "Southernmost latitude",
26+
"$ref": "../../iso/coordinate/2022/latitude.json"
27+
},
28+
{
29+
"description": "Easternmost longitude",
30+
"$comment": "RFC 7946 does not constrain longitude range",
31+
"type": "number"
32+
},
33+
{
34+
"description": "Northernmost latitude",
35+
"$ref": "../../iso/coordinate/2022/latitude.json"
36+
}
37+
]
38+
},
39+
{
40+
"description": "3D bounding box",
41+
"maxItems": 6,
42+
"minItems": 6,
43+
"prefixItems": [
44+
{
45+
"description": "Westernmost longitude",
46+
"$comment": "RFC 7946 does not constrain longitude range",
47+
"type": "number"
48+
},
49+
{
50+
"description": "Southernmost latitude",
51+
"$ref": "../../iso/coordinate/2022/latitude.json"
52+
},
53+
{
54+
"description": "Minimum altitude",
55+
"$ref": "../../iso/coordinate/2022/altitude.json"
56+
},
57+
{
58+
"description": "Easternmost longitude",
59+
"$comment": "RFC 7946 does not constrain longitude range",
60+
"type": "number"
61+
},
62+
{
63+
"description": "Northernmost latitude",
64+
"$ref": "../../iso/coordinate/2022/latitude.json"
65+
},
66+
{
67+
"description": "Maximum altitude",
68+
"$ref": "../../iso/coordinate/2022/altitude.json"
69+
}
70+
]
71+
},
72+
{
73+
"description": "Higher dimension bounding box",
74+
"minItems": 7,
75+
"items": {
76+
"type": "number"
77+
}
78+
}
79+
]
80+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 7946 GeoJSON FeatureCollection",
4+
"description": "A collection of Feature objects",
5+
"examples": [
6+
{
7+
"type": "FeatureCollection",
8+
"features": []
9+
},
10+
{
11+
"type": "FeatureCollection",
12+
"features": [
13+
{
14+
"type": "Feature",
15+
"geometry": null,
16+
"properties": null
17+
},
18+
{
19+
"type": "Feature",
20+
"geometry": {
21+
"type": "Point",
22+
"coordinates": [ 0, 0 ]
23+
},
24+
"properties": {
25+
"name": "Example"
26+
}
27+
}
28+
]
29+
}
30+
],
31+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
32+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc7946#section-3.3" ],
33+
"type": "object",
34+
"required": [ "type", "features" ],
35+
"properties": {
36+
"type": {
37+
"const": "FeatureCollection"
38+
},
39+
"features": {
40+
"type": "array",
41+
"items": {
42+
"$ref": "feature.json"
43+
}
44+
},
45+
"bbox": {
46+
"$ref": "bounding-box.json"
47+
},
48+
"coordinates": false,
49+
"geometries": false,
50+
"geometry": false,
51+
"properties": false
52+
}
53+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 7946 GeoJSON Feature",
4+
"description": "A spatially bounded entity that combines a geometry with additional properties",
5+
"examples": [
6+
{
7+
"type": "Feature",
8+
"geometry": null,
9+
"properties": null
10+
},
11+
{
12+
"type": "Feature",
13+
"geometry": {
14+
"type": "Point",
15+
"coordinates": [ 0, 0 ]
16+
},
17+
"properties": {
18+
"name": "Example"
19+
}
20+
},
21+
{
22+
"type": "Feature",
23+
"id": "feature-1",
24+
"geometry": {
25+
"type": "Point",
26+
"coordinates": [ 0, 0 ]
27+
},
28+
"properties": null
29+
}
30+
],
31+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
32+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc7946#section-3.2" ],
33+
"type": "object",
34+
"required": [ "type", "geometry", "properties" ],
35+
"properties": {
36+
"type": {
37+
"const": "Feature"
38+
},
39+
"id": {
40+
"type": [ "number", "string" ]
41+
},
42+
"geometry": {
43+
"anyOf": [
44+
{
45+
"const": null
46+
},
47+
{
48+
"$ref": "geometry.json"
49+
},
50+
{
51+
"$ref": "geometry-collection.json"
52+
}
53+
]
54+
},
55+
"properties": {
56+
"anyOf": [
57+
{
58+
"const": null
59+
},
60+
{
61+
"type": "object"
62+
}
63+
]
64+
},
65+
"bbox": {
66+
"$ref": "bounding-box.json"
67+
},
68+
"coordinates": false,
69+
"geometries": false,
70+
"features": false
71+
}
72+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 7946 GeoJSON GeometryCollection",
4+
"description": "A geometry object that represents a collection of geometry objects",
5+
"examples": [
6+
{
7+
"type": "GeometryCollection",
8+
"geometries": []
9+
},
10+
{
11+
"type": "GeometryCollection",
12+
"geometries": [
13+
{
14+
"type": "Point",
15+
"coordinates": [ 0, 0 ]
16+
},
17+
{
18+
"type": "LineString",
19+
"coordinates": [
20+
[ 0, 0 ],
21+
[ 1, 1 ]
22+
]
23+
}
24+
]
25+
}
26+
],
27+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
28+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc7946#section-3.1.8" ],
29+
"type": "object",
30+
"required": [ "type", "geometries" ],
31+
"properties": {
32+
"type": {
33+
"const": "GeometryCollection"
34+
},
35+
"geometries": {
36+
"type": "array",
37+
"items": {
38+
"$ref": "geometry.json"
39+
}
40+
},
41+
"bbox": {
42+
"$ref": "bounding-box.json"
43+
},
44+
"geometry": false,
45+
"properties": false,
46+
"features": false
47+
}
48+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 7946 GeoJSON Geometry",
4+
"description": "A geometry object representing coordinates in geographic space, excluding GeometryCollection",
5+
"examples": [
6+
{
7+
"type": "Point",
8+
"coordinates": [ 0, 0 ]
9+
},
10+
{
11+
"type": "LineString",
12+
"coordinates": [
13+
[ 0, 0 ],
14+
[ 1, 1 ]
15+
]
16+
},
17+
{
18+
"type": "Polygon",
19+
"coordinates": [
20+
[
21+
[ 0, 0 ],
22+
[ 1, 0 ],
23+
[ 1, 1 ],
24+
[ 0, 0 ]
25+
]
26+
]
27+
}
28+
],
29+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
30+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc7946#section-3.1" ],
31+
"anyOf": [
32+
{
33+
"$ref": "point.json"
34+
},
35+
{
36+
"$ref": "line-string.json"
37+
},
38+
{
39+
"$ref": "polygon.json"
40+
},
41+
{
42+
"$ref": "multi-point.json"
43+
},
44+
{
45+
"$ref": "multi-line-string.json"
46+
},
47+
{
48+
"$ref": "multi-polygon.json"
49+
}
50+
]
51+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 7946 GeoJSON LineString Coordinates",
4+
"description": "An array of two or more positions representing the coordinates of a LineString geometry",
5+
"examples": [
6+
[
7+
[ 0, 0 ],
8+
[ 1, 1 ]
9+
],
10+
[
11+
[ 0, 0 ],
12+
[ 1, 1 ],
13+
[ 2, 0 ]
14+
],
15+
[
16+
[ 0, 0, 0 ],
17+
[ 1, 1, 10 ],
18+
[ 2, 0, 20 ]
19+
]
20+
],
21+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
22+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc7946#section-3.1.4" ],
23+
"type": "array",
24+
"minItems": 2,
25+
"items": {
26+
"$ref": "point-coordinates.json"
27+
}
28+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 7946 GeoJSON LineString",
4+
"description": "A geometry object representing a connected sequence of two or more positions",
5+
"examples": [
6+
{
7+
"type": "LineString",
8+
"coordinates": [
9+
[ 0, 0 ],
10+
[ 1, 1 ]
11+
]
12+
},
13+
{
14+
"type": "LineString",
15+
"coordinates": [
16+
[ 0, 0 ],
17+
[ 1, 1 ],
18+
[ 2, 0 ]
19+
]
20+
}
21+
],
22+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
23+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc7946#section-3.1.4" ],
24+
"type": "object",
25+
"required": [ "type", "coordinates" ],
26+
"properties": {
27+
"type": {
28+
"const": "LineString"
29+
},
30+
"coordinates": {
31+
"$ref": "line-string-coordinates.json"
32+
},
33+
"bbox": {
34+
"$ref": "bounding-box.json"
35+
},
36+
"geometry": false,
37+
"properties": false,
38+
"features": false
39+
}
40+
}

0 commit comments

Comments
 (0)