Skip to content

Commit

Permalink
PROJJSON: add support for DatumEnsemble and Dynamic[Geodetic|Vertical…
Browse files Browse the repository at this point in the history
…]ReferenceFrame
  • Loading branch information
rouault committed Aug 10, 2019
1 parent 17dc5eb commit 63981af
Show file tree
Hide file tree
Showing 6 changed files with 746 additions and 70 deletions.
275 changes: 254 additions & 21 deletions data/crsjson.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"oneOf": [
{ "$ref": "#/definitions/crs" },
{ "$ref": "#/definitions/datum" },
{ "$ref": "#/definitions/datum_ensemble" },
{ "$ref": "#/definitions/ellipsoid" },
{ "$ref": "#/definitions/prime_meridian" },
{ "$ref": "#/definitions/single_operation" },
Expand Down Expand Up @@ -147,42 +148,153 @@

"crs": {
"oneOf": [
{ "$ref": "#/definitions/geodetic_crs" },
{ "$ref": "#/definitions/derived_crs" },
{ "$ref": "#/definitions/vertical_crs" },
{ "$ref": "#/definitions/compound_crs" },
{ "$ref": "#/definitions/bound_crs" },
{ "$ref": "#/definitions/compound_crs" },
{ "$ref": "#/definitions/derived_engineering_crs" },
{ "$ref": "#/definitions/derived_geodetic_crs" },
{ "$ref": "#/definitions/derived_parametric_crs" },
{ "$ref": "#/definitions/derived_projected_crs" },
{ "$ref": "#/definitions/derived_temporal_crs" },
{ "$ref": "#/definitions/derived_vertical_crs" },
{ "$ref": "#/definitions/engineering_crs" },
{ "$ref": "#/definitions/geodetic_crs" },
{ "$ref": "#/definitions/parametric_crs" },
{ "$ref": "#/definitions/temporal_crs" }
{ "$ref": "#/definitions/projected_crs" },
{ "$ref": "#/definitions/temporal_crs" },
{ "$ref": "#/definitions/vertical_crs" }
]
},

"datum": {
"oneOf": [
{ "$ref": "#/definitions/geodetic_reference_frame" },
{ "$ref": "#/definitions/vertical_reference_frame" },
{ "$ref": "#/definitions/dynamic_geodetic_reference_frame" },
{ "$ref": "#/definitions/dynamic_vertical_reference_frame" },
{ "$ref": "#/definitions/temporal_datum" },
{ "$ref": "#/definitions/parametric_datum" },
{ "$ref": "#/definitions/engineering_datum" }
]
},

"derived_crs": {
"datum_ensemble": {
"type": "object",
"properties": {
"type": { "type": "string", "enum": ["DatumEnsemble"] },
"name": { "type": "string" },
"members": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"id": { "$ref": "#/definitions/id" }
},
"required" : [ "name" ],
"additionalProperties": false
}
},
"ellipsoid": { "$ref": "#/definitions/ellipsoid" },
"accuracy": { "type": "string" },
"id": { "$ref": "#/definitions/id" }
},
"required" : [ "name", "members", "accuracy" ],
"additionalProperties": false
},

"derived_engineering_crs": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/object_usage" }],
"properties": {
"type": { "type": "string",
"enum": ["DerivedEngineeringCRS"] },
"name": { "type": "string" },
"base_crs": { "$ref": "#/definitions/engineering_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"scope": {},
"area": {},
"bbox": {},
"usages": {},
"remarks": {},
"id": {}
},
"required" : [ "name", "base_crs", "conversion", "coordinate_system" ],
"additionalProperties": false
},

"derived_geodetic_crs": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/object_usage" }],
"properties": {
"type": { "type": "string",
"enum": ["DerivedGeodeticCRS",
"DerivedGeographicCRS"] },
"name": { "type": "string" },
"base_crs": { "$ref": "#/definitions/geodetic_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"scope": {},
"area": {},
"bbox": {},
"usages": {},
"remarks": {},
"id": {}
},
"required" : [ "name", "base_crs", "conversion", "coordinate_system" ],
"additionalProperties": false
},

"derived_parametric_crs": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/object_usage" }],
"properties": {
"type": { "type": "string",
"enum": ["DerivedParametricCRS"] },
"name": { "type": "string" },
"base_crs": { "$ref": "#/definitions/parametric_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"scope": {},
"area": {},
"bbox": {},
"usages": {},
"remarks": {},
"id": {}
},
"required" : [ "name", "base_crs", "conversion", "coordinate_system" ],
"additionalProperties": false
},

"derived_projected_crs": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/object_usage" }],
"properties": {
"type": { "type": "string",
"enum": ["DerivedProjectedCRS"] },
"name": { "type": "string" },
"base_crs": { "$ref": "#/definitions/projected_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"scope": {},
"area": {},
"bbox": {},
"usages": {},
"remarks": {},
"id": {}
},
"required" : [ "name", "base_crs", "conversion", "coordinate_system" ],
"additionalProperties": false
},

"derived_temporal_crs": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/object_usage" }],
"properties": {
"type": { "type": "string",
"enum": ["ProjectedCRS",
"DerivedGeodeticCRS",
"DerivedGeographicCRS",
"DerivedProjectedCRS",
"DerivedVerticalCRS",
"DerivedTemporalCRS",
"DerivedParametricCRS",
"DerivedEngineeringCRS"] },
"enum": ["DerivedTemporalCRS"] },
"name": { "type": "string" },
"base_crs": { "$ref": "#/definitions/crs" },
"base_crs": { "$ref": "#/definitions/temporal_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"scope": {},
Expand All @@ -196,6 +308,69 @@
"additionalProperties": false
},

"derived_vertical_crs": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/object_usage" }],
"properties": {
"type": { "type": "string",
"enum": ["DerivedVerticalCRS"] },
"name": { "type": "string" },
"base_crs": { "$ref": "#/definitions/vertical_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"scope": {},
"area": {},
"bbox": {},
"usages": {},
"remarks": {},
"id": {}
},
"required" : [ "name", "base_crs", "conversion", "coordinate_system" ],
"additionalProperties": false
},

"dynamic_geodetic_reference_frame": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/geodetic_reference_frame" }],
"properties": {
"type": { "type": "string", "enum": ["DynamicGeodeticReferenceFrame"] },
"name": {},
"anchor": {},
"ellipsoid": {},
"prime_meridian": {},
"frame_reference_epoch": { "type": "number" },
"deformation_model": { "type": "string" },
"scope": {},
"area": {},
"bbox": {},
"usages": {},
"remarks": {},
"id": {}
},
"required" : [ "name", "ellipsoid", "frame_reference_epoch" ],
"additionalProperties": false
},

"dynamic_vertical_reference_frame": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/vertical_reference_frame" }],
"properties": {
"type": { "type": "string", "enum": ["DynamicVerticalReferenceFrame"] },
"name": {},
"anchor": {},
"frame_reference_epoch": { "type": "number" },
"deformation_model": { "type": "string" },
"scope": {},
"area": {},
"bbox": {},
"usages": {},
"remarks": {},
"id": {}
},
"required" : [ "name", "frame_reference_epoch" ],
"additionalProperties": false
},

"ellipsoid": {
"type": "object",
"oneOf":[
Expand Down Expand Up @@ -273,11 +448,16 @@

"geodetic_crs": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/object_usage" }],
"properties": {
"type": { "type": "string", "enum": ["GeodeticCRS", "GeographicCRS"] },
"name": { "type": "string" },
"datum": { "$ref": "#/definitions/geodetic_reference_frame" },
"datum": {
"oneOf": [
{ "$ref": "#/definitions/geodetic_reference_frame" },
{ "$ref": "#/definitions/dynamic_geodetic_reference_frame" }
]
},
"datum_ensemble": { "$ref": "#/definitions/datum_ensemble" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"scope": {},
"area": {},
Expand All @@ -286,7 +466,12 @@
"remarks": {},
"id": {}
},
"required" : [ "name", "datum" ],
"required" : [ "name" ],
"description": "One and only one of datum and datum_ensemble must be provided",
"allOf": [
{ "$ref": "#/definitions/object_usage" },
{ "$ref": "#/definitions/one_and_only_one_of_datum_or_datum_ensemble" }
],
"additionalProperties": false
},

Expand Down Expand Up @@ -333,6 +518,23 @@
"additionalProperties": false
},

"one_and_only_one_of_datum_or_datum_ensemble": {
"allOf": [
{
"not": {
"type": "object",
"required": [ "datum", "datum_ensemble" ]
}
},
{
"oneOf": [
{ "type": "object", "required": ["datum"] },
{ "type": "object", "required": ["datum_ensemble"] }
]
}
]
},

"object_usage": {
"anyOf": [
{
Expand Down Expand Up @@ -430,6 +632,27 @@
]
},

"projected_crs": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/object_usage" }],
"properties": {
"type": { "type": "string",
"enum": ["ProjectedCRS"] },
"name": { "type": "string" },
"base_crs": { "$ref": "#/definitions/geodetic_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"scope": {},
"area": {},
"bbox": {},
"usages": {},
"remarks": {},
"id": {}
},
"required" : [ "name", "base_crs", "conversion", "coordinate_system" ],
"additionalProperties": false
},

"temporal_crs": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/object_usage" }],
Expand Down Expand Up @@ -548,11 +771,16 @@

"vertical_crs": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/object_usage" }],
"properties": {
"type": { "type": "string", "enum": ["VerticalCRS"] },
"name": { "type": "string" },
"datum": { "$ref": "#/definitions/vertical_reference_frame" },
"datum": {
"oneOf": [
{ "$ref": "#/definitions/vertical_reference_frame" },
{ "$ref": "#/definitions/dynamic_vertical_reference_frame" }
]
},
"datum_ensemble": { "$ref": "#/definitions/datum_ensemble" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"scope": {},
"area": {},
Expand All @@ -561,7 +789,12 @@
"remarks": {},
"id": {}
},
"required" : [ "name", "datum" ],
"required" : [ "name"],
"description": "One and only one of datum and datum_ensemble must be provided",
"allOf": [
{ "$ref": "#/definitions/object_usage" },
{ "$ref": "#/definitions/one_and_only_one_of_datum_or_datum_ensemble" }
],
"additionalProperties": false
},

Expand Down
6 changes: 5 additions & 1 deletion include/proj/datum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ using DatumEnsembleNNPtr = util::nn<DatumEnsemblePtr>;
*
* \remark Implements DatumEnsemble from \ref ISO_19111_2019
*/
class PROJ_GCC_DLL DatumEnsemble final : public common::IdentifiedObject {
class PROJ_GCC_DLL DatumEnsemble final : public common::IdentifiedObject,
public io::IJSONExportable {
public:
//! @cond Doxygen_Suppress
PROJ_DLL ~DatumEnsemble() override;
Expand All @@ -135,6 +136,9 @@ class PROJ_GCC_DLL DatumEnsemble final : public common::IdentifiedObject {

//! @cond Doxygen_Suppress
PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)

PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
const override; // throw(io::FormattingException)
//! @endcond

Expand Down
Loading

0 comments on commit 63981af

Please sign in to comment.