Skip to content

Commit

Permalink
PROJJSON: rename file as projjson.schema.json, and add versionning to…
Browse files Browse the repository at this point in the history
… it and to exported PROJJSON strings
  • Loading branch information
rouault committed Aug 17, 2019
1 parent 8d0500b commit cad1c5c
Show file tree
Hide file tree
Showing 14 changed files with 1,180 additions and 63 deletions.
4 changes: 2 additions & 2 deletions data/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DATAPATH = $(top_srcdir)/data
pkgdata_DATA = GL27 nad.lst nad27 nad83 world other.extra \
CH null \
ITRF2000 ITRF2008 ITRF2014 proj.db \
crsjson.schema.json
projjson.schema.json

SQL_ORDERED_LIST = sql/begin.sql \
sql/proj_db_table_defs.sql \
Expand Down Expand Up @@ -41,7 +41,7 @@ EXTRA_DIST = GL27 nad.lst nad27 nad83 \
world other.extra \
CH \
ITRF2000 ITRF2008 ITRF2014 \
crsjson.schema.json \
projjson.schema.json \
CMakeLists.txt tests/test_nodata.gtx null \
generate_all_sql_in.cmake sql_filelist.cmake \
$(SQL_ORDERED_LIST)
Expand Down
41 changes: 39 additions & 2 deletions data/crsjson.schema.json → data/projjson.schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"$id": "https://proj.org/crsjson.schema.json",
"$id": "https://proj.org/schemas/v0.1/projjson.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Schema for CRS JSON",
"description": "Schema for PROJJSON",
"$comment": "This file exists both in data/ and in schemas/vXXX/. Keep both in sync. And if changing the value of $id, change PROJJSON_CURRENT_VERSION accordingly in io.cpp",

"oneOf": [
{ "$ref": "#/definitions/crs" },
Expand All @@ -18,6 +19,7 @@
"abridged_transformation": {
"type": "object",
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["AbridgedTransformation"] },
"name": { "type": "string" },
"method": { "$ref": "#/definitions/method" },
Expand All @@ -38,6 +40,7 @@
"axis": {
"type": "object",
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["Axis"] },
"name": { "type": "string" },
"abbreviation": { "type": "string" },
Expand Down Expand Up @@ -109,6 +112,7 @@
"bound_crs": {
"type": "object",
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["BoundCRS"] },
"source_crs": { "$ref": "#/definitions/crs" },
"target_crs": { "$ref": "#/definitions/crs" },
Expand All @@ -128,6 +132,7 @@
"type": "array",
"items": { "$ref": "#/definitions/crs" }
},
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -151,6 +156,7 @@
"type": "array",
"items": { "$ref": "#/definitions/single_operation" }
},
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -165,6 +171,7 @@
"conversion": {
"type": "object",
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["Conversion"] },
"name": { "type": "string" },
"method": { "$ref": "#/definitions/method" },
Expand All @@ -185,6 +192,7 @@
"coordinate_system": {
"type": "object",
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["CoordinateSystem"] },
"name": { "type": "string" },
"subtype": { "type": "string",
Expand Down Expand Up @@ -245,6 +253,7 @@
"datum_ensemble": {
"type": "object",
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["DatumEnsemble"] },
"name": { "type": "string" },
"members": {
Expand Down Expand Up @@ -285,6 +294,7 @@
"base_crs": { "$ref": "#/definitions/engineering_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -307,6 +317,7 @@
"base_crs": { "$ref": "#/definitions/geodetic_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -328,6 +339,7 @@
"base_crs": { "$ref": "#/definitions/parametric_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -349,6 +361,7 @@
"base_crs": { "$ref": "#/definitions/projected_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -370,6 +383,7 @@
"base_crs": { "$ref": "#/definitions/temporal_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -391,6 +405,7 @@
"base_crs": { "$ref": "#/definitions/vertical_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -413,6 +428,7 @@
"prime_meridian": {},
"frame_reference_epoch": { "type": "number" },
"deformation_model": { "type": "string" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -433,6 +449,7 @@
"anchor": {},
"frame_reference_epoch": { "type": "number" },
"deformation_model": { "type": "string" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -449,6 +466,7 @@
"oneOf":[
{
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["Ellipsoid"] },
"name": { "type": "string" },
"semi_major_axis": { "$ref": "#/definitions/value_in_metre_or_value_and_unit" },
Expand All @@ -461,6 +479,7 @@
},
{
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["Ellipsoid"] },
"name": { "type": "string" },
"semi_major_axis": { "$ref": "#/definitions/value_in_metre_or_value_and_unit" },
Expand All @@ -473,6 +492,7 @@
},
{
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["Ellipsoid"] },
"name": { "type": "string" },
"radius": { "$ref": "#/definitions/value_in_metre_or_value_and_unit" },
Expand All @@ -496,6 +516,7 @@
"name": { "type": "string" },
"datum": { "$ref": "#/definitions/engineering_datum" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -514,6 +535,7 @@
"type": { "type": "string", "enum": ["EngineeringDatum"] },
"name": { "type": "string" },
"anchor": { "type": "string" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -538,6 +560,7 @@
},
"datum_ensemble": { "$ref": "#/definitions/datum_ensemble" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -563,6 +586,7 @@
"anchor": { "type": "string" },
"ellipsoid": { "$ref": "#/definitions/ellipsoid" },
"prime_meridian": { "$ref": "#/definitions/prime_meridian" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand Down Expand Up @@ -594,6 +618,7 @@
"method": {
"type": "object",
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["OperationMethod"]},
"name": { "type": "string" },
"id": { "$ref": "#/definitions/id" },
Expand Down Expand Up @@ -635,6 +660,7 @@
{
"type": "object",
"properties": {
"$schema" : { "type": "string" },
"scope": { "type": "string" },
"area": { "type": "string" },
"bbox": { "$ref": "#/definitions/bbox" },
Expand All @@ -649,6 +675,7 @@
{
"type": "object",
"properties": {
"$schema" : { "type": "string" },
"usages": { "$ref": "#/definitions/usages" },
"remarks": { "type": "string" },
"id": { "$ref": "#/definitions/id" },
Expand All @@ -664,6 +691,7 @@
"parameter_value": {
"type": "object",
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["ParameterValue"] },
"name": { "type": "string" },
"value": {
Expand Down Expand Up @@ -691,6 +719,7 @@
"name": { "type": "string" },
"datum": { "$ref": "#/definitions/parametric_datum" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -709,6 +738,7 @@
"type": { "type": "string", "enum": ["ParametricDatum"] },
"name": { "type": "string" },
"anchor": { "type": "string" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -723,6 +753,7 @@
"prime_meridian": {
"type": "object",
"properties": {
"$schema" : { "type": "string" },
"type": { "type": "string", "enum": ["PrimeMeridian"] },
"name": { "type": "string" },
"longitude": { "$ref": "#/definitions/value_and_unit" },
Expand Down Expand Up @@ -753,6 +784,7 @@
"base_crs": { "$ref": "#/definitions/geodetic_crs" },
"conversion": { "$ref": "#/definitions/conversion" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -772,6 +804,7 @@
"name": { "type": "string" },
"datum": { "$ref": "#/definitions/temporal_datum" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -791,6 +824,7 @@
"name": { "type": "string" },
"calendar": { "type": "string" },
"time_origin": { "type": "string" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -817,6 +851,7 @@
"items": { "$ref": "#/definitions/parameter_value" }
},
"accuracy": { "type": "string" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand Down Expand Up @@ -897,6 +932,7 @@
},
"datum_ensemble": { "$ref": "#/definitions/datum_ensemble" },
"coordinate_system": { "$ref": "#/definitions/coordinate_system" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand All @@ -920,6 +956,7 @@
"type": { "type": "string", "enum": ["VerticalReferenceFrame"] },
"name": { "type": "string" },
"anchor": { "type": "string" },
"$schema" : {},
"scope": {},
"area": {},
"bbox": {},
Expand Down
1 change: 1 addition & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ html: .doxygen_up_to_date
# Undoes the hacks of scripts/generate_breathe_friendly_general_doc.py
@sed "s/<em class=\"property\">namespace <\/em>//g" < $(BUILDDIR)/html/development/reference/cpp/cpp_general.html > $(BUILDDIR)/html/development/reference/cpp/cpp_general.html.tmp
@mv $(BUILDDIR)/html/development/reference/cpp/cpp_general.html.tmp $(BUILDDIR)/html/development/reference/cpp/cpp_general.html
@cp -r ../schemas $(BUILDDIR)/html/schemas
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

Expand Down
2 changes: 1 addition & 1 deletion docs/source/apps/projinfo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Synopsis
(*added in 6.2*)
- a OGC URN combining references for concatenated operations
(e.g. "urn:ogc:def:coordinateOperation,coordinateOperation:EPSG::3895,coordinateOperation:EPSG::1618")
- a PROJJSON string. The jsonschema is at https://github.com/OSGeo/proj/blob/master/data/crsjson.schema.json (*added in 6.2*)
- a PROJJSON string. The jsonschema is at https://proj.org/schemas/v0.1/projjson.schema.json (*added in 6.2*)

{object_reference} is a filename preceded by the '@' character. The
file referenced by the {object_reference} must contain a valid
Expand Down
1 change: 1 addition & 0 deletions include/proj/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ class PROJ_GCC_DLL JSONFormatter {

PROJ_DLL JSONFormatter &setMultiLine(bool multiLine) noexcept;
PROJ_DLL JSONFormatter &setIndentationWidth(int width) noexcept;
PROJ_DLL JSONFormatter &setSchema(const std::string &schema) noexcept;

PROJ_DLL const std::string &toString() const;

Expand Down
Loading

0 comments on commit cad1c5c

Please sign in to comment.