001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2024 Open Geospatial Consortium, Inc.
004 *    http://www.geoapi.org
005 *
006 *    Licensed under the Apache License, Version 2.0 (the "License");
007 *    you may not use this file except in compliance with the License.
008 *    You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *    Unless required by applicable law or agreed to in writing, software
013 *    distributed under the License is distributed on an "AS IS" BASIS,
014 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 *    See the License for the specific language governing permissions and
016 *    limitations under the License.
017 */
018package org.opengis.coordinate;
019
020import java.util.Optional;
021import java.time.temporal.Temporal;
022import org.opengis.referencing.crs.CoordinateReferenceSystem;
023import org.opengis.annotation.UML;
024
025import static org.opengis.annotation.Obligation.*;
026import static org.opengis.annotation.Specification.*;
027
028
029/**
030 * Metadata required to reference coordinates.
031 * A {@linkplain CoordinateReferenceSystem coordinate reference system} (<abbr>CRS</abbr>) is mandatory.
032 * If the <abbr>CRS</abbr> is dynamic, then a coordinate epoch is also mandatory.
033 * Whether the <abbr>CRS</abbr> is dynamic is determined through the <abbr>CRS</abbr>'s reference frame definition.
034 *
035 * @author  OGC Topic 2 (for abstract model and documentation)
036 * @author  Martin Desruisseaux (Geomatys)
037 * @version 3.1
038 * @since   3.1
039 */
040@UML(identifier="CoordinateMetadata", specification=ISO_19111)
041public interface CoordinateMetadata {
042    /**
043     * The coordinate reference system (<abbr>CRS</abbr>) in which the coordinate tuples are given.
044     *
045     * @departure easeOfUse
046     *   The ISO specification defines two conditional attributes: an identifier ({@code crsID}) or an association
047     *   to a <abbr>CRS</abbr> object ({@code crs}), with the requirement that at least one of them shall be supplied.
048     *   GeoAPI retains only the latter for client applications ease of use, therefor making this attribute mandatory.
049     *   Implementers shall resolve identifiers, for example using {@link org.opengis.referencing.crs.CRSAuthorityFactory}.
050     *
051     * @return the coordinate reference system (CRS) of coordinate tuples.
052     */
053    @UML(identifier="crs", obligation=MANDATORY, specification=ISO_19111)
054    CoordinateReferenceSystem getCoordinateReferenceSystem();
055
056    /**
057     * Date at which coordinate tuples referenced to a dynamic <abbr>CRS</abbr> are valid.
058     * It should be an object from the {@link java.time} package such as {@link java.time.Instant}.
059     * This attribute is required if the <abbr>CRS</abbr> is dynamic.
060     *
061     * <h4>Temporal object type</h4>
062     * The type of the returned object depends on the epoch accuracy and the calendar in use.
063     * For coordinates on Earth, the temporal type should be {@link java.time.Year} if the epoch is merely a year,
064     * {@link java.time.YearMonth} or {@link java.time.LocalDate} if a better precision is available,
065     * up to {@link java.time.OffsetDateTime} or {@link java.time.Instant} for maximal precision.
066     * For coordinates on another planet, the time measurement may use a non-Gregorian calendar.
067     * In the latter case, the type of the returned temporal object is currently implementation dependent.
068     *
069     * @departure integration
070     *   The ISO specification uses a decimal year in the Gregorian calendar.
071     *   For example, 2017-03-25 in the Gregorian calendar is epoch 2017.23.
072     *   GeoAPI delegates to the Java time package instead.
073     *
074     * @return epoch at which coordinate tuples are valid.
075     *
076     * @see org.opengis.referencing.datum.DynamicReferenceFrame#getFrameReferenceEpoch()
077     */
078    @UML(identifier="coordinateEpoch", obligation=CONDITIONAL, specification=ISO_19111)
079    default Optional<Temporal> getCoordinateEpoch() {
080        return Optional.empty();
081    }
082}