Skip to content

Commit

Permalink
Merge pull request OSGeo#2850 from rouault/projjson_0_4
Browse files Browse the repository at this point in the history
PROJJSON: support additional properties allowed in id object (version, authority_citation, uri) for parity with WKT2:2019
  • Loading branch information
a0x8o committed Sep 14, 2021
1 parent 7123c46 commit f8d0f50
Show file tree
Hide file tree
Showing 28 changed files with 2,005 additions and 226 deletions.
11 changes: 8 additions & 3 deletions data/projjson.schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$id": "https://proj.org/schemas/v0.3/projjson.schema.json",
"$id": "https://proj.org/schemas/v0.4/projjson.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Schema for PROJJSON (v0.3)",
"description": "Schema for PROJJSON (v0.4)",
"$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": [
Expand Down Expand Up @@ -612,7 +612,12 @@
"authority": { "type": "string" },
"code": {
"oneOf": [ { "type": "string" }, { "type": "integer" } ]
}
},
"version": {
"oneOf": [ { "type": "string" }, { "type": "number" } ]
},
"authority_citation": { "type": "string" },
"uri": { "type": "string" }
},
"required" : [ "authority", "code" ],
"additionalProperties": false
Expand Down
2 changes: 1 addition & 1 deletion docs/source/apps/cct.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ by :c:func:`proj_create`, provided it expresses a coordinate operation
uniqueness is not guaranteed, heuristics are applied to determine the appropriate best match.
- 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://proj.org/schemas/v0.3/projjson.schema.json
- a PROJJSON string. The jsonschema is at https://proj.org/schemas/v0.4/projjson.schema.json

.. versionadded:: 8.0.0

Expand Down
2 changes: 1 addition & 1 deletion docs/source/apps/cs2cs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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://proj.org/schemas/v0.3/projjson.schema.json (*added in 6.2*)
- a PROJJSON string. The jsonschema is at https://proj.org/schemas/v0.4/projjson.schema.json (*added in 6.2*)
- a compound CRS made from two object names separated with " + ". e.g. "WGS 84 + EGM96 height" (*added in 7.1*)

.. versionadded:: 6.0.0
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 @@ -55,7 +55,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://proj.org/schemas/v0.3/projjson.schema.json (*added in 6.2*)
- a PROJJSON string. The jsonschema is at https://proj.org/schemas/v0.4/projjson.schema.json (*added in 6.2*)
- a compound CRS made from two object names separated with " + ". e.g. "WGS 84 + EGM96 height" (*added in 7.1*)

{object_reference} is a filename preceded by the '@' character. The
Expand Down
2 changes: 1 addition & 1 deletion docs/source/development/reference/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ paragraph for more details.
syntax "EPSG:2393+5717"),
- 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://proj.org/schemas/v0.3/projjson.schema.json (*added in 6.2*)
- a PROJJSON string. The jsonschema is at https://proj.org/schemas/v0.4/projjson.schema.json (*added in 6.2*)
- a compound CRS made from two object names separated with " + ". e.g. "WGS 84 + EGM96 height" (*added in 7.1*)
Example call:
Expand Down
5 changes: 3 additions & 2 deletions docs/source/specifications/projjson.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ the same as WKT2:2019.

PROJJSON is available as input and output of PROJ since PROJ 6.2.

The current version is 0.3.
The current version is 0.4.

Schema
------

A JSON schema of its grammar is available at
https://proj.org/schemas/v0.3/projjson.schema.json
https://proj.org/schemas/v0.4/projjson.schema.json

History
-------

* v0.4: additional properties allowed in id object (version, authority_citation, uri)
* v0.3: additional properties allowed in BoundCRS object (name, scope, area, bbox, usages, remarks, id, ids)
* v0.2: addition of geoid_model in VerticalCRS object.
* v0.1: initial version for PROJ 6.2
Expand Down
4 changes: 4 additions & 0 deletions include/proj/coordinateoperation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,10 @@ class PROJ_GCC_DLL Conversion : public SingleOperation {
createGeographicGeocentric(const crs::CRSNNPtr &sourceCRS,
const crs::CRSNNPtr &targetCRS);

PROJ_INTERNAL static ConversionNNPtr
createGeographicGeocentricLatitude(const crs::CRSNNPtr &sourceCRS,
const crs::CRSNNPtr &targetCRS);

//! @endcond

protected:
Expand Down
5 changes: 5 additions & 0 deletions include/proj/coordinatesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ class PROJ_GCC_DLL SphericalCS final : public CoordinateSystem {
const CoordinateSystemAxisNNPtr &axis2,
const CoordinateSystemAxisNNPtr &axis3);

PROJ_DLL static SphericalCSNNPtr
create(const util::PropertyMap &properties,
const CoordinateSystemAxisNNPtr &axis1,
const CoordinateSystemAxisNNPtr &axis2);

protected:
PROJ_INTERNAL explicit SphericalCS(
const std::vector<CoordinateSystemAxisNNPtr> &axisIn);
Expand Down
13 changes: 8 additions & 5 deletions include/proj/crs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ class PROJ_GCC_DLL GeodeticCRS : virtual public SingleCRS,

PROJ_DLL bool isGeocentric() PROJ_PURE_DECL;

PROJ_DLL bool isSphericalPlanetocentric() PROJ_PURE_DECL;

PROJ_DLL static GeodeticCRSNNPtr
create(const util::PropertyMap &properties,
const datum::GeodeticReferenceFrameNNPtr &datum,
Expand Down Expand Up @@ -308,6 +310,9 @@ class PROJ_GCC_DLL GeodeticCRS : virtual public SingleCRS,
PROJ_INTERNAL void addGeocentricUnitConversionIntoPROJString(
io::PROJStringFormatter *formatter) const;

PROJ_INTERNAL void
addAngularUnitConvertAndAxisSwap(io::PROJStringFormatter *formatter) const;

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

Expand Down Expand Up @@ -400,12 +405,10 @@ class PROJ_GCC_DLL GeographicCRS : public GeodeticCRS {

PROJ_PRIVATE :
//! @cond Doxygen_Suppress
PROJ_INTERNAL void
addAngularUnitConvertAndAxisSwap(
io::PROJStringFormatter *formatter) const;

PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
const override; // throw(FormattingException)
PROJ_INTERNAL void
_exportToPROJString(io::PROJStringFormatter *formatter)
const override; // throw(FormattingException)

PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
const override; // throw(FormattingException)
Expand Down
3 changes: 1 addition & 2 deletions include/proj/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,7 @@ class PROJ_GCC_DLL JSONFormatter {
PROJ_INTERNAL bool
outputUsage(bool calledBeforeObjectContext = false) const;

PROJ_INTERNAL static const char *PROJJSON_v0_2;
PROJ_INTERNAL static const char *PROJJSON_v0_3;
PROJ_INTERNAL static const char *PROJJSON_v0_4;

//! @endcond

Expand Down
Loading

0 comments on commit f8d0f50

Please sign in to comment.