aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/Makefile.am4
-rw-r--r--data/crsjson.schema.json294
2 files changed, 297 insertions, 1 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index 1bf95cd2..096ba7c3 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -2,7 +2,8 @@ DATAPATH = $(top_srcdir)/data
pkgdata_DATA = GL27 nad.lst nad27 nad83 world other.extra \
CH null \
- ITRF2000 ITRF2008 ITRF2014 proj.db
+ ITRF2000 ITRF2008 ITRF2014 proj.db \
+ crsjson.schema.json
SQL_ORDERED_LIST = sql/begin.sql \
sql/proj_db_table_defs.sql \
@@ -40,6 +41,7 @@ EXTRA_DIST = GL27 nad.lst nad27 nad83 \
world other.extra \
CH \
ITRF2000 ITRF2008 ITRF2014 \
+ crsjson.schema.json \
CMakeLists.txt tests/test_nodata.gtx null \
generate_all_sql_in.cmake sql_filelist.cmake \
$(SQL_ORDERED_LIST)
diff --git a/data/crsjson.schema.json b/data/crsjson.schema.json
new file mode 100644
index 00000000..5ceeaa1e
--- /dev/null
+++ b/data/crsjson.schema.json
@@ -0,0 +1,294 @@
+{
+ "$id": "https://proj.org/crsjson.schema.json",
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "description": "Schema for CRS JSON",
+
+ "oneOf": [
+ { "$ref": "#/definitions/crs" },
+ { "$ref": "#/definitions/datum" },
+ { "$ref": "#/definitions/ellipsoid" },
+ { "$ref": "#/definitions/prime_meridian" },
+ { "$ref": "#/definitions/conversion" }
+ ],
+
+ "definitions": {
+
+ "axis": {
+ "type": "object",
+ "properties": {
+ "type": { "type": "string", "enum": ["Axis"] },
+ "name": { "type": "string" },
+ "abbreviation": { "type": "string" },
+ "direction": { "type": "string" },
+ "unit": { "$ref": "#/definitions/unit" },
+ "id": { "$ref": "#/definitions/id" }
+ },
+ "required" : [ "name" ],
+ "additionalProperties": false
+ },
+
+ "bbox": {
+ "type": "object",
+ "properties": {
+ "east_longitude": { "type": "number" },
+ "west_longitude": { "type": "number" },
+ "south_latitude": { "type": "number" },
+ "north_latitude": { "type": "number" }
+ },
+ "required" : [ "east_longitude", "west_longitude",
+ "south_latitude", "north_latitude" ],
+ "additionalProperties": false
+ },
+
+ "conversion": {
+ "type": "object",
+ "properties": {
+ "type": { "type": "string", "enum": ["Conversion"] },
+ "name": { "type": "string" },
+ "method": { "$ref": "#/definitions/method" },
+ "parameters": {
+ "type": "array",
+ "items": { "$ref": "#/definitions/parameter_value" }
+ },
+ "id": { "$ref": "#/definitions/id" }
+ },
+ "required" : [ "name", "method", "parameters" ],
+ "additionalProperties": false
+ },
+
+ "coordinate_system": {
+ "type": "object",
+ "properties": {
+ "type": { "type": "string", "enum": ["CoordinateSystem"] },
+ "name": { "type": "string" },
+ "subtype": { "type": "string" },
+ "axis": {
+ "type": "array",
+ "items": { "$ref": "#/definitions/axis" }
+ },
+ "id": { "$ref": "#/definitions/id" }
+ },
+ "required" : [ "subtype", "axis" ],
+ "additionalProperties": false
+ },
+
+ "crs": {
+ "oneOf": [
+ { "$ref": "#/definitions/geodetic_crs" },
+ { "$ref": "#/definitions/derived_crs" }
+ ]
+ },
+
+ "datum": {
+ "oneOf": [ { "$ref": "#/definitions/geodetic_reference_frame" } ]
+ },
+
+ "derived_crs": {
+ "type": "object",
+ "allOf": [{ "$ref": "#/definitions/object_usage" }],
+ "properties": {
+ "type": { "type": "string",
+ "enum": ["ProjectedCRS", "DerivedGeodeticCRS",
+ "DerivedGeographicCRS"] },
+ "name": { "type": "string" },
+ "base_crs": { "$ref": "#/definitions/crs" },
+ "conversion": { "$ref": "#/definitions/conversion" },
+ "coordinate_system": { "$ref": "#/definitions/coordinate_system" },
+ "area": {},
+ "bbox": {},
+ "usages": {},
+ "remarks": {},
+ "id": {}
+ },
+ "required" : [ "name", "base_crs", "conversion", "coordinate_system" ],
+ "additionalProperties": false
+ },
+
+ "ellipsoid": {
+ "type": "object",
+ "oneOf":[
+ {
+ "properties": {
+ "type": { "type": "string", "enum": ["Ellipsoid"] },
+ "name": { "type": "string" },
+ "semi_major_axis": { "$ref": "#/definitions/value_and_unit" },
+ "semi_minor_axis": { "$ref": "#/definitions/value_and_unit" },
+ "id": { "$ref": "#/definitions/id" }
+ },
+ "required" : [ "name", "semi_major_axis", "semi_minor_axis" ],
+ "additionalProperties": false
+ },
+ {
+ "properties": {
+ "type": { "type": "string", "enum": ["Ellipsoid"] },
+ "name": { "type": "string" },
+ "semi_major_axis": { "$ref": "#/definitions/value_and_unit" },
+ "inverse_flattening": { "type": "number" },
+ "id": { "$ref": "#/definitions/id" }
+ },
+ "required" : [ "name", "semi_major_axis", "inverse_flattening" ],
+ "additionalProperties": false
+ },
+ {
+ "properties": {
+ "type": { "type": "string", "enum": ["Ellipsoid"] },
+ "name": { "type": "string" },
+ "radius": { "$ref": "#/definitions/value_and_unit" },
+ "id": { "$ref": "#/definitions/id" }
+ },
+ "required" : [ "name", "radius" ],
+ "additionalProperties": false
+ }
+ ]
+ },
+
+ "geodetic_crs": {
+ "type": "object",
+ "allOf": [{ "$ref": "#/definitions/object_usage" }],
+ "properties": {
+ "type": { "type": "string", "enum": ["GeodeticCRS", "GeographicCRS"] },
+ "name": { "type": "string" },
+ "datum": { "$ref": "#/definitions/datum" },
+ "coordinate_system": { "$ref": "#/definitions/coordinate_system" },
+ "area": {},
+ "bbox": {},
+ "usages": {},
+ "remarks": {},
+ "id": {}
+ },
+ "required" : [ "name", "datum" ],
+ "additionalProperties": false
+ },
+
+ "geodetic_reference_frame": {
+ "type": "object",
+ "allOf": [{ "$ref": "#/definitions/object_usage" }],
+ "properties": {
+ "type": { "type": "string", "enum": ["GeodeticReferenceFrame"] },
+ "name": { "type": "string" },
+ "anchor": { "type": "string" },
+ "ellipsoid": { "$ref": "#/definitions/ellipsoid" },
+ "prime_meridian": { "$ref": "#/definitions/prime_meridian" },
+ "area": {},
+ "bbox": {},
+ "usages": {},
+ "remarks": {},
+ "id": {}
+ },
+ "required" : [ "name", "ellipsoid" ],
+ "additionalProperties": false
+ },
+
+ "id": {
+ "type": "object",
+ "properties": {
+ "authority": { "type": "string" },
+ "code": {
+ "oneOf": [ { "type": "string" }, { "type": "integer" } ]
+ }
+ },
+ "required" : [ "authority", "code" ],
+ "additionalProperties": false
+ },
+
+ "method": {
+ "type": "object",
+ "properties": {
+ "type": { "type": "string", "enum": ["OperationMethod"]},
+ "name": { "type": "string" },
+ "id": { "$ref": "#/definitions/id" }
+ },
+ "required" : [ "name" ],
+ "additionalProperties": false
+ },
+
+ "object_usage": {
+ "anyOf": [
+ {
+ "type": "object",
+ "properties": {
+ "area": { "type": "string" },
+ "bbox": { "$ref": "#/definitions/bbox" },
+ "remarks": { "type": "string" },
+ "id": { "$ref": "#/definitions/id" }
+ }
+ },
+ {
+ "type": "object",
+ "properties": {
+ "usages": { "$ref": "#/definitions/usages" },
+ "remarks": { "type": "string" },
+ "id": { "$ref": "#/definitions/id" }
+ }
+ }
+ ]
+ },
+
+ "parameter_value": {
+ "type": "object",
+ "properties": {
+ "type": { "type": "string", "enum": ["ParameterValue"] },
+ "name": { "type": "string" },
+ "value": {
+ "oneOf": [
+ { "type": "string" },
+ { "type": "number" }
+ ]
+ },
+ "unit": { "$ref": "#/definitions/unit" },
+ "id": { "$ref": "#/definitions/id" }
+ },
+ "required" : [ "name", "value" ],
+ "additionalProperties": false
+ },
+
+ "prime_meridian": {
+ "type": "object",
+ "properties": {
+ "type": { "type": "string", "enum": ["PrimeMeridian"] },
+ "name": { "type": "string" },
+ "longitude": { "$ref": "#/definitions/value_and_unit" },
+ "id": { "$ref": "#/definitions/id" }
+ },
+ "required" : [ "name" ],
+ "additionalProperties": false
+ },
+
+ "unit": {
+ "type": "object",
+ "properties": {
+ "type": { "type": "string",
+ "enum": ["LinearUnit", "AngularUnit", "ScaleUnit",
+ "TimeUnit", "ParametricUnit", "Unit"] },
+ "name": { "type": "string" },
+ "conversion_factor": { "type": "number" },
+ "id": { "$ref": "#/definitions/id" }
+ },
+ "required" : [ "type", "name" ],
+ "additionalProperties": false
+ },
+
+ "usages": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "area": { "type": "string" },
+ "bbox": { "$ref": "#/definitions/bbox" }
+ },
+ "additionalProperties": false
+ }
+ },
+
+ "value_and_unit": {
+ "type": "object",
+ "properties": {
+ "value": { "type": "number" },
+ "unit": { "$ref": "#/definitions/unit" }
+ },
+ "required" : [ "value", "unit" ],
+ "additionalProperties": false
+ }
+
+ }
+}