This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sis-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 066cfb0b Add an "How to" about building a 4-dimensional CRS.
066cfb0b is described below

commit 066cfb0bad4968ddfbd38db0010a4c6feac5db0d
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Wed Mar 6 16:45:01 2024 +0100

    Add an "How to" about building a 4-dimensional CRS.
---
 content/howto/_index.md       |  1 +
 content/howto/compound_crs.md | 90 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+)

diff --git a/content/howto/_index.md b/content/howto/_index.md
index beddeb14..919718be 100644
--- a/content/howto/_index.md
+++ b/content/howto/_index.md
@@ -26,6 +26,7 @@ The examples are grouped in the following sections:
 * [Instantiate a Universal Transverse Mercator (UTM) 
projection](howto/instantiate_utm_projection.html)
 * [Instantiate a Pseudo Mercator (a.k.a. Google) projection](faq.html#google)
 * [Get the EPSG code or URN of an existing reference 
system](howto/lookup_crs_urn.html)
+* [Add vertical and temporal axes to an horizontal 
CRS](howto/compound_crs.html)
 * [Transform points between two reference 
systems](howto/transform_coordinates.html)
 * [Transform envelopes between two reference 
systems](howto/transform_envelopes.html)
 * [Parse and format MGRS codes](howto/parse_and_format_mgrs_codes.html)
diff --git a/content/howto/compound_crs.md b/content/howto/compound_crs.md
new file mode 100644
index 00000000..51272ff6
--- /dev/null
+++ b/content/howto/compound_crs.md
@@ -0,0 +1,90 @@
+---
+title: Add vertical and temporal axes to an horizontal CRS
+---
+
+This example creates a 4-dimensional Coordinate Reference System (CRS)
+with an horizontal, a vertical and a temporal component.
+While it is possible to create a `CompoundCRS` programmatically,
+it is much easier to do that from authority codes when those codes exist.
+There is two syntaxes standardized by the Open Geospatial Consortium (OGC):
+One syntax using an identifier starting with 
`http://www.opengis.net/def/crs-compound`
+followed by the components in the query part of the URL,
+and a shorter but less common syntax starting with `urn:ogc:def:crs`.
+Apache SIS accepts both, illustrated below.
+
+
+
+# Direct dependencies
+
+Maven coordinates                           | Module info
+------------------------------------------- | ----------------------------
+`org.apache.sis.storage:sis-referencing`    | `org.apache.sis.referencing`
+
+
+# Code example
+
+```java
+import org.apache.sis.referencing.CRS;
+
+public class Compound {
+    /**
+     * Demo entry point.
+     *
+     * @param  args  ignored.
+     * @throws FactoryException if an error occurred while creating the CRS
+     *         or searching for a coordinate operation.
+     */
+    public static void main(String[] args) throws FactoryException {
+        var crs = CRS.forCode(
+                "http://www.opengis.net/def/crs-compound?"+
+                "1=http://www.opengis.net/def/crs/epsg/0/4326&"+
+                "2=http://www.opengis.net/def/crs/epsg/0/5714&"; +
+                "3=http://www.opengis.net/def/crs/OGC/0/JulianDate";);
+        /*
+         * The following is a more compact way to request the same CRS.
+         * If (longitude, latitude) axis order is desired, just replace
+         * "EPSG::4326" by "OGC::84".
+         */
+        var alternative = 
CRS.forCode("urn:ogc:def:crs,crs:EPSG::4326,crs:EPSG::5714,crs:OGC::JulianDate");
+
+        System.out.println(crs);
+        System.out.println();
+        System.out.println("Compact alternative is equal: " + 
crs.equals(alternative));
+    }
+}
+```
+
+Alternatively, if the components are already available as 
`CoordinateReferenceSystem` object, the
+[compound 
method](../apidocs/org.apache.sis.referencing/org/apache/sis/referencing/CRS.html#compound(org.opengis.referencing.crs.CoordinateReferenceSystem...))
+can be invoked instead.
+
+
+# Output
+
+```
+CompoundCRS["WGS 84 + MSL height + Julian",
+  GeodeticCRS["WGS 84",
+    Datum["World Geodetic System 1984",
+      Ellipsoid["WGS 84", 6378137.0, 298.257223563]],
+    CS[ellipsoidal, 2],
+      Axis["Geodetic latitude (Lat)", north],
+      Axis["Geodetic longitude (Lon)", east],
+      Unit["degree", 0.017453292519943295],
+    Id["EPSG", 4326, "9.9.1"]],
+  VerticalCRS["MSL height",
+    VerticalDatum["Mean Sea Level"],
+    CS[vertical, 1],
+      Axis["Gravity-related height (H)", up],
+      Unit["metre", 1],
+    Id["EPSG", 5714, "9.9.1"]],
+  TimeCRS["Julian",
+    TimeDatum["Julian", TimeOrigin[-4713-11-24T12:00:00.000]],
+    CS[temporal, 1],
+      Axis["Time (t)", future],
+      TimeUnit["day", 86400],
+    Id["OGC", "JulianDate"]],
+  Area["World."],
+  BBox[-90.00, -180.00, 90.00, 180.00]]
+
+Compact alternative is equal: true
+```

Reply via email to