Coverage Report

Created: 2024-02-25 06:14

/src/PROJ/include/proj/coordinateoperation.hpp
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  PROJ
4
 * Purpose:  ISO19111:2019 implementation
5
 * Author:   Even Rouault <even dot rouault at spatialys dot com>
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2018, Even Rouault <even dot rouault at spatialys dot com>
9
 *
10
 * Permission is hereby granted, free of charge, to any person obtaining a
11
 * copy of this software and associated documentation files (the "Software"),
12
 * to deal in the Software without restriction, including without limitation
13
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14
 * and/or sell copies of the Software, and to permit persons to whom the
15
 * Software is furnished to do so, subject to the following conditions:
16
 *
17
 * The above copyright notice and this permission notice shall be included
18
 * in all copies or substantial portions of the Software.
19
 *
20
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26
 * DEALINGS IN THE SOFTWARE.
27
 ****************************************************************************/
28
29
#ifndef COORDINATEOPERATION_HH_INCLUDED
30
#define COORDINATEOPERATION_HH_INCLUDED
31
32
#include <memory>
33
#include <string>
34
#include <utility>
35
#include <vector>
36
37
#include "common.hpp"
38
#include "io.hpp"
39
#include "metadata.hpp"
40
41
#include "proj.h"
42
43
NS_PROJ_START
44
45
namespace crs {
46
class CRS;
47
using CRSPtr = std::shared_ptr<CRS>;
48
using CRSNNPtr = util::nn<CRSPtr>;
49
50
class DerivedCRS;
51
class ProjectedCRS;
52
} // namespace crs
53
54
namespace io {
55
class JSONParser;
56
} // namespace io
57
58
namespace coordinates {
59
class CoordinateMetadata;
60
using CoordinateMetadataPtr = std::shared_ptr<CoordinateMetadata>;
61
using CoordinateMetadataNNPtr = util::nn<CoordinateMetadataPtr>;
62
} // namespace coordinates
63
64
/** osgeo.proj.operation namespace
65
66
  \brief Coordinate operations (relationship between any two coordinate
67
  reference systems).
68
69
  This covers Conversion, Transformation,
70
  PointMotionOperation or ConcatenatedOperation.
71
*/
72
namespace operation {
73
74
// ---------------------------------------------------------------------------
75
76
/** \brief Grid description */
77
struct GridDescription {
78
    std::string shortName;   /**< Grid short filename */
79
    std::string fullName;    /**< Grid full path name (if found) */
80
    std::string packageName; /**< Package name (or empty) */
81
    std::string url;         /**< Grid URL (if packageName is empty), or package
82
                                    URL (or empty) */
83
    bool directDownload;     /**< Whether url can be fetched directly. */
84
    /** Whether the grid is released with an open license. */
85
    bool openLicense;
86
    bool available; /**< Whether GRID is available. */
87
88
    //! @cond Doxygen_Suppress
89
117k
    bool operator<(const GridDescription &other) const {
90
117k
        return shortName < other.shortName;
91
117k
    }
92
93
    PROJ_DLL GridDescription();
94
    PROJ_DLL ~GridDescription();
95
    PROJ_DLL GridDescription(const GridDescription &);
96
    PROJ_DLL GridDescription(GridDescription &&) noexcept;
97
    //! @endcond
98
};
99
100
// ---------------------------------------------------------------------------
101
102
class CoordinateOperation;
103
/** Shared pointer of CoordinateOperation */
104
using CoordinateOperationPtr = std::shared_ptr<CoordinateOperation>;
105
/** Non-null shared pointer of CoordinateOperation */
106
using CoordinateOperationNNPtr = util::nn<CoordinateOperationPtr>;
107
108
// ---------------------------------------------------------------------------
109
110
class CoordinateTransformer;
111
/** Shared pointer of CoordinateTransformer */
112
using CoordinateTransformerPtr = std::unique_ptr<CoordinateTransformer>;
113
/** Non-null shared pointer of CoordinateTransformer */
114
using CoordinateTransformerNNPtr = util::nn<CoordinateTransformerPtr>;
115
116
/** \brief Coordinate transformer.
117
 *
118
 * Performs coordinate transformation of coordinate tuplies.
119
 *
120
 * @since 9.3
121
 */
122
class PROJ_GCC_DLL CoordinateTransformer {
123
  public:
124
    //! @cond Doxygen_Suppress
125
    PROJ_DLL ~CoordinateTransformer();
126
    //! @endcond
127
128
    PROJ_DLL PJ_COORD transform(PJ_COORD coord);
129
130
  protected:
131
    PROJ_FRIEND(CoordinateOperation);
132
133
    PROJ_INTERNAL CoordinateTransformer();
134
135
    PROJ_INTERNAL static CoordinateTransformerNNPtr
136
    create(const CoordinateOperationNNPtr &op, PJ_CONTEXT *ctx);
137
138
  private:
139
    PROJ_OPAQUE_PRIVATE_DATA
140
    INLINED_MAKE_UNIQUE
141
    CoordinateTransformer &
142
    operator=(const CoordinateTransformer &other) = delete;
143
};
144
145
// ---------------------------------------------------------------------------
146
147
class Transformation;
148
/** Shared pointer of Transformation */
149
using TransformationPtr = std::shared_ptr<Transformation>;
150
/** Non-null shared pointer of Transformation */
151
using TransformationNNPtr = util::nn<TransformationPtr>;
152
153
/** \brief Abstract class for a mathematical operation on coordinates.
154
 *
155
 * A mathematical operation:
156
 * <ul>
157
 * <li>on coordinates that transforms or converts them from one coordinate
158
 * reference system to another coordinate reference system</li>
159
 * <li>or that describes the change of coordinate values within one coordinate
160
 * reference system due to the motion of the point between one coordinate epoch
161
 * and another coordinate epoch.</li>
162
 * </ul>
163
 * Many but not all coordinate operations (from CRS A to CRS B) also uniquely
164
 * define the inverse coordinate operation (from CRS B to CRS A). In some cases,
165
 * the coordinate operation method algorithm for the inverse coordinate
166
 * operation is the same as for the forward algorithm, but the signs of some
167
 * coordinate operation parameter values have to be reversed. In other cases,
168
 * different algorithms are required for the forward and inverse coordinate
169
 * operations, but the same coordinate operation parameter values are used. If
170
 * (some) entirely different parameter values are needed, a different coordinate
171
 * operation shall be defined.
172
 *
173
 * \remark Implements CoordinateOperation from \ref ISO_19111_2019
174
 */
175
class PROJ_GCC_DLL CoordinateOperation : public common::ObjectUsage,
176
                                         public io::IPROJStringExportable,
177
                                         public io::IJSONExportable {
178
  public:
179
    //! @cond Doxygen_Suppress
180
    PROJ_DLL ~CoordinateOperation() override;
181
    //! @endcond
182
183
    PROJ_DLL const util::optional<std::string> &operationVersion() const;
184
    PROJ_DLL const std::vector<metadata::PositionalAccuracyNNPtr> &
185
    coordinateOperationAccuracies() const;
186
187
    PROJ_DLL const crs::CRSPtr sourceCRS() const;
188
    PROJ_DLL const crs::CRSPtr targetCRS() const;
189
    PROJ_DLL const crs::CRSPtr &interpolationCRS() const;
190
    PROJ_DLL const util::optional<common::DataEpoch> &
191
    sourceCoordinateEpoch() const;
192
    PROJ_DLL const util::optional<common::DataEpoch> &
193
    targetCoordinateEpoch() const;
194
195
    PROJ_DLL CoordinateTransformerNNPtr
196
    coordinateTransformer(PJ_CONTEXT *ctx) const;
197
198
    /** \brief Return the inverse of the coordinate operation.
199
     * @throw util::UnsupportedOperationException
200
     */
201
    PROJ_DLL virtual CoordinateOperationNNPtr inverse() const = 0;
202
203
    /** \brief Return grids needed by an operation. */
204
    PROJ_DLL virtual std::set<GridDescription>
205
    gridsNeeded(const io::DatabaseContextPtr &databaseContext,
206
                bool considerKnownGridsAsAvailable) const = 0;
207
208
    PROJ_DLL bool
209
    isPROJInstantiable(const io::DatabaseContextPtr &databaseContext,
210
                       bool considerKnownGridsAsAvailable) const;
211
212
    PROJ_DLL bool hasBallparkTransformation() const;
213
214
    PROJ_DLL static const std::string OPERATION_VERSION_KEY;
215
216
    PROJ_DLL CoordinateOperationNNPtr normalizeForVisualization() const;
217
218
    PROJ_PRIVATE :
219
        //! @cond Doxygen_Suppress
220
        PROJ_FOR_TEST CoordinateOperationNNPtr
221
        shallowClone() const;
222
    //! @endcond
223
224
  protected:
225
    PROJ_INTERNAL CoordinateOperation();
226
    PROJ_INTERNAL CoordinateOperation(const CoordinateOperation &other);
227
228
    PROJ_FRIEND(crs::DerivedCRS);
229
    PROJ_FRIEND(io::AuthorityFactory);
230
    PROJ_FRIEND(CoordinateOperationFactory);
231
    PROJ_FRIEND(ConcatenatedOperation);
232
    PROJ_FRIEND(io::WKTParser);
233
    PROJ_FRIEND(io::JSONParser);
234
    PROJ_INTERNAL void
235
    setWeakSourceTargetCRS(std::weak_ptr<crs::CRS> sourceCRSIn,
236
                           std::weak_ptr<crs::CRS> targetCRSIn);
237
    PROJ_INTERNAL void setCRSs(const crs::CRSNNPtr &sourceCRSIn,
238
                               const crs::CRSNNPtr &targetCRSIn,
239
                               const crs::CRSPtr &interpolationCRSIn);
240
    PROJ_INTERNAL void
241
    setInterpolationCRS(const crs::CRSPtr &interpolationCRSIn);
242
    PROJ_INTERNAL void setCRSs(const CoordinateOperation *in,
243
                               bool inverseSourceTarget);
244
    PROJ_INTERNAL
245
    void setAccuracies(
246
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
247
    PROJ_INTERNAL void setHasBallparkTransformation(bool b);
248
249
    PROJ_INTERNAL void
250
    setSourceCoordinateEpoch(const util::optional<common::DataEpoch> &epoch);
251
    PROJ_INTERNAL void
252
    setTargetCoordinateEpoch(const util::optional<common::DataEpoch> &epoch);
253
254
    PROJ_INTERNAL void
255
    setProperties(const util::PropertyMap
256
                      &properties); // throw(InvalidValueTypeException)
257
258
    PROJ_INTERNAL virtual CoordinateOperationNNPtr _shallowClone() const = 0;
259
260
  private:
261
    PROJ_OPAQUE_PRIVATE_DATA
262
    CoordinateOperation &operator=(const CoordinateOperation &other) = delete;
263
};
264
265
// ---------------------------------------------------------------------------
266
267
/** \brief Abstract class modelling a parameter value (OperationParameter)
268
 * or group of parameters.
269
 *
270
 * \remark Implements GeneralOperationParameter from \ref ISO_19111_2019
271
 */
272
class PROJ_GCC_DLL GeneralOperationParameter : public common::IdentifiedObject {
273
  public:
274
    //! @cond Doxygen_Suppress
275
    PROJ_DLL ~GeneralOperationParameter() override;
276
    //! @endcond
277
278
    //! @cond Doxygen_Suppress
279
    PROJ_INTERNAL bool _isEquivalentTo(
280
        const util::IComparable *other,
281
        util::IComparable::Criterion criterion =
282
            util::IComparable::Criterion::STRICT,
283
        const io::DatabaseContextPtr &dbContext = nullptr) const override = 0;
284
    //! @endcond
285
286
  protected:
287
    PROJ_INTERNAL GeneralOperationParameter();
288
    PROJ_INTERNAL
289
    GeneralOperationParameter(const GeneralOperationParameter &other);
290
291
  private:
292
    PROJ_OPAQUE_PRIVATE_DATA
293
    GeneralOperationParameter &
294
    operator=(const GeneralOperationParameter &other) = delete;
295
};
296
297
/** Shared pointer of GeneralOperationParameter */
298
using GeneralOperationParameterPtr = std::shared_ptr<GeneralOperationParameter>;
299
/** Non-null shared pointer of GeneralOperationParameter */
300
using GeneralOperationParameterNNPtr = util::nn<GeneralOperationParameterPtr>;
301
302
// ---------------------------------------------------------------------------
303
304
class OperationParameter;
305
/** Shared pointer of OperationParameter */
306
using OperationParameterPtr = std::shared_ptr<OperationParameter>;
307
/** Non-null shared pointer of OperationParameter */
308
using OperationParameterNNPtr = util::nn<OperationParameterPtr>;
309
310
/** \brief The definition of a parameter used by a coordinate operation method.
311
 *
312
 * Most parameter values are numeric, but other types of parameter values are
313
 * possible.
314
 *
315
 * \remark Implements OperationParameter from \ref ISO_19111_2019
316
 */
317
class PROJ_GCC_DLL OperationParameter final : public GeneralOperationParameter {
318
  public:
319
    //! @cond Doxygen_Suppress
320
    PROJ_DLL ~OperationParameter() override;
321
    //! @endcond
322
323
    //! @cond Doxygen_Suppress
324
    PROJ_INTERNAL bool _isEquivalentTo(
325
        const util::IComparable *other,
326
        util::IComparable::Criterion criterion =
327
            util::IComparable::Criterion::STRICT,
328
        const io::DatabaseContextPtr &dbContext = nullptr) const override;
329
    //! @endcond
330
331
    // non-standard
332
    PROJ_DLL static OperationParameterNNPtr
333
    create(const util::PropertyMap &properties);
334
335
    PROJ_DLL int getEPSGCode() PROJ_PURE_DECL;
336
337
    PROJ_DLL static const char *getNameForEPSGCode(int epsg_code) noexcept;
338
339
  protected:
340
    PROJ_INTERNAL OperationParameter();
341
    PROJ_INTERNAL OperationParameter(const OperationParameter &other);
342
    INLINED_MAKE_SHARED
343
344
  private:
345
    PROJ_OPAQUE_PRIVATE_DATA
346
    OperationParameter &operator=(const OperationParameter &other) = delete;
347
348
    // cppcheck-suppress functionStatic
349
    PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
350
        const override; // throw(io::FormattingException)
351
};
352
353
// ---------------------------------------------------------------------------
354
355
//! @cond Doxygen_Suppress
356
struct MethodMapping;
357
//! @endcond
358
359
/** \brief Abstract class modelling a parameter value (OperationParameterValue)
360
 * or group of parameter values.
361
 *
362
 * \remark Implements GeneralParameterValue from \ref ISO_19111_2019
363
 */
364
class PROJ_GCC_DLL GeneralParameterValue : public util::BaseObject,
365
                                           public io::IWKTExportable,
366
                                           public io::IJSONExportable,
367
                                           public util::IComparable {
368
  public:
369
    //! @cond Doxygen_Suppress
370
    PROJ_DLL ~GeneralParameterValue() override;
371
372
    PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
373
        const override = 0; // throw(io::FormattingException)
374
375
    PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
376
        const override = 0; // throw(FormattingException)
377
378
    PROJ_INTERNAL bool _isEquivalentTo(
379
        const util::IComparable *other,
380
        util::IComparable::Criterion criterion =
381
            util::IComparable::Criterion::STRICT,
382
        const io::DatabaseContextPtr &dbContext = nullptr) const override = 0;
383
    //! @endcond
384
385
  protected:
386
    //! @cond Doxygen_Suppress
387
    PROJ_INTERNAL GeneralParameterValue();
388
    PROJ_INTERNAL GeneralParameterValue(const GeneralParameterValue &other);
389
390
    friend class Conversion;
391
    friend class SingleOperation;
392
    friend class PointMotionOperation;
393
    PROJ_INTERNAL virtual void _exportToWKT(io::WKTFormatter *formatter,
394
                                            const MethodMapping *mapping)
395
        const = 0; // throw(io::FormattingException)
396
                   //! @endcond
397
398
  private:
399
    PROJ_OPAQUE_PRIVATE_DATA
400
    GeneralParameterValue &
401
    operator=(const GeneralParameterValue &other) = delete;
402
};
403
404
/** Shared pointer of GeneralParameterValue */
405
using GeneralParameterValuePtr = std::shared_ptr<GeneralParameterValue>;
406
/** Non-null shared pointer of GeneralParameterValue */
407
using GeneralParameterValueNNPtr = util::nn<GeneralParameterValuePtr>;
408
409
// ---------------------------------------------------------------------------
410
411
class ParameterValue;
412
/** Shared pointer of ParameterValue */
413
using ParameterValuePtr = std::shared_ptr<ParameterValue>;
414
/** Non-null shared pointer of ParameterValue */
415
using ParameterValueNNPtr = util::nn<ParameterValuePtr>;
416
417
/** \brief The value of the coordinate operation parameter.
418
 *
419
 * Most parameter values are numeric, but other types of parameter values are
420
 * possible.
421
 *
422
 * \remark Implements ParameterValue from \ref ISO_19111_2019
423
 */
424
class PROJ_GCC_DLL ParameterValue final : public util::BaseObject,
425
                                          public io::IWKTExportable,
426
                                          public util::IComparable {
427
  public:
428
    /** Type of the value. */
429
    enum class Type {
430
        /** Measure (i.e. value with a unit) */
431
        MEASURE,
432
        /** String */
433
        STRING,
434
        /** Integer */
435
        INTEGER,
436
        /** Boolean */
437
        BOOLEAN,
438
        /** Filename */
439
        FILENAME
440
    };
441
    //! @cond Doxygen_Suppress
442
    PROJ_DLL ~ParameterValue() override;
443
444
    PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
445
        const override; // throw(io::FormattingException)
446
    //! @endcond
447
448
    PROJ_DLL static ParameterValueNNPtr
449
    create(const common::Measure &measureIn);
450
    PROJ_DLL static ParameterValueNNPtr create(const char *stringValueIn);
451
    PROJ_DLL static ParameterValueNNPtr
452
    create(const std::string &stringValueIn);
453
    PROJ_DLL static ParameterValueNNPtr create(int integerValueIn);
454
    PROJ_DLL static ParameterValueNNPtr create(bool booleanValueIn);
455
    PROJ_DLL static ParameterValueNNPtr
456
    createFilename(const std::string &stringValueIn);
457
458
    PROJ_DLL const Type &type() PROJ_PURE_DECL;
459
    PROJ_DLL const common::Measure &value() PROJ_PURE_DECL;
460
    PROJ_DLL const std::string &stringValue() PROJ_PURE_DECL;
461
    PROJ_DLL const std::string &valueFile() PROJ_PURE_DECL;
462
    PROJ_DLL int integerValue() PROJ_PURE_DECL;
463
    PROJ_DLL bool booleanValue() PROJ_PURE_DECL;
464
465
    //! @cond Doxygen_Suppress
466
    PROJ_INTERNAL bool _isEquivalentTo(
467
        const util::IComparable *other,
468
        util::IComparable::Criterion criterion =
469
            util::IComparable::Criterion::STRICT,
470
        const io::DatabaseContextPtr &dbContext = nullptr) const override;
471
    //! @endcond
472
473
  protected:
474
    PROJ_INTERNAL explicit ParameterValue(const common::Measure &measureIn);
475
    PROJ_INTERNAL explicit ParameterValue(const std::string &stringValueIn,
476
                                          Type typeIn);
477
    PROJ_INTERNAL explicit ParameterValue(int integerValueIn);
478
    PROJ_INTERNAL explicit ParameterValue(bool booleanValueIn);
479
    INLINED_MAKE_SHARED
480
  private:
481
    PROJ_OPAQUE_PRIVATE_DATA
482
    ParameterValue &operator=(const ParameterValue &other) = delete;
483
};
484
485
// ---------------------------------------------------------------------------
486
487
class OperationParameterValue;
488
/** Shared pointer of OperationParameterValue */
489
using OperationParameterValuePtr = std::shared_ptr<OperationParameterValue>;
490
/** Non-null shared pointer of OperationParameterValue */
491
using OperationParameterValueNNPtr = util::nn<OperationParameterValuePtr>;
492
493
/** \brief A parameter value, ordered sequence of values, or reference to a
494
 * file of parameter values.
495
 *
496
 * This combines a OperationParameter with the corresponding ParameterValue.
497
 *
498
 * \remark Implements OperationParameterValue from \ref ISO_19111_2019
499
 */
500
class PROJ_GCC_DLL OperationParameterValue final
501
    : public GeneralParameterValue {
502
  public:
503
    //! @cond Doxygen_Suppress
504
    PROJ_DLL ~OperationParameterValue() override;
505
    //! @endcond
506
507
    PROJ_DLL const OperationParameterNNPtr &parameter() PROJ_PURE_DECL;
508
    PROJ_DLL const ParameterValueNNPtr &parameterValue() PROJ_PURE_DECL;
509
510
    PROJ_DLL static OperationParameterValueNNPtr
511
    create(const OperationParameterNNPtr &parameterIn,
512
           const ParameterValueNNPtr &valueIn);
513
514
    PROJ_PRIVATE :
515
        //! @cond Doxygen_Suppress
516
        PROJ_INTERNAL static bool
517
        convertFromAbridged(const std::string &paramName, double &val,
518
                            const common::UnitOfMeasure *&unit,
519
                            int &paramEPSGCode);
520
521
    PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
522
        const override; // throw(io::FormattingException)
523
524
    PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
525
        const override; // throw(FormattingException)
526
527
    PROJ_INTERNAL bool _isEquivalentTo(
528
        const util::IComparable *other,
529
        util::IComparable::Criterion criterion =
530
            util::IComparable::Criterion::STRICT,
531
        const io::DatabaseContextPtr &dbContext = nullptr) const override;
532
    //! @endcond
533
534
  protected:
535
    PROJ_INTERNAL
536
    OperationParameterValue(const OperationParameterNNPtr &parameterIn,
537
                            const ParameterValueNNPtr &valueIn);
538
    PROJ_INTERNAL OperationParameterValue(const OperationParameterValue &other);
539
    INLINED_MAKE_SHARED
540
541
    PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter,
542
                                    const MethodMapping *mapping)
543
        const override; // throw(io::FormattingException)
544
545
  private:
546
    PROJ_OPAQUE_PRIVATE_DATA
547
    OperationParameterValue &
548
    operator=(const OperationParameterValue &other) = delete;
549
};
550
551
// ---------------------------------------------------------------------------
552
553
class OperationMethod;
554
/** Shared pointer of OperationMethod */
555
using OperationMethodPtr = std::shared_ptr<OperationMethod>;
556
/** Non-null shared pointer of OperationMethod */
557
using OperationMethodNNPtr = util::nn<OperationMethodPtr>;
558
559
/** \brief The method (algorithm or procedure) used to perform the
560
 * coordinate operation.
561
 *
562
 * For a projection method, this contains the name of the projection method
563
 * and the name of the projection parameters.
564
 *
565
 * \remark Implements OperationMethod from \ref ISO_19111_2019
566
 */
567
class PROJ_GCC_DLL OperationMethod : public common::IdentifiedObject,
568
                                     public io::IJSONExportable {
569
  public:
570
    //! @cond Doxygen_Suppress
571
    PROJ_DLL ~OperationMethod() override;
572
    //! @endcond
573
574
    PROJ_DLL const util::optional<std::string> &formula() PROJ_PURE_DECL;
575
    PROJ_DLL const util::optional<metadata::Citation> &
576
    formulaCitation() PROJ_PURE_DECL;
577
    PROJ_DLL const std::vector<GeneralOperationParameterNNPtr> &
578
    parameters() PROJ_PURE_DECL;
579
580
    PROJ_DLL static OperationMethodNNPtr
581
    create(const util::PropertyMap &properties,
582
           const std::vector<GeneralOperationParameterNNPtr> &parameters);
583
584
    PROJ_DLL static OperationMethodNNPtr
585
    create(const util::PropertyMap &properties,
586
           const std::vector<OperationParameterNNPtr> &parameters);
587
588
    PROJ_DLL int getEPSGCode() PROJ_PURE_DECL;
589
590
    //! @cond Doxygen_Suppress
591
    PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
592
        const override; // throw(io::FormattingException)
593
594
    PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
595
        const override; // throw(FormattingException)
596
597
    PROJ_INTERNAL bool _isEquivalentTo(
598
        const util::IComparable *other,
599
        util::IComparable::Criterion criterion =
600
            util::IComparable::Criterion::STRICT,
601
        const io::DatabaseContextPtr &dbContext = nullptr) const override;
602
    //! @endcond
603
604
  protected:
605
    PROJ_INTERNAL OperationMethod();
606
    PROJ_INTERNAL OperationMethod(const OperationMethod &other);
607
    INLINED_MAKE_SHARED
608
    friend class Conversion;
609
610
  private:
611
    PROJ_OPAQUE_PRIVATE_DATA
612
    OperationMethod &operator=(const OperationMethod &other) = delete;
613
};
614
615
// ---------------------------------------------------------------------------
616
617
/** \brief Exception that can be thrown when an invalid operation is attempted
618
 * to be constructed.
619
 */
620
class PROJ_GCC_DLL InvalidOperation : public util::Exception {
621
  public:
622
    //! @cond Doxygen_Suppress
623
    PROJ_INTERNAL explicit InvalidOperation(const char *message);
624
    PROJ_INTERNAL explicit InvalidOperation(const std::string &message);
625
    PROJ_DLL InvalidOperation(const InvalidOperation &other);
626
    PROJ_DLL ~InvalidOperation() override;
627
    //! @endcond
628
};
629
630
// ---------------------------------------------------------------------------
631
632
class SingleOperation;
633
/** Shared pointer of SingleOperation */
634
using SingleOperationPtr = std::shared_ptr<SingleOperation>;
635
/** Non-null shared pointer of SingleOperation */
636
using SingleOperationNNPtr = util::nn<SingleOperationPtr>;
637
638
/** \brief A single (not concatenated) coordinate operation
639
 * (CoordinateOperation)
640
 *
641
 * \remark Implements SingleOperation from \ref ISO_19111_2019
642
 */
643
class PROJ_GCC_DLL SingleOperation : virtual public CoordinateOperation {
644
  public:
645
    //! @cond Doxygen_Suppress
646
    PROJ_DLL ~SingleOperation() override;
647
    //! @endcond
648
649
    PROJ_DLL const std::vector<GeneralParameterValueNNPtr> &
650
    parameterValues() PROJ_PURE_DECL;
651
    PROJ_DLL const OperationMethodNNPtr &method() PROJ_PURE_DECL;
652
653
    PROJ_DLL const ParameterValuePtr &
654
    parameterValue(const std::string &paramName,
655
                   int epsg_code = 0) const noexcept;
656
657
    PROJ_DLL const ParameterValuePtr &
658
    parameterValue(int epsg_code) const noexcept;
659
660
    PROJ_DLL const common::Measure &
661
    parameterValueMeasure(const std::string &paramName,
662
                          int epsg_code = 0) const noexcept;
663
664
    PROJ_DLL const common::Measure &
665
    parameterValueMeasure(int epsg_code) const noexcept;
666
667
    PROJ_DLL static SingleOperationNNPtr createPROJBased(
668
        const util::PropertyMap &properties, const std::string &PROJString,
669
        const crs::CRSPtr &sourceCRS, const crs::CRSPtr &targetCRS,
670
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies =
671
            std::vector<metadata::PositionalAccuracyNNPtr>());
672
673
    PROJ_DLL std::set<GridDescription>
674
    gridsNeeded(const io::DatabaseContextPtr &databaseContext,
675
                bool considerKnownGridsAsAvailable) const override;
676
677
    PROJ_DLL std::list<std::string> validateParameters() const;
678
679
    PROJ_DLL TransformationNNPtr substitutePROJAlternativeGridNames(
680
        io::DatabaseContextNNPtr databaseContext) const;
681
682
    PROJ_PRIVATE :
683
        //! @cond Doxygen_Suppress
684
685
        PROJ_DLL double
686
        parameterValueNumeric(
687
            int epsg_code,
688
            const common::UnitOfMeasure &targetUnit) const noexcept;
689
690
    PROJ_INTERNAL double parameterValueNumeric(
691
        const char *param_name,
692
        const common::UnitOfMeasure &targetUnit) const noexcept;
693
694
    PROJ_INTERNAL double
695
    parameterValueNumericAsSI(int epsg_code) const noexcept;
696
697
    PROJ_INTERNAL bool _isEquivalentTo(
698
        const util::IComparable *other,
699
        util::IComparable::Criterion criterion =
700
            util::IComparable::Criterion::STRICT,
701
        const io::DatabaseContextPtr &dbContext = nullptr) const override;
702
703
    PROJ_INTERNAL bool isLongitudeRotation() const;
704
705
    //! @endcond
706
707
  protected:
708
    PROJ_INTERNAL explicit SingleOperation(
709
        const OperationMethodNNPtr &methodIn);
710
    PROJ_INTERNAL SingleOperation(const SingleOperation &other);
711
712
    PROJ_INTERNAL void
713
    setParameterValues(const std::vector<GeneralParameterValueNNPtr> &values);
714
715
    PROJ_INTERNAL void
716
    exportTransformationToWKT(io::WKTFormatter *formatter) const;
717
718
    PROJ_INTERNAL bool
719
    exportToPROJStringGeneric(io::PROJStringFormatter *formatter) const;
720
721
    PROJ_INTERNAL bool _isEquivalentTo(const util::IComparable *other,
722
                                       util::IComparable::Criterion criterion,
723
                                       const io::DatabaseContextPtr &dbContext,
724
                                       bool inOtherDirection) const;
725
726
    PROJ_INTERNAL static GeneralParameterValueNNPtr
727
    createOperationParameterValueFromInterpolationCRS(int methodEPSGCode,
728
                                                      int crsEPSGCode);
729
730
    PROJ_INTERNAL static void
731
    exportToPROJStringChangeVerticalUnit(io::PROJStringFormatter *formatter,
732
                                         double convFactor);
733
734
  private:
735
    PROJ_OPAQUE_PRIVATE_DATA
736
    SingleOperation &operator=(const SingleOperation &other) = delete;
737
};
738
739
// ---------------------------------------------------------------------------
740
741
class Conversion;
742
/** Shared pointer of Conversion */
743
using ConversionPtr = std::shared_ptr<Conversion>;
744
/** Non-null shared pointer of Conversion */
745
using ConversionNNPtr = util::nn<ConversionPtr>;
746
747
/** \brief A mathematical operation on coordinates in which the parameter
748
 * values are defined rather than empirically derived.
749
 *
750
 * Application of the coordinate conversion introduces no error into output
751
 * coordinates. The best-known example of a coordinate conversion is a map
752
 * projection. For coordinate conversions the output coordinates are referenced
753
 * to the same datum as are the input coordinates.
754
 *
755
 * Coordinate conversions forming a component of a derived CRS have a source
756
 * crs::CRS and a target crs::CRS that are NOT specified through the source and
757
 * target
758
 * associations, but through associations from crs::DerivedCRS to
759
 * crs::SingleCRS.
760
 *
761
 * \remark Implements Conversion from \ref ISO_19111_2019
762
 */
763
764
/*!
765
766
\section projection_parameters Projection parameters
767
768
\subsection colatitude_cone_axis Co-latitude of cone axis
769
770
The rotation applied to spherical coordinates for the oblique projection,
771
measured on the conformal sphere in the plane of the meridian of origin.
772
773
EPSG:1036
774
775
\subsection center_latitude Latitude of natural origin/Center Latitude
776
777
The latitude of the point from which the values of both the geographical
778
coordinates on the ellipsoid and the grid coordinates on the projection are
779
deemed to increment or decrement for computational purposes. Alternatively it
780
may be considered as the latitude of the point which in the absence of
781
application of false coordinates has grid coordinates of (0,0).
782
783
EPSG:8801
784
785
\subsection center_longitude Longitude of natural origin/Central Meridian
786
787
The longitude of the point from which the values of both the geographical
788
coordinates on the ellipsoid and the grid coordinates on the projection are
789
deemed to increment or decrement for computational purposes. Alternatively it
790
may be considered as the longitude of the point which in the absence of
791
application of false coordinates has grid coordinates of (0,0).  Sometimes known
792
as "central meridian (CM)".
793
794
EPSG:8802
795
796
\subsection scale Scale Factor
797
798
The factor by which the map grid is reduced or enlarged during the projection
799
process, defined by its value at the natural origin.
800
801
EPSG:8805
802
803
\subsection false_easting False Easting
804
805
Since the natural origin may be at or near the centre of the projection and
806
under normal coordinate circumstances would thus give rise to negative
807
coordinates over parts of the mapped area, this origin is usually given false
808
coordinates which are large enough to avoid this inconvenience. The False
809
Easting, FE, is the value assigned to the abscissa (east or west) axis of the
810
projection grid at the natural origin.
811
812
EPSG:8806
813
814
\subsection false_northing False Northing
815
816
Since the natural origin may be at or near the centre of the projection and
817
under normal coordinate circumstances would thus give rise to negative
818
coordinates over parts of the mapped area, this origin is usually given false
819
coordinates which are large enough to avoid this inconvenience. The False
820
Northing, FN, is the value assigned to the ordinate (north or south) axis of the
821
projection grid at the natural origin.
822
823
EPSG:8807
824
825
\subsection latitude_projection_centre Latitude of projection centre
826
827
For an oblique projection, this is the latitude of the point at which the
828
azimuth of the central line is defined.
829
830
EPSG:8811
831
832
\subsection longitude_projection_centre Longitude of projection centre
833
834
For an oblique projection, this is the longitude of the point at which the
835
azimuth of the central line is defined.
836
837
EPSG:8812
838
839
\subsection azimuth_initial_line Azimuth of initial line
840
841
The azimuthal direction (north zero, east of north being positive) of the great
842
circle which is the centre line of an oblique projection. The azimuth is given
843
at the projection centre.
844
845
EPSG:8813
846
847
\subsection angle_from_recitfied_to_skrew_grid Angle from Rectified to Skew Grid
848
849
The angle at the natural origin of an oblique projection through which the
850
natural coordinate reference system is rotated to make the projection north
851
axis parallel with true north.
852
853
EPSG:8814
854
855
\subsection scale_factor_initial_line Scale factor on initial line
856
857
The factor by which the map grid is reduced or enlarged during the projection
858
process, defined by its value at the projection center.
859
860
EPSG:8815
861
862
\subsection easting_projection_centre Easting at projection centre
863
864
The easting value assigned to the projection centre.
865
866
EPSG:8816
867
868
\subsection northing_projection_centre Northing at projection centre
869
870
The northing value assigned to the projection centre.
871
872
EPSG:8817
873
874
\subsection latitude_pseudo_standard_parallel Latitude of pseudo standard
875
parallel
876
877
Latitude of the parallel on which the conic or cylindrical projection is based.
878
This latitude is not geographic, but is defined on the conformal sphere AFTER
879
its rotation to obtain the oblique aspect of the projection.
880
881
EPSG:8818
882
883
\subsection scale_factor_pseudo_standard_parallel Scale factor on pseudo
884
standard parallel
885
886
The factor by which the map grid is reduced or enlarged during the projection
887
process, defined by its value at the pseudo-standard parallel.
888
EPSG:8819
889
890
\subsection latitude_false_origin Latitude of false origin
891
892
The latitude of the point which is not the natural origin and at which grid
893
coordinate values false easting and false northing are defined.
894
895
EPSG:8821
896
897
\subsection longitude_false_origin Longitude of false origin
898
899
The longitude of the point which is not the natural origin and at which grid
900
coordinate values false easting and false northing are defined.
901
902
EPSG:8822
903
904
\subsection latitude_first_std_parallel Latitude of 1st standard parallel
905
906
For a conic projection with two standard parallels, this is the latitude of one
907
of the parallels of intersection of the cone with the ellipsoid. It is normally
908
but not necessarily that nearest to the pole. Scale is true along this parallel.
909
910
EPSG:8823
911
912
\subsection latitude_second_std_parallel Latitude of 2nd standard parallel
913
914
For a conic projection with two standard parallels, this is the latitude of one
915
of the parallels at which the cone intersects with the ellipsoid. It is normally
916
but not necessarily that nearest to the equator. Scale is true along this
917
parallel.
918
919
EPSG:8824
920
921
\subsection easting_false_origin Easting of false origin
922
923
The easting value assigned to the false origin.
924
925
EPSG:8826
926
927
\subsection northing_false_origin Northing of false origin
928
929
The northing value assigned to the false origin.
930
931
EPSG:8827
932
933
\subsection latitude_std_parallel Latitude of standard parallel
934
935
For polar aspect azimuthal projections, the parallel on which the scale factor
936
is defined to be unity.
937
938
EPSG:8832
939
940
\subsection longitude_of_origin Longitude of origin
941
942
For polar aspect azimuthal projections, the meridian along which the
943
northing axis increments and also across which parallels of latitude
944
increment towards the north pole.
945
946
EPSG:8833
947
948
*/
949
950
class PROJ_GCC_DLL Conversion : public SingleOperation {
951
  public:
952
    //! @cond Doxygen_Suppress
953
    PROJ_DLL ~Conversion() override;
954
    //! @endcond
955
956
    PROJ_DLL CoordinateOperationNNPtr inverse() const override;
957
958
    //! @cond Doxygen_Suppress
959
    PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
960
        const override; // throw(io::FormattingException)
961
    //! @endcond
962
963
    PROJ_DLL bool isUTM(int &zone, bool &north) const;
964
965
    PROJ_DLL ConversionNNPtr identify() const;
966
967
    PROJ_DLL static ConversionNNPtr
968
    create(const util::PropertyMap &properties,
969
           const OperationMethodNNPtr &methodIn,
970
           const std::vector<GeneralParameterValueNNPtr>
971
               &values); // throw InvalidOperation
972
973
    PROJ_DLL static ConversionNNPtr
974
    create(const util::PropertyMap &propertiesConversion,
975
           const util::PropertyMap &propertiesOperationMethod,
976
           const std::vector<OperationParameterNNPtr> &parameters,
977
           const std::vector<ParameterValueNNPtr>
978
               &values); // throw InvalidOperation
979
980
    PROJ_DLL static ConversionNNPtr
981
    createUTM(const util::PropertyMap &properties, int zone, bool north);
982
983
    PROJ_DLL static ConversionNNPtr createTransverseMercator(
984
        const util::PropertyMap &properties, const common::Angle &centerLat,
985
        const common::Angle &centerLong, const common::Scale &scale,
986
        const common::Length &falseEasting,
987
        const common::Length &falseNorthing);
988
989
    PROJ_DLL static ConversionNNPtr createGaussSchreiberTransverseMercator(
990
        const util::PropertyMap &properties, const common::Angle &centerLat,
991
        const common::Angle &centerLong, const common::Scale &scale,
992
        const common::Length &falseEasting,
993
        const common::Length &falseNorthing);
994
995
    PROJ_DLL static ConversionNNPtr createTransverseMercatorSouthOriented(
996
        const util::PropertyMap &properties, const common::Angle &centerLat,
997
        const common::Angle &centerLong, const common::Scale &scale,
998
        const common::Length &falseEasting,
999
        const common::Length &falseNorthing);
1000
1001
    PROJ_DLL static ConversionNNPtr
1002
    createTwoPointEquidistant(const util::PropertyMap &properties,
1003
                              const common::Angle &latitudeFirstPoint,
1004
                              const common::Angle &longitudeFirstPoint,
1005
                              const common::Angle &latitudeSecondPoint,
1006
                              const common::Angle &longitudeSeconPoint,
1007
                              const common::Length &falseEasting,
1008
                              const common::Length &falseNorthing);
1009
1010
    PROJ_DLL static ConversionNNPtr createTunisiaMappingGrid(
1011
        const util::PropertyMap &properties, const common::Angle &centerLat,
1012
        const common::Angle &centerLong, const common::Length &falseEasting,
1013
        const common::Length &falseNorthing);
1014
1015
    PROJ_DLL static ConversionNNPtr createTunisiaMiningGrid(
1016
        const util::PropertyMap &properties, const common::Angle &centerLat,
1017
        const common::Angle &centerLong, const common::Length &falseEasting,
1018
        const common::Length &falseNorthing);
1019
1020
    PROJ_DLL static ConversionNNPtr
1021
    createAlbersEqualArea(const util::PropertyMap &properties,
1022
                          const common::Angle &latitudeFalseOrigin,
1023
                          const common::Angle &longitudeFalseOrigin,
1024
                          const common::Angle &latitudeFirstParallel,
1025
                          const common::Angle &latitudeSecondParallel,
1026
                          const common::Length &eastingFalseOrigin,
1027
                          const common::Length &northingFalseOrigin);
1028
1029
    PROJ_DLL static ConversionNNPtr createLambertConicConformal_1SP(
1030
        const util::PropertyMap &properties, const common::Angle &centerLat,
1031
        const common::Angle &centerLong, const common::Scale &scale,
1032
        const common::Length &falseEasting,
1033
        const common::Length &falseNorthing);
1034
1035
    PROJ_DLL static ConversionNNPtr createLambertConicConformal_1SP_VariantB(
1036
        const util::PropertyMap &properties,
1037
        const common::Angle &latitudeNatOrigin, const common::Scale &scale,
1038
        const common::Angle &latitudeFalseOrigin,
1039
        const common::Angle &longitudeFalseOrigin,
1040
        const common::Length &eastingFalseOrigin,
1041
        const common::Length &northingFalseOrigin);
1042
1043
    PROJ_DLL static ConversionNNPtr
1044
    createLambertConicConformal_2SP(const util::PropertyMap &properties,
1045
                                    const common::Angle &latitudeFalseOrigin,
1046
                                    const common::Angle &longitudeFalseOrigin,
1047
                                    const common::Angle &latitudeFirstParallel,
1048
                                    const common::Angle &latitudeSecondParallel,
1049
                                    const common::Length &eastingFalseOrigin,
1050
                                    const common::Length &northingFalseOrigin);
1051
1052
    PROJ_DLL static ConversionNNPtr createLambertConicConformal_2SP_Michigan(
1053
        const util::PropertyMap &properties,
1054
        const common::Angle &latitudeFalseOrigin,
1055
        const common::Angle &longitudeFalseOrigin,
1056
        const common::Angle &latitudeFirstParallel,
1057
        const common::Angle &latitudeSecondParallel,
1058
        const common::Length &eastingFalseOrigin,
1059
        const common::Length &northingFalseOrigin,
1060
        const common::Scale &ellipsoidScalingFactor);
1061
1062
    PROJ_DLL static ConversionNNPtr createLambertConicConformal_2SP_Belgium(
1063
        const util::PropertyMap &properties,
1064
        const common::Angle &latitudeFalseOrigin,
1065
        const common::Angle &longitudeFalseOrigin,
1066
        const common::Angle &latitudeFirstParallel,
1067
        const common::Angle &latitudeSecondParallel,
1068
        const common::Length &eastingFalseOrigin,
1069
        const common::Length &northingFalseOrigin);
1070
1071
    PROJ_DLL static ConversionNNPtr
1072
    createAzimuthalEquidistant(const util::PropertyMap &properties,
1073
                               const common::Angle &latitudeNatOrigin,
1074
                               const common::Angle &longitudeNatOrigin,
1075
                               const common::Length &falseEasting,
1076
                               const common::Length &falseNorthing);
1077
1078
    PROJ_DLL static ConversionNNPtr
1079
    createGuamProjection(const util::PropertyMap &properties,
1080
                         const common::Angle &latitudeNatOrigin,
1081
                         const common::Angle &longitudeNatOrigin,
1082
                         const common::Length &falseEasting,
1083
                         const common::Length &falseNorthing);
1084
1085
    PROJ_DLL static ConversionNNPtr
1086
    createBonne(const util::PropertyMap &properties,
1087
                const common::Angle &latitudeNatOrigin,
1088
                const common::Angle &longitudeNatOrigin,
1089
                const common::Length &falseEasting,
1090
                const common::Length &falseNorthing);
1091
1092
    PROJ_DLL static ConversionNNPtr createLambertCylindricalEqualAreaSpherical(
1093
        const util::PropertyMap &properties,
1094
        const common::Angle &latitudeFirstParallel,
1095
        const common::Angle &longitudeNatOrigin,
1096
        const common::Length &falseEasting,
1097
        const common::Length &falseNorthing);
1098
1099
    PROJ_DLL static ConversionNNPtr createLambertCylindricalEqualArea(
1100
        const util::PropertyMap &properties,
1101
        const common::Angle &latitudeFirstParallel,
1102
        const common::Angle &longitudeNatOrigin,
1103
        const common::Length &falseEasting,
1104
        const common::Length &falseNorthing);
1105
1106
    PROJ_DLL static ConversionNNPtr createCassiniSoldner(
1107
        const util::PropertyMap &properties, const common::Angle &centerLat,
1108
        const common::Angle &centerLong, const common::Length &falseEasting,
1109
        const common::Length &falseNorthing);
1110
1111
    PROJ_DLL static ConversionNNPtr
1112
    createEquidistantConic(const util::PropertyMap &properties,
1113
                           const common::Angle &latitudeFalseOrigin,
1114
                           const common::Angle &longitudeFalseOrigin,
1115
                           const common::Angle &latitudeFirstParallel,
1116
                           const common::Angle &latitudeSecondParallel,
1117
                           const common::Length &eastingFalseOrigin,
1118
                           const common::Length &northingFalseOrigin);
1119
1120
    PROJ_DLL static ConversionNNPtr
1121
    createEckertI(const util::PropertyMap &properties,
1122
                  const common::Angle &centerLong,
1123
                  const common::Length &falseEasting,
1124
                  const common::Length &falseNorthing);
1125
1126
    PROJ_DLL static ConversionNNPtr
1127
    createEckertII(const util::PropertyMap &properties,
1128
                   const common::Angle &centerLong,
1129
                   const common::Length &falseEasting,
1130
                   const common::Length &falseNorthing);
1131
1132
    PROJ_DLL static ConversionNNPtr
1133
    createEckertIII(const util::PropertyMap &properties,
1134
                    const common::Angle &centerLong,
1135
                    const common::Length &falseEasting,
1136
                    const common::Length &falseNorthing);
1137
1138
    PROJ_DLL static ConversionNNPtr
1139
    createEckertIV(const util::PropertyMap &properties,
1140
                   const common::Angle &centerLong,
1141
                   const common::Length &falseEasting,
1142
                   const common::Length &falseNorthing);
1143
1144
    PROJ_DLL static ConversionNNPtr
1145
    createEckertV(const util::PropertyMap &properties,
1146
                  const common::Angle &centerLong,
1147
                  const common::Length &falseEasting,
1148
                  const common::Length &falseNorthing);
1149
1150
    PROJ_DLL static ConversionNNPtr
1151
    createEckertVI(const util::PropertyMap &properties,
1152
                   const common::Angle &centerLong,
1153
                   const common::Length &falseEasting,
1154
                   const common::Length &falseNorthing);
1155
1156
    PROJ_DLL static ConversionNNPtr
1157
    createEquidistantCylindrical(const util::PropertyMap &properties,
1158
                                 const common::Angle &latitudeFirstParallel,
1159
                                 const common::Angle &longitudeNatOrigin,
1160
                                 const common::Length &falseEasting,
1161
                                 const common::Length &falseNorthing);
1162
1163
    PROJ_DLL static ConversionNNPtr createEquidistantCylindricalSpherical(
1164
        const util::PropertyMap &properties,
1165
        const common::Angle &latitudeFirstParallel,
1166
        const common::Angle &longitudeNatOrigin,
1167
        const common::Length &falseEasting,
1168
        const common::Length &falseNorthing);
1169
1170
    PROJ_DLL static ConversionNNPtr
1171
    createGall(const util::PropertyMap &properties,
1172
               const common::Angle &centerLong,
1173
               const common::Length &falseEasting,
1174
               const common::Length &falseNorthing);
1175
1176
    PROJ_DLL static ConversionNNPtr
1177
    createGoodeHomolosine(const util::PropertyMap &properties,
1178
                          const common::Angle &centerLong,
1179
                          const common::Length &falseEasting,
1180
                          const common::Length &falseNorthing);
1181
1182
    PROJ_DLL static ConversionNNPtr
1183
    createInterruptedGoodeHomolosine(const util::PropertyMap &properties,
1184
                                     const common::Angle &centerLong,
1185
                                     const common::Length &falseEasting,
1186
                                     const common::Length &falseNorthing);
1187
1188
    PROJ_DLL static ConversionNNPtr createGeostationarySatelliteSweepX(
1189
        const util::PropertyMap &properties, const common::Angle &centerLong,
1190
        const common::Length &height, const common::Length &falseEasting,
1191
        const common::Length &falseNorthing);
1192
1193
    PROJ_DLL static ConversionNNPtr createGeostationarySatelliteSweepY(
1194
        const util::PropertyMap &properties, const common::Angle &centerLong,
1195
        const common::Length &height, const common::Length &falseEasting,
1196
        const common::Length &falseNorthing);
1197
1198
    PROJ_DLL static ConversionNNPtr createGnomonic(
1199
        const util::PropertyMap &properties, const common::Angle &centerLat,
1200
        const common::Angle &centerLong, const common::Length &falseEasting,
1201
        const common::Length &falseNorthing);
1202
1203
    PROJ_DLL static ConversionNNPtr createHotineObliqueMercatorVariantA(
1204
        const util::PropertyMap &properties,
1205
        const common::Angle &latitudeProjectionCentre,
1206
        const common::Angle &longitudeProjectionCentre,
1207
        const common::Angle &azimuthInitialLine,
1208
        const common::Angle &angleFromRectifiedToSkrewGrid,
1209
        const common::Scale &scale, const common::Length &falseEasting,
1210
        const common::Length &falseNorthing);
1211
1212
    PROJ_DLL static ConversionNNPtr createHotineObliqueMercatorVariantB(
1213
        const util::PropertyMap &properties,
1214
        const common::Angle &latitudeProjectionCentre,
1215
        const common::Angle &longitudeProjectionCentre,
1216
        const common::Angle &azimuthInitialLine,
1217
        const common::Angle &angleFromRectifiedToSkrewGrid,
1218
        const common::Scale &scale,
1219
        const common::Length &eastingProjectionCentre,
1220
        const common::Length &northingProjectionCentre);
1221
1222
    PROJ_DLL static ConversionNNPtr
1223
    createHotineObliqueMercatorTwoPointNaturalOrigin(
1224
        const util::PropertyMap &properties,
1225
        const common::Angle &latitudeProjectionCentre,
1226
        const common::Angle &latitudePoint1,
1227
        const common::Angle &longitudePoint1,
1228
        const common::Angle &latitudePoint2,
1229
        const common::Angle &longitudePoint2, const common::Scale &scale,
1230
        const common::Length &eastingProjectionCentre,
1231
        const common::Length &northingProjectionCentre);
1232
1233
    PROJ_DLL static ConversionNNPtr
1234
    createLabordeObliqueMercator(const util::PropertyMap &properties,
1235
                                 const common::Angle &latitudeProjectionCentre,
1236
                                 const common::Angle &longitudeProjectionCentre,
1237
                                 const common::Angle &azimuthInitialLine,
1238
                                 const common::Scale &scale,
1239
                                 const common::Length &falseEasting,
1240
                                 const common::Length &falseNorthing);
1241
1242
    PROJ_DLL static ConversionNNPtr createInternationalMapWorldPolyconic(
1243
        const util::PropertyMap &properties, const common::Angle &centerLong,
1244
        const common::Angle &latitudeFirstParallel,
1245
        const common::Angle &latitudeSecondParallel,
1246
        const common::Length &falseEasting,
1247
        const common::Length &falseNorthing);
1248
1249
    PROJ_DLL static ConversionNNPtr createKrovakNorthOriented(
1250
        const util::PropertyMap &properties,
1251
        const common::Angle &latitudeProjectionCentre,
1252
        const common::Angle &longitudeOfOrigin,
1253
        const common::Angle &colatitudeConeAxis,
1254
        const common::Angle &latitudePseudoStandardParallel,
1255
        const common::Scale &scaleFactorPseudoStandardParallel,
1256
        const common::Length &falseEasting,
1257
        const common::Length &falseNorthing);
1258
1259
    PROJ_DLL static ConversionNNPtr
1260
    createKrovak(const util::PropertyMap &properties,
1261
                 const common::Angle &latitudeProjectionCentre,
1262
                 const common::Angle &longitudeOfOrigin,
1263
                 const common::Angle &colatitudeConeAxis,
1264
                 const common::Angle &latitudePseudoStandardParallel,
1265
                 const common::Scale &scaleFactorPseudoStandardParallel,
1266
                 const common::Length &falseEasting,
1267
                 const common::Length &falseNorthing);
1268
1269
    PROJ_DLL static ConversionNNPtr
1270
    createLambertAzimuthalEqualArea(const util::PropertyMap &properties,
1271
                                    const common::Angle &latitudeNatOrigin,
1272
                                    const common::Angle &longitudeNatOrigin,
1273
                                    const common::Length &falseEasting,
1274
                                    const common::Length &falseNorthing);
1275
1276
    PROJ_DLL static ConversionNNPtr
1277
    createMillerCylindrical(const util::PropertyMap &properties,
1278
                            const common::Angle &centerLong,
1279
                            const common::Length &falseEasting,
1280
                            const common::Length &falseNorthing);
1281
1282
    PROJ_DLL static ConversionNNPtr createMercatorVariantA(
1283
        const util::PropertyMap &properties, const common::Angle &centerLat,
1284
        const common::Angle &centerLong, const common::Scale &scale,
1285
        const common::Length &falseEasting,
1286
        const common::Length &falseNorthing);
1287
1288
    PROJ_DLL static ConversionNNPtr
1289
    createMercatorVariantB(const util::PropertyMap &properties,
1290
                           const common::Angle &latitudeFirstParallel,
1291
                           const common::Angle &centerLong,
1292
                           const common::Length &falseEasting,
1293
                           const common::Length &falseNorthing);
1294
1295
    PROJ_DLL static ConversionNNPtr createPopularVisualisationPseudoMercator(
1296
        const util::PropertyMap &properties, const common::Angle &centerLat,
1297
        const common::Angle &centerLong, const common::Length &falseEasting,
1298
        const common::Length &falseNorthing);
1299
1300
    PROJ_DLL static ConversionNNPtr createMercatorSpherical(
1301
        const util::PropertyMap &properties, const common::Angle &centerLat,
1302
        const common::Angle &centerLong, const common::Length &falseEasting,
1303
        const common::Length &falseNorthing);
1304
1305
    PROJ_DLL static ConversionNNPtr
1306
    createMollweide(const util::PropertyMap &properties,
1307
                    const common::Angle &centerLong,
1308
                    const common::Length &falseEasting,
1309
                    const common::Length &falseNorthing);
1310
1311
    PROJ_DLL static ConversionNNPtr createNewZealandMappingGrid(
1312
        const util::PropertyMap &properties, const common::Angle &centerLat,
1313
        const common::Angle &centerLong, const common::Length &falseEasting,
1314
        const common::Length &falseNorthing);
1315
1316
    PROJ_DLL static ConversionNNPtr createObliqueStereographic(
1317
        const util::PropertyMap &properties, const common::Angle &centerLat,
1318
        const common::Angle &centerLong, const common::Scale &scale,
1319
        const common::Length &falseEasting,
1320
        const common::Length &falseNorthing);
1321
1322
    PROJ_DLL static ConversionNNPtr createOrthographic(
1323
        const util::PropertyMap &properties, const common::Angle &centerLat,
1324
        const common::Angle &centerLong, const common::Length &falseEasting,
1325
        const common::Length &falseNorthing);
1326
1327
    PROJ_DLL static ConversionNNPtr createAmericanPolyconic(
1328
        const util::PropertyMap &properties, const common::Angle &centerLat,
1329
        const common::Angle &centerLong, const common::Length &falseEasting,
1330
        const common::Length &falseNorthing);
1331
1332
    PROJ_DLL static ConversionNNPtr createPolarStereographicVariantA(
1333
        const util::PropertyMap &properties, const common::Angle &centerLat,
1334
        const common::Angle &centerLong, const common::Scale &scale,
1335
        const common::Length &falseEasting,
1336
        const common::Length &falseNorthing);
1337
1338
    PROJ_DLL static ConversionNNPtr createPolarStereographicVariantB(
1339
        const util::PropertyMap &properties,
1340
        const common::Angle &latitudeStandardParallel,
1341
        const common::Angle &longitudeOfOrigin,
1342
        const common::Length &falseEasting,
1343
        const common::Length &falseNorthing);
1344
1345
    PROJ_DLL static ConversionNNPtr
1346
    createRobinson(const util::PropertyMap &properties,
1347
                   const common::Angle &centerLong,
1348
                   const common::Length &falseEasting,
1349
                   const common::Length &falseNorthing);
1350
1351
    PROJ_DLL static ConversionNNPtr
1352
    createSinusoidal(const util::PropertyMap &properties,
1353
                     const common::Angle &centerLong,
1354
                     const common::Length &falseEasting,
1355
                     const common::Length &falseNorthing);
1356
1357
    PROJ_DLL static ConversionNNPtr createStereographic(
1358
        const util::PropertyMap &properties, const common::Angle &centerLat,
1359
        const common::Angle &centerLong, const common::Scale &scale,
1360
        const common::Length &falseEasting,
1361
        const common::Length &falseNorthing);
1362
1363
    PROJ_DLL static ConversionNNPtr
1364
    createVanDerGrinten(const util::PropertyMap &properties,
1365
                        const common::Angle &centerLong,
1366
                        const common::Length &falseEasting,
1367
                        const common::Length &falseNorthing);
1368
1369
    PROJ_DLL static ConversionNNPtr
1370
    createWagnerI(const util::PropertyMap &properties,
1371
                  const common::Angle &centerLong,
1372
                  const common::Length &falseEasting,
1373
                  const common::Length &falseNorthing);
1374
1375
    PROJ_DLL static ConversionNNPtr
1376
    createWagnerII(const util::PropertyMap &properties,
1377
                   const common::Angle &centerLong,
1378
                   const common::Length &falseEasting,
1379
                   const common::Length &falseNorthing);
1380
1381
    PROJ_DLL static ConversionNNPtr
1382
    createWagnerIII(const util::PropertyMap &properties,
1383
                    const common::Angle &latitudeTrueScale,
1384
                    const common::Angle &centerLong,
1385
                    const common::Length &falseEasting,
1386
                    const common::Length &falseNorthing);
1387
1388
    PROJ_DLL static ConversionNNPtr
1389
    createWagnerIV(const util::PropertyMap &properties,
1390
                   const common::Angle &centerLong,
1391
                   const common::Length &falseEasting,
1392
                   const common::Length &falseNorthing);
1393
1394
    PROJ_DLL static ConversionNNPtr
1395
    createWagnerV(const util::PropertyMap &properties,
1396
                  const common::Angle &centerLong,
1397
                  const common::Length &falseEasting,
1398
                  const common::Length &falseNorthing);
1399
1400
    PROJ_DLL static ConversionNNPtr
1401
    createWagnerVI(const util::PropertyMap &properties,
1402
                   const common::Angle &centerLong,
1403
                   const common::Length &falseEasting,
1404
                   const common::Length &falseNorthing);
1405
1406
    PROJ_DLL static ConversionNNPtr
1407
    createWagnerVII(const util::PropertyMap &properties,
1408
                    const common::Angle &centerLong,
1409
                    const common::Length &falseEasting,
1410
                    const common::Length &falseNorthing);
1411
1412
    PROJ_DLL static ConversionNNPtr createQuadrilateralizedSphericalCube(
1413
        const util::PropertyMap &properties, const common::Angle &centerLat,
1414
        const common::Angle &centerLong, const common::Length &falseEasting,
1415
        const common::Length &falseNorthing);
1416
1417
    PROJ_DLL static ConversionNNPtr createSphericalCrossTrackHeight(
1418
        const util::PropertyMap &properties, const common::Angle &pegPointLat,
1419
        const common::Angle &pegPointLong, const common::Angle &pegPointHeading,
1420
        const common::Length &pegPointHeight);
1421
1422
    PROJ_DLL static ConversionNNPtr
1423
    createEqualEarth(const util::PropertyMap &properties,
1424
                     const common::Angle &centerLong,
1425
                     const common::Length &falseEasting,
1426
                     const common::Length &falseNorthing);
1427
1428
    PROJ_DLL static ConversionNNPtr
1429
    createVerticalPerspective(const util::PropertyMap &properties,
1430
                              const common::Angle &topoOriginLat,
1431
                              const common::Angle &topoOriginLong,
1432
                              const common::Length &topoOriginHeight,
1433
                              const common::Length &viewPointHeight,
1434
                              const common::Length &falseEasting,
1435
                              const common::Length &falseNorthing);
1436
1437
    PROJ_DLL static ConversionNNPtr createPoleRotationGRIBConvention(
1438
        const util::PropertyMap &properties,
1439
        const common::Angle &southPoleLatInUnrotatedCRS,
1440
        const common::Angle &southPoleLongInUnrotatedCRS,
1441
        const common::Angle &axisRotation);
1442
1443
    PROJ_DLL static ConversionNNPtr createPoleRotationNetCDFCFConvention(
1444
        const util::PropertyMap &properties,
1445
        const common::Angle &gridNorthPoleLatitude,
1446
        const common::Angle &gridNorthPoleLongitude,
1447
        const common::Angle &northPoleGridLongitude);
1448
1449
    PROJ_DLL static ConversionNNPtr
1450
    createChangeVerticalUnit(const util::PropertyMap &properties,
1451
                             const common::Scale &factor);
1452
1453
    PROJ_DLL static ConversionNNPtr
1454
    createChangeVerticalUnit(const util::PropertyMap &properties);
1455
1456
    PROJ_DLL static ConversionNNPtr
1457
    createHeightDepthReversal(const util::PropertyMap &properties);
1458
1459
    PROJ_DLL static ConversionNNPtr createAxisOrderReversal(bool is3D);
1460
1461
    PROJ_DLL static ConversionNNPtr
1462
    createGeographicGeocentric(const util::PropertyMap &properties);
1463
1464
    PROJ_DLL static ConversionNNPtr
1465
    createGeographic2DOffsets(const util::PropertyMap &properties,
1466
                              const common::Angle &offsetLat,
1467
                              const common::Angle &offsetLong);
1468
1469
    PROJ_DLL static ConversionNNPtr createGeographic3DOffsets(
1470
        const util::PropertyMap &properties, const common::Angle &offsetLat,
1471
        const common::Angle &offsetLong, const common::Length &offsetHeight);
1472
1473
    PROJ_DLL static ConversionNNPtr createGeographic2DWithHeightOffsets(
1474
        const util::PropertyMap &properties, const common::Angle &offsetLat,
1475
        const common::Angle &offsetLong, const common::Length &offsetHeight);
1476
1477
    PROJ_DLL static ConversionNNPtr
1478
    createVerticalOffset(const util::PropertyMap &properties,
1479
                         const common::Length &offsetHeight);
1480
1481
    PROJ_DLL ConversionPtr convertToOtherMethod(int targetEPSGCode) const;
1482
1483
    PROJ_PRIVATE :
1484
        //! @cond Doxygen_Suppress
1485
        PROJ_INTERNAL void
1486
        _exportToPROJString(io::PROJStringFormatter *formatter)
1487
            const override; // throw(FormattingException)
1488
1489
    PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
1490
        const override; // throw(FormattingException)
1491
1492
    PROJ_INTERNAL const char *getESRIMethodName() const;
1493
1494
    PROJ_INTERNAL const char *getWKT1GDALMethodName() const;
1495
1496
    PROJ_INTERNAL ConversionNNPtr shallowClone() const;
1497
1498
    PROJ_INTERNAL ConversionNNPtr alterParametersLinearUnit(
1499
        const common::UnitOfMeasure &unit, bool convertToNewUnit) const;
1500
1501
    PROJ_INTERNAL static ConversionNNPtr
1502
    createGeographicGeocentric(const crs::CRSNNPtr &sourceCRS,
1503
                               const crs::CRSNNPtr &targetCRS);
1504
1505
    PROJ_INTERNAL static ConversionNNPtr
1506
    createGeographicGeocentricLatitude(const crs::CRSNNPtr &sourceCRS,
1507
                                       const crs::CRSNNPtr &targetCRS);
1508
1509
    //! @endcond
1510
1511
  protected:
1512
    PROJ_INTERNAL
1513
    Conversion(const OperationMethodNNPtr &methodIn,
1514
               const std::vector<GeneralParameterValueNNPtr> &values);
1515
    PROJ_INTERNAL Conversion(const Conversion &other);
1516
    INLINED_MAKE_SHARED
1517
1518
    PROJ_FRIEND(crs::ProjectedCRS);
1519
    PROJ_INTERNAL bool addWKTExtensionNode(io::WKTFormatter *formatter) const;
1520
1521
    PROJ_INTERNAL CoordinateOperationNNPtr _shallowClone() const override;
1522
1523
  private:
1524
    PROJ_OPAQUE_PRIVATE_DATA
1525
    Conversion &operator=(const Conversion &other) = delete;
1526
1527
    PROJ_INTERNAL static ConversionNNPtr
1528
    create(const util::PropertyMap &properties, int method_epsg_code,
1529
           const std::vector<ParameterValueNNPtr> &values);
1530
1531
    PROJ_INTERNAL static ConversionNNPtr
1532
    create(const util::PropertyMap &properties, const char *method_wkt2_name,
1533
           const std::vector<ParameterValueNNPtr> &values);
1534
};
1535
1536
// ---------------------------------------------------------------------------
1537
1538
/** \brief A mathematical operation on coordinates in which parameters are
1539
 * empirically derived from data containing the coordinates of a series of
1540
 * points in both coordinate reference systems.
1541
 *
1542
 * This computational process is usually "over-determined", allowing derivation
1543
 * of error (or accuracy) estimates for the coordinate transformation. Also,
1544
 * the stochastic nature of the parameters may result in multiple (different)
1545
 * versions of the same coordinate transformations between the same source and
1546
 * target CRSs. Any single coordinate operation in which the input and output
1547
 * coordinates are referenced to different datums (reference frames) will be a
1548
 * coordinate transformation.
1549
 *
1550
 * \remark Implements Transformation from \ref ISO_19111_2019
1551
 */
1552
class PROJ_GCC_DLL Transformation : public SingleOperation {
1553
  public:
1554
    //! @cond Doxygen_Suppress
1555
    PROJ_DLL ~Transformation() override;
1556
    //! @endcond
1557
1558
    PROJ_DLL const crs::CRSNNPtr &sourceCRS() PROJ_PURE_DECL;
1559
    PROJ_DLL const crs::CRSNNPtr &targetCRS() PROJ_PURE_DECL;
1560
1561
    PROJ_DLL CoordinateOperationNNPtr inverse() const override;
1562
1563
    PROJ_DLL static TransformationNNPtr
1564
    create(const util::PropertyMap &properties,
1565
           const crs::CRSNNPtr &sourceCRSIn, const crs::CRSNNPtr &targetCRSIn,
1566
           const crs::CRSPtr &interpolationCRSIn,
1567
           const OperationMethodNNPtr &methodIn,
1568
           const std::vector<GeneralParameterValueNNPtr> &values,
1569
           const std::vector<metadata::PositionalAccuracyNNPtr>
1570
               &accuracies); // throw InvalidOperation
1571
1572
    PROJ_DLL static TransformationNNPtr
1573
    create(const util::PropertyMap &propertiesTransformation,
1574
           const crs::CRSNNPtr &sourceCRSIn, const crs::CRSNNPtr &targetCRSIn,
1575
           const crs::CRSPtr &interpolationCRSIn,
1576
           const util::PropertyMap &propertiesOperationMethod,
1577
           const std::vector<OperationParameterNNPtr> &parameters,
1578
           const std::vector<ParameterValueNNPtr> &values,
1579
           const std::vector<metadata::PositionalAccuracyNNPtr>
1580
               &accuracies); // throw InvalidOperation
1581
1582
    PROJ_DLL static TransformationNNPtr createGeocentricTranslations(
1583
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1584
        const crs::CRSNNPtr &targetCRSIn, double translationXMetre,
1585
        double translationYMetre, double translationZMetre,
1586
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1587
1588
    PROJ_DLL static TransformationNNPtr createPositionVector(
1589
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1590
        const crs::CRSNNPtr &targetCRSIn, double translationXMetre,
1591
        double translationYMetre, double translationZMetre,
1592
        double rotationXArcSecond, double rotationYArcSecond,
1593
        double rotationZArcSecond, double scaleDifferencePPM,
1594
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1595
1596
    PROJ_DLL static TransformationNNPtr createCoordinateFrameRotation(
1597
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1598
        const crs::CRSNNPtr &targetCRSIn, double translationXMetre,
1599
        double translationYMetre, double translationZMetre,
1600
        double rotationXArcSecond, double rotationYArcSecond,
1601
        double rotationZArcSecond, double scaleDifferencePPM,
1602
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1603
1604
    PROJ_DLL static TransformationNNPtr createTimeDependentPositionVector(
1605
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1606
        const crs::CRSNNPtr &targetCRSIn, double translationXMetre,
1607
        double translationYMetre, double translationZMetre,
1608
        double rotationXArcSecond, double rotationYArcSecond,
1609
        double rotationZArcSecond, double scaleDifferencePPM,
1610
        double rateTranslationX, double rateTranslationY,
1611
        double rateTranslationZ, double rateRotationX, double rateRotationY,
1612
        double rateRotationZ, double rateScaleDifference,
1613
        double referenceEpochYear,
1614
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1615
1616
    PROJ_DLL static TransformationNNPtr
1617
    createTimeDependentCoordinateFrameRotation(
1618
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1619
        const crs::CRSNNPtr &targetCRSIn, double translationXMetre,
1620
        double translationYMetre, double translationZMetre,
1621
        double rotationXArcSecond, double rotationYArcSecond,
1622
        double rotationZArcSecond, double scaleDifferencePPM,
1623
        double rateTranslationX, double rateTranslationY,
1624
        double rateTranslationZ, double rateRotationX, double rateRotationY,
1625
        double rateRotationZ, double rateScaleDifference,
1626
        double referenceEpochYear,
1627
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1628
1629
    PROJ_DLL static TransformationNNPtr createTOWGS84(
1630
        const crs::CRSNNPtr &sourceCRSIn,
1631
        const std::vector<double> &TOWGS84Parameters); // throw InvalidOperation
1632
1633
    PROJ_DLL static TransformationNNPtr createNTv2(
1634
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1635
        const crs::CRSNNPtr &targetCRSIn, const std::string &filename,
1636
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1637
1638
    PROJ_DLL static TransformationNNPtr createMolodensky(
1639
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1640
        const crs::CRSNNPtr &targetCRSIn, double translationXMetre,
1641
        double translationYMetre, double translationZMetre,
1642
        double semiMajorAxisDifferenceMetre, double flattingDifference,
1643
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1644
1645
    PROJ_DLL static TransformationNNPtr createAbridgedMolodensky(
1646
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1647
        const crs::CRSNNPtr &targetCRSIn, double translationXMetre,
1648
        double translationYMetre, double translationZMetre,
1649
        double semiMajorAxisDifferenceMetre, double flattingDifference,
1650
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1651
1652
    PROJ_DLL static TransformationNNPtr
1653
    createGravityRelatedHeightToGeographic3D(
1654
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1655
        const crs::CRSNNPtr &targetCRSIn, const crs::CRSPtr &interpolationCRSIn,
1656
        const std::string &filename,
1657
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1658
1659
    PROJ_DLL static TransformationNNPtr createVERTCON(
1660
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1661
        const crs::CRSNNPtr &targetCRSIn, const std::string &filename,
1662
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1663
1664
    PROJ_DLL static TransformationNNPtr createLongitudeRotation(
1665
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1666
        const crs::CRSNNPtr &targetCRSIn, const common::Angle &offset);
1667
1668
    PROJ_DLL static TransformationNNPtr createGeographic2DOffsets(
1669
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1670
        const crs::CRSNNPtr &targetCRSIn, const common::Angle &offsetLat,
1671
        const common::Angle &offsetLong,
1672
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1673
1674
    PROJ_DLL static TransformationNNPtr createGeographic3DOffsets(
1675
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1676
        const crs::CRSNNPtr &targetCRSIn, const common::Angle &offsetLat,
1677
        const common::Angle &offsetLong, const common::Length &offsetHeight,
1678
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1679
1680
    PROJ_DLL static TransformationNNPtr createGeographic2DWithHeightOffsets(
1681
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1682
        const crs::CRSNNPtr &targetCRSIn, const common::Angle &offsetLat,
1683
        const common::Angle &offsetLong, const common::Length &offsetHeight,
1684
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1685
1686
    PROJ_DLL static TransformationNNPtr createVerticalOffset(
1687
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1688
        const crs::CRSNNPtr &targetCRSIn, const common::Length &offsetHeight,
1689
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1690
1691
    PROJ_DLL static TransformationNNPtr createChangeVerticalUnit(
1692
        const util::PropertyMap &properties, const crs::CRSNNPtr &sourceCRSIn,
1693
        const crs::CRSNNPtr &targetCRSIn, const common::Scale &factor,
1694
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1695
1696
    PROJ_PRIVATE :
1697
        //! @cond Doxygen_Suppress
1698
        PROJ_INTERNAL const std::string &
1699
        getNTv2Filename() const;
1700
1701
    PROJ_FOR_TEST std::vector<double>
1702
    getTOWGS84Parameters() const; // throw(io::FormattingException)
1703
1704
    PROJ_INTERNAL const std::string &getHeightToGeographic3DFilename() const;
1705
1706
    PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
1707
        const override; // throw(io::FormattingException)
1708
1709
    PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
1710
        const override; // throw(FormattingException)
1711
1712
    PROJ_INTERNAL TransformationNNPtr shallowClone() const;
1713
1714
    PROJ_INTERNAL TransformationNNPtr
1715
    promoteTo3D(const std::string &newName,
1716
                const io::DatabaseContextPtr &dbContext) const;
1717
1718
    PROJ_INTERNAL TransformationNNPtr
1719
    demoteTo2D(const std::string &newName,
1720
               const io::DatabaseContextPtr &dbContext) const;
1721
1722
    PROJ_INTERNAL static bool
1723
    isGeographic3DToGravityRelatedHeight(const OperationMethodNNPtr &method,
1724
                                         bool allowInverse);
1725
    //! @endcond
1726
1727
  protected:
1728
    PROJ_INTERNAL Transformation(
1729
        const crs::CRSNNPtr &sourceCRSIn, const crs::CRSNNPtr &targetCRSIn,
1730
        const crs::CRSPtr &interpolationCRSIn,
1731
        const OperationMethodNNPtr &methodIn,
1732
        const std::vector<GeneralParameterValueNNPtr> &values,
1733
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1734
    PROJ_INTERNAL Transformation(const Transformation &other);
1735
    INLINED_MAKE_SHARED
1736
1737
    PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
1738
        const override; // throw(FormattingException)
1739
1740
    PROJ_FRIEND(CoordinateOperationFactory);
1741
    PROJ_FRIEND(SingleOperation);
1742
    PROJ_INTERNAL TransformationNNPtr inverseAsTransformation() const;
1743
1744
    PROJ_INTERNAL CoordinateOperationNNPtr _shallowClone() const override;
1745
1746
  private:
1747
    PROJ_OPAQUE_PRIVATE_DATA
1748
};
1749
1750
// ---------------------------------------------------------------------------
1751
1752
class PointMotionOperation;
1753
/** Shared pointer of PointMotionOperation */
1754
using PointMotionOperationPtr = std::shared_ptr<PointMotionOperation>;
1755
/** Non-null shared pointer of PointMotionOperation */
1756
using PointMotionOperationNNPtr = util::nn<PointMotionOperationPtr>;
1757
1758
/** \brief A mathematical operation that describes the change of coordinate
1759
 * values within one coordinate reference system due to the motion of the
1760
 * point between one coordinate epoch and another coordinate epoch.
1761
 *
1762
 * The motion is due to tectonic plate movement or deformation.
1763
 *
1764
 * \remark Implements PointMotionOperation from \ref ISO_19111_2019
1765
 */
1766
class PROJ_GCC_DLL PointMotionOperation : public SingleOperation {
1767
  public:
1768
    // TODO
1769
    //! @cond Doxygen_Suppress
1770
    PROJ_DLL ~PointMotionOperation() override;
1771
    //! @endcond
1772
1773
    PROJ_DLL const crs::CRSNNPtr &sourceCRS() PROJ_PURE_DECL;
1774
1775
    PROJ_DLL CoordinateOperationNNPtr inverse() const override;
1776
1777
    PROJ_DLL static PointMotionOperationNNPtr
1778
    create(const util::PropertyMap &properties, const crs::CRSNNPtr &crsIn,
1779
           const OperationMethodNNPtr &methodIn,
1780
           const std::vector<GeneralParameterValueNNPtr> &values,
1781
           const std::vector<metadata::PositionalAccuracyNNPtr>
1782
               &accuracies); // throw InvalidOperation
1783
1784
    PROJ_DLL static PointMotionOperationNNPtr
1785
    create(const util::PropertyMap &propertiesOperation,
1786
           const crs::CRSNNPtr &crsIn,
1787
           const util::PropertyMap &propertiesOperationMethod,
1788
           const std::vector<OperationParameterNNPtr> &parameters,
1789
           const std::vector<ParameterValueNNPtr> &values,
1790
           const std::vector<metadata::PositionalAccuracyNNPtr>
1791
               &accuracies); // throw InvalidOperation
1792
1793
    PROJ_DLL PointMotionOperationNNPtr substitutePROJAlternativeGridNames(
1794
        io::DatabaseContextNNPtr databaseContext) const;
1795
1796
    PROJ_PRIVATE :
1797
        //! @cond Doxygen_Suppress
1798
        PROJ_INTERNAL PointMotionOperationNNPtr
1799
        shallowClone() const;
1800
1801
    PROJ_INTERNAL PointMotionOperationNNPtr
1802
    cloneWithEpochs(const common::DataEpoch &sourceEpoch,
1803
                    const common::DataEpoch &targetEpoch) const;
1804
1805
    PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
1806
        const override; // throw(FormattingException)
1807
1808
    PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
1809
        const override; // throw(io::FormattingException)
1810
1811
    PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
1812
        const override; // throw(FormattingException)
1813
1814
    //! @endcond
1815
1816
  protected:
1817
    PROJ_INTERNAL PointMotionOperation(
1818
        const crs::CRSNNPtr &crsIn, const OperationMethodNNPtr &methodIn,
1819
        const std::vector<GeneralParameterValueNNPtr> &values,
1820
        const std::vector<metadata::PositionalAccuracyNNPtr> &accuracies);
1821
    PROJ_INTERNAL PointMotionOperation(const PointMotionOperation &other);
1822
    INLINED_MAKE_SHARED
1823
1824
    PROJ_INTERNAL CoordinateOperationNNPtr _shallowClone() const override;
1825
1826
  private:
1827
    PointMotionOperation &operator=(const PointMotionOperation &) = delete;
1828
};
1829
1830
// ---------------------------------------------------------------------------
1831
1832
class ConcatenatedOperation;
1833
/** Shared pointer of ConcatenatedOperation */
1834
using ConcatenatedOperationPtr = std::shared_ptr<ConcatenatedOperation>;
1835
/** Non-null shared pointer of ConcatenatedOperation */
1836
using ConcatenatedOperationNNPtr = util::nn<ConcatenatedOperationPtr>;
1837
1838
/** \brief An ordered sequence of two or more single coordinate operations
1839
 * (SingleOperation).
1840
 *
1841
 * The sequence of coordinate operations is constrained by the requirement
1842
 * that
1843
 * the source coordinate reference system of step n+1 shall be the same as
1844
 * the target coordinate reference system of step n.
1845
 *
1846
 * \remark Implements ConcatenatedOperation from \ref ISO_19111_2019
1847
 */
1848
class PROJ_GCC_DLL ConcatenatedOperation final : public CoordinateOperation {
1849
  public:
1850
    //! @cond Doxygen_Suppress
1851
    PROJ_DLL ~ConcatenatedOperation() override;
1852
    //! @endcond
1853
1854
    PROJ_DLL const std::vector<CoordinateOperationNNPtr> &operations() const;
1855
1856
    PROJ_DLL CoordinateOperationNNPtr inverse() const override;
1857
1858
    PROJ_DLL static ConcatenatedOperationNNPtr
1859
    create(const util::PropertyMap &properties,
1860
           const std::vector<CoordinateOperationNNPtr> &operationsIn,
1861
           const std::vector<metadata::PositionalAccuracyNNPtr>
1862
               &accuracies); // throw InvalidOperation
1863
1864
    PROJ_DLL static CoordinateOperationNNPtr createComputeMetadata(
1865
        const std::vector<CoordinateOperationNNPtr> &operationsIn,
1866
        bool checkExtent); // throw InvalidOperation
1867
1868
    PROJ_DLL std::set<GridDescription>
1869
    gridsNeeded(const io::DatabaseContextPtr &databaseContext,
1870
                bool considerKnownGridsAsAvailable) const override;
1871
1872
    PROJ_PRIVATE :
1873
1874
        //! @cond Doxygen_Suppress
1875
        PROJ_INTERNAL void
1876
        _exportToWKT(io::WKTFormatter *formatter)
1877
            const override; // throw(io::FormattingException)
1878
1879
    PROJ_INTERNAL bool _isEquivalentTo(
1880
        const util::IComparable *other,
1881
        util::IComparable::Criterion criterion =
1882
            util::IComparable::Criterion::STRICT,
1883
        const io::DatabaseContextPtr &dbContext = nullptr) const override;
1884
1885
    PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
1886
        const override; // throw(FormattingException)
1887
1888
    PROJ_INTERNAL static void
1889
    fixStepsDirection(const crs::CRSNNPtr &concatOpSourceCRS,
1890
                      const crs::CRSNNPtr &concatOpTargetCRS,
1891
                      std::vector<CoordinateOperationNNPtr> &operationsInOut,
1892
                      const io::DatabaseContextPtr &dbContext);
1893
    //! @endcond
1894
1895
  protected:
1896
    PROJ_INTERNAL ConcatenatedOperation(const ConcatenatedOperation &other);
1897
    PROJ_INTERNAL explicit ConcatenatedOperation(
1898
        const std::vector<CoordinateOperationNNPtr> &operationsIn);
1899
1900
    PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
1901
        const override; // throw(FormattingException)
1902
1903
    PROJ_INTERNAL CoordinateOperationNNPtr _shallowClone() const override;
1904
1905
    INLINED_MAKE_SHARED
1906
1907
  private:
1908
    PROJ_OPAQUE_PRIVATE_DATA
1909
    ConcatenatedOperation &
1910
    operator=(const ConcatenatedOperation &other) = delete;
1911
};
1912
1913
// ---------------------------------------------------------------------------
1914
1915
class CoordinateOperationContext;
1916
/** Unique pointer of CoordinateOperationContext */
1917
using CoordinateOperationContextPtr =
1918
    std::unique_ptr<CoordinateOperationContext>;
1919
/** Non-null unique pointer of CoordinateOperationContext */
1920
using CoordinateOperationContextNNPtr = util::nn<CoordinateOperationContextPtr>;
1921
1922
/** \brief Context in which a coordinate operation is to be used.
1923
 *
1924
 * \remark Implements [CoordinateOperationFactory
1925
 * https://sis.apache.org/apidocs/org/apache/sis/referencing/operation/CoordinateOperationContext.html]
1926
 * from
1927
 * Apache SIS
1928
 */
1929
1930
class PROJ_GCC_DLL CoordinateOperationContext {
1931
  public:
1932
    //! @cond Doxygen_Suppress
1933
    PROJ_DLL virtual ~CoordinateOperationContext();
1934
    //! @endcond
1935
1936
    PROJ_DLL const io::AuthorityFactoryPtr &getAuthorityFactory() const;
1937
1938
    PROJ_DLL const metadata::ExtentPtr &getAreaOfInterest() const;
1939
1940
    PROJ_DLL void setAreaOfInterest(const metadata::ExtentPtr &extent);
1941
1942
    PROJ_DLL double getDesiredAccuracy() const;
1943
1944
    PROJ_DLL void setDesiredAccuracy(double accuracy);
1945
1946
    PROJ_DLL void setAllowBallparkTransformations(bool allow);
1947
1948
    PROJ_DLL bool getAllowBallparkTransformations() const;
1949
1950
    /** Specify how source and target CRS extent should be used to restrict
1951
     * candidate operations (only taken into account if no explicit area of
1952
     * interest is specified. */
1953
    enum class SourceTargetCRSExtentUse {
1954
        /** Ignore CRS extent */
1955
        NONE,
1956
        /** Test coordinate operation extent against both CRS extent. */
1957
        BOTH,
1958
        /** Test coordinate operation extent against the intersection of both
1959
           CRS extent. */
1960
        INTERSECTION,
1961
        /** Test coordinate operation against the smallest of both CRS extent.
1962
         */
1963
        SMALLEST,
1964
    };
1965
1966
    PROJ_DLL void setSourceAndTargetCRSExtentUse(SourceTargetCRSExtentUse use);
1967
1968
    PROJ_DLL SourceTargetCRSExtentUse getSourceAndTargetCRSExtentUse() const;
1969
1970
    /** Spatial criterion to restrict candidate operations. */
1971
    enum class SpatialCriterion {
1972
        /** The area of validity of transforms should strictly contain the
1973
         * are of interest. */
1974
        STRICT_CONTAINMENT,
1975
1976
        /** The area of validity of transforms should at least intersect the
1977
         * area of interest. */
1978
        PARTIAL_INTERSECTION
1979
    };
1980
1981
    PROJ_DLL void setSpatialCriterion(SpatialCriterion criterion);
1982
1983
    PROJ_DLL SpatialCriterion getSpatialCriterion() const;
1984
1985
    PROJ_DLL void setUsePROJAlternativeGridNames(bool usePROJNames);
1986
1987
    PROJ_DLL bool getUsePROJAlternativeGridNames() const;
1988
1989
    PROJ_DLL void setDiscardSuperseded(bool discard);
1990
1991
    PROJ_DLL bool getDiscardSuperseded() const;
1992
1993
    /** Describe how grid availability is used. */
1994
    enum class GridAvailabilityUse {
1995
        /** Grid availability is only used for sorting results. Operations
1996
         * where some grids are missing will be sorted last. */
1997
        USE_FOR_SORTING,
1998
1999
        /** Completely discard an operation if a required grid is missing. */
2000
        DISCARD_OPERATION_IF_MISSING_GRID,
2001
2002
        /** Ignore grid availability at all. Results will be presented as if
2003
         * all grids were available. */
2004
        IGNORE_GRID_AVAILABILITY,
2005
2006
        /** Results will be presented as if grids known to PROJ (that is
2007
         * registered in the grid_alternatives table of its database) were
2008
         * available. Used typically when networking is enabled.
2009
         */
2010
        KNOWN_AVAILABLE,
2011
    };
2012
2013
    PROJ_DLL void setGridAvailabilityUse(GridAvailabilityUse use);
2014
2015
    PROJ_DLL GridAvailabilityUse getGridAvailabilityUse() const;
2016
2017
    /** Describe if and how intermediate CRS should be used */
2018
    enum class IntermediateCRSUse {
2019
        /** Always search for intermediate CRS. */
2020
        ALWAYS,
2021
2022
        /** Only attempt looking for intermediate CRS if there is no direct
2023
         * transformation available. */
2024
        IF_NO_DIRECT_TRANSFORMATION,
2025
2026
        /* Do not attempt looking for intermediate CRS. */
2027
        NEVER,
2028
    };
2029
2030
    PROJ_DLL void setAllowUseIntermediateCRS(IntermediateCRSUse use);
2031
2032
    PROJ_DLL IntermediateCRSUse getAllowUseIntermediateCRS() const;
2033
2034
    PROJ_DLL void
2035
    setIntermediateCRS(const std::vector<std::pair<std::string, std::string>>
2036
                           &intermediateCRSAuthCodes);
2037
2038
    PROJ_DLL const std::vector<std::pair<std::string, std::string>> &
2039
    getIntermediateCRS() const;
2040
2041
    PROJ_DLL void
2042
    setSourceCoordinateEpoch(const util::optional<common::DataEpoch> &epoch);
2043
2044
    PROJ_DLL const util::optional<common::DataEpoch> &
2045
    getSourceCoordinateEpoch() const;
2046
2047
    PROJ_DLL void
2048
    setTargetCoordinateEpoch(const util::optional<common::DataEpoch> &epoch);
2049
2050
    PROJ_DLL const util::optional<common::DataEpoch> &
2051
    getTargetCoordinateEpoch() const;
2052
2053
    PROJ_DLL static CoordinateOperationContextNNPtr
2054
    create(const io::AuthorityFactoryPtr &authorityFactory,
2055
           const metadata::ExtentPtr &extent, double accuracy);
2056
2057
    PROJ_DLL CoordinateOperationContextNNPtr clone() const;
2058
2059
  protected:
2060
    PROJ_INTERNAL CoordinateOperationContext();
2061
    PROJ_INTERNAL
2062
    CoordinateOperationContext(const CoordinateOperationContext &);
2063
    INLINED_MAKE_UNIQUE
2064
2065
  private:
2066
    PROJ_OPAQUE_PRIVATE_DATA
2067
};
2068
2069
// ---------------------------------------------------------------------------
2070
2071
class CoordinateOperationFactory;
2072
/** Unique pointer of CoordinateOperationFactory */
2073
using CoordinateOperationFactoryPtr =
2074
    std::unique_ptr<CoordinateOperationFactory>;
2075
/** Non-null unique pointer of CoordinateOperationFactory */
2076
using CoordinateOperationFactoryNNPtr = util::nn<CoordinateOperationFactoryPtr>;
2077
2078
/** \brief Creates coordinate operations. This factory is capable to find
2079
 * coordinate transformations or conversions between two coordinate
2080
 * reference
2081
 * systems.
2082
 *
2083
 * \remark Implements (partially) CoordinateOperationFactory from \ref
2084
 * GeoAPI
2085
 */
2086
class PROJ_GCC_DLL CoordinateOperationFactory {
2087
  public:
2088
    //! @cond Doxygen_Suppress
2089
    PROJ_DLL virtual ~CoordinateOperationFactory();
2090
    //! @endcond
2091
2092
    PROJ_DLL CoordinateOperationPtr createOperation(
2093
        const crs::CRSNNPtr &sourceCRS, const crs::CRSNNPtr &targetCRS) const;
2094
2095
    PROJ_DLL std::vector<CoordinateOperationNNPtr>
2096
    createOperations(const crs::CRSNNPtr &sourceCRS,
2097
                     const crs::CRSNNPtr &targetCRS,
2098
                     const CoordinateOperationContextNNPtr &context) const;
2099
2100
    PROJ_DLL std::vector<CoordinateOperationNNPtr> createOperations(
2101
        const coordinates::CoordinateMetadataNNPtr &sourceCoordinateMetadata,
2102
        const crs::CRSNNPtr &targetCRS,
2103
        const CoordinateOperationContextNNPtr &context) const;
2104
2105
    PROJ_DLL std::vector<CoordinateOperationNNPtr> createOperations(
2106
        const crs::CRSNNPtr &sourceCRS,
2107
        const coordinates::CoordinateMetadataNNPtr &targetCoordinateMetadata,
2108
        const CoordinateOperationContextNNPtr &context) const;
2109
2110
    PROJ_DLL std::vector<CoordinateOperationNNPtr> createOperations(
2111
        const coordinates::CoordinateMetadataNNPtr &sourceCoordinateMetadata,
2112
        const coordinates::CoordinateMetadataNNPtr &targetCoordinateMetadata,
2113
        const CoordinateOperationContextNNPtr &context) const;
2114
2115
    PROJ_DLL static CoordinateOperationFactoryNNPtr create();
2116
2117
  protected:
2118
    PROJ_INTERNAL CoordinateOperationFactory();
2119
    INLINED_MAKE_UNIQUE
2120
2121
  private:
2122
    PROJ_OPAQUE_PRIVATE_DATA
2123
};
2124
2125
} // namespace operation
2126
2127
NS_PROJ_END
2128
2129
#endif //  COORDINATEOPERATION_HH_INCLUDED