Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a7fbe48b4 | ||
|
|
861a85d300 | ||
|
|
01c14c763a | ||
|
|
db219196de | ||
|
|
f6a742312b | ||
|
|
d1abf4d5cb | ||
|
|
7848a25e56 | ||
|
|
b5910c8744 | ||
|
|
d8f82c1707 |
@@ -144,6 +144,7 @@
|
||||
|
||||
o WKT1 parser: only emit warning when encountering invalid UNKNOWN WKT1 axis direction (#3618)
|
||||
|
||||
o projinfo: fix long option name --source-crs (#3601)
|
||||
|
||||
|
||||
9.1.1 Release Notes
|
||||
@@ -208,8 +209,6 @@
|
||||
|
||||
o Link geodtest against libm when available (#3341)
|
||||
|
||||
o projinfo: fix long option name --source-crs (#3601)
|
||||
|
||||
9.1.0 Release Notes
|
||||
-------------------
|
||||
|
||||
|
||||
@@ -1411,75 +1411,75 @@ END;
|
||||
|
||||
|
||||
CREATE VIEW coordinate_operation_view AS
|
||||
SELECT 'grid_transformation' AS table_name, auth_name, code, name,
|
||||
SELECT CAST('grid_transformation' AS TEXT) AS table_name, auth_name, code, name,
|
||||
description,
|
||||
method_auth_name, method_code, method_name, source_crs_auth_name,
|
||||
source_crs_code, target_crs_auth_name, target_crs_code,
|
||||
accuracy, deprecated FROM grid_transformation
|
||||
UNION ALL
|
||||
SELECT 'helmert_transformation' AS table_name, auth_name, code, name,
|
||||
SELECT CAST('helmert_transformation' AS TEXT) AS table_name, auth_name, code, name,
|
||||
description,
|
||||
method_auth_name, method_code, method_name, source_crs_auth_name,
|
||||
source_crs_code, target_crs_auth_name, target_crs_code,
|
||||
accuracy, deprecated FROM helmert_transformation
|
||||
UNION ALL
|
||||
SELECT 'other_transformation' AS table_name, auth_name, code, name,
|
||||
SELECT CAST('other_transformation' AS TEXT) AS table_name, auth_name, code, name,
|
||||
description,
|
||||
method_auth_name, method_code, method_name, source_crs_auth_name,
|
||||
source_crs_code, target_crs_auth_name, target_crs_code,
|
||||
accuracy, deprecated FROM other_transformation
|
||||
UNION ALL
|
||||
SELECT 'concatenated_operation' AS table_name, auth_name, code, name,
|
||||
SELECT CAST('concatenated_operation' AS TEXT) AS table_name, auth_name, code, name,
|
||||
description,
|
||||
NULL, NULL, NULL, source_crs_auth_name,
|
||||
CAST(NULL AS TEXT) as method_auth_name, CAST(NULL AS INTEGER_OR_TEXT) as method_code, CAST(NULL AS TEXT) as method_name, source_crs_auth_name,
|
||||
source_crs_code, target_crs_auth_name, target_crs_code,
|
||||
accuracy, deprecated FROM concatenated_operation
|
||||
;
|
||||
|
||||
CREATE VIEW coordinate_operation_with_conversion_view AS
|
||||
SELECT auth_name, code, table_name AS type FROM coordinate_operation_view UNION ALL
|
||||
SELECT auth_name, code, 'conversion' FROM conversion_table;
|
||||
SELECT auth_name, code, CAST('conversion' AS TEXT) FROM conversion_table;
|
||||
|
||||
CREATE VIEW crs_view AS
|
||||
SELECT 'geodetic_crs' AS table_name, auth_name, code, name, type,
|
||||
SELECT CAST('geodetic_crs' AS TEXT) AS table_name, auth_name, code, name, type,
|
||||
description,
|
||||
deprecated FROM geodetic_crs
|
||||
UNION ALL
|
||||
SELECT 'projected_crs' AS table_name, auth_name, code, name, 'projected',
|
||||
SELECT CAST('projected_crs' AS TEXT) AS table_name, auth_name, code, name, CAST('projected' AS TEXT),
|
||||
description,
|
||||
deprecated FROM projected_crs
|
||||
UNION ALL
|
||||
SELECT 'vertical_crs' AS table_name, auth_name, code, name, 'vertical',
|
||||
SELECT CAST('vertical_crs' AS TEXT) AS table_name, auth_name, code, name, CAST('vertical' AS TEXT),
|
||||
description,
|
||||
deprecated FROM vertical_crs
|
||||
UNION ALL
|
||||
SELECT 'compound_crs' AS table_name, auth_name, code, name, 'compound',
|
||||
SELECT CAST('compound_crs' AS TEXT) AS table_name, auth_name, code, name, CAST('compound' AS TEXT),
|
||||
description,
|
||||
deprecated FROM compound_crs
|
||||
;
|
||||
|
||||
CREATE VIEW object_view AS
|
||||
SELECT 'unit_of_measure' AS table_name, auth_name, code, name, NULL as type, deprecated FROM unit_of_measure
|
||||
SELECT CAST('unit_of_measure' AS TEXT) AS table_name, auth_name, code, name, CAST(NULL AS TEXT) as type, deprecated FROM unit_of_measure
|
||||
UNION ALL
|
||||
SELECT 'celestial_body', auth_name, code, name, NULL, 0 FROM celestial_body
|
||||
SELECT CAST('celestial_body' AS TEXT), auth_name, code, name, CAST(NULL AS TEXT) as type, CAST(0 AS BOOLEAN) AS deprecated FROM celestial_body
|
||||
UNION ALL
|
||||
SELECT 'ellipsoid', auth_name, code, name, NULL, deprecated FROM ellipsoid
|
||||
SELECT CAST('ellipsoid' AS TEXT), auth_name, code, name, CAST(NULL AS TEXT) as type, deprecated FROM ellipsoid
|
||||
UNION ALL
|
||||
SELECT 'extent', auth_name, code, name, NULL, deprecated FROM extent
|
||||
SELECT CAST('extent' AS TEXT), auth_name, code, name, CAST(NULL AS TEXT) as type, deprecated FROM extent
|
||||
UNION ALL
|
||||
SELECT 'prime_meridian', auth_name, code, name, NULL, deprecated FROM prime_meridian
|
||||
SELECT CAST('prime_meridian' AS TEXT), auth_name, code, name, CAST(NULL AS TEXT) as type, deprecated FROM prime_meridian
|
||||
UNION ALL
|
||||
SELECT 'geodetic_datum', auth_name, code, name, CASE WHEN ensemble_accuracy IS NOT NULL THEN 'ensemble' ELSE 'datum' END, deprecated FROM geodetic_datum
|
||||
SELECT CAST('geodetic_datum' AS TEXT), auth_name, code, name, CAST(CASE WHEN ensemble_accuracy IS NOT NULL THEN 'ensemble' ELSE 'datum' END AS TEXT), deprecated FROM geodetic_datum
|
||||
UNION ALL
|
||||
SELECT 'vertical_datum', auth_name, code, name, CASE WHEN ensemble_accuracy IS NOT NULL THEN 'ensemble' ELSE 'datum' END, deprecated FROM vertical_datum
|
||||
SELECT CAST('vertical_datum' AS TEXT), auth_name, code, name, CAST(CASE WHEN ensemble_accuracy IS NOT NULL THEN 'ensemble' ELSE 'datum' END AS TEXT), deprecated FROM vertical_datum
|
||||
UNION ALL
|
||||
SELECT 'axis', auth_name, code, name, NULL, 0 as deprecated FROM axis
|
||||
SELECT CAST('axis' AS TEXT), auth_name, code, name, CAST(NULL AS TEXT) as type, CAST(0 AS BOOLEAN) AS deprecated FROM axis
|
||||
UNION ALL
|
||||
SELECT table_name, auth_name, code, name, type, deprecated FROM crs_view
|
||||
UNION ALL
|
||||
SELECT 'conversion', auth_name, code, name, NULL, deprecated FROM conversion_table
|
||||
SELECT CAST('conversion' AS TEXT), auth_name, code, name, CAST(NULL AS TEXT) as type, deprecated FROM conversion_table
|
||||
UNION ALL
|
||||
SELECT table_name, auth_name, code, name, NULL, deprecated FROM coordinate_operation_view
|
||||
SELECT table_name, auth_name, code, name, CAST(NULL AS TEXT) as type, deprecated FROM coordinate_operation_view
|
||||
;
|
||||
|
||||
CREATE VIEW authority_list AS
|
||||
|
||||
@@ -13,8 +13,8 @@ distribution of the source code and various resource file archives. See
|
||||
Current Release
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
* **2022-12-01** `proj-9.1.1.tar.gz`_ (`md5`_)
|
||||
* **2022-12-01** `proj-data-1.12.tar.gz`_
|
||||
* **2023-03-01** `proj-9.2.0.tar.gz`_ (`md5`_)
|
||||
* **2023-03-01** `proj-data-1.13.tar.gz`_
|
||||
* **PDF Manual** `proj.pdf`_
|
||||
|
||||
.. note::
|
||||
@@ -28,6 +28,7 @@ Current Release
|
||||
Past Releases
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
* **2022-12-01** `proj-9.1.1.tar.gz`_
|
||||
* **2022-09-01** `proj-9.1.0.tar.gz`_
|
||||
* **2022-06-15** `proj-9.0.1.tar.gz`_
|
||||
* **2022-03-01** `proj-9.0.0.tar.gz`_
|
||||
@@ -59,6 +60,7 @@ Past Releases
|
||||
* **2015-09-13** `proj-4.9.2.tar.gz`_
|
||||
* **2015-03-04** `proj-4.9.1.tar.gz`_
|
||||
|
||||
* **2022-12-01** `proj-data-1.12.tar.gz`_
|
||||
* **2022-09-01** `proj-data-1.11.tar.gz`_
|
||||
* **2022-06-15** `proj-data-1.10.tar.gz`_
|
||||
* **2022-03-01** `proj-data-1.9.tar.gz`_
|
||||
@@ -92,8 +94,9 @@ Past Releases
|
||||
* **2018-03-01** `proj-datumgrid-oceania-1.1.zip`_
|
||||
* **2018-03-01** `proj-datumgrid-oceania-1.0.zip`_
|
||||
|
||||
.. _`md5`: https://download.osgeo.org/proj/proj-9.2.0.tar.gz.md5
|
||||
.. _`proj-9.2.0.tar.gz`: https://download.osgeo.org/proj/proj-9.2.0.tar.gz
|
||||
.. _`proj-9.1.1.tar.gz`: https://download.osgeo.org/proj/proj-9.1.1.tar.gz
|
||||
.. _`md5`: https://download.osgeo.org/proj/proj-9.1.1.tar.gz.md5
|
||||
.. _`proj-9.1.0.tar.gz`: https://download.osgeo.org/proj/proj-9.1.0.tar.gz
|
||||
.. _`proj-9.0.1.tar.gz`: https://download.osgeo.org/proj/proj-9.0.1.tar.gz
|
||||
.. _`proj-9.0.0.tar.gz`: https://download.osgeo.org/proj/proj-9.0.0.tar.gz
|
||||
@@ -126,6 +129,7 @@ Past Releases
|
||||
.. _`proj-4.9.2.tar.gz`: https://download.osgeo.org/proj/proj-4.9.2.tar.gz
|
||||
.. _`proj-4.9.3.tar.gz`: https://download.osgeo.org/proj/proj-4.9.3.tar.gz
|
||||
|
||||
.. _`proj-data-1.13.tar.gz`: https://download.osgeo.org/proj/proj-data-1.13.tar.gz
|
||||
.. _`proj-data-1.12.tar.gz`: https://download.osgeo.org/proj/proj-data-1.12.tar.gz
|
||||
.. _`proj-data-1.11.tar.gz`: https://download.osgeo.org/proj/proj-data-1.11.tar.gz
|
||||
.. _`proj-data-1.10.tar.gz`: https://download.osgeo.org/proj/proj-data-1.10.tar.gz
|
||||
|
||||
@@ -3,6 +3,157 @@
|
||||
News
|
||||
###############################################################################
|
||||
|
||||
9.2.0 Release Notes
|
||||
++++++++++++++++++++
|
||||
*March 1st 2023*
|
||||
|
||||
Updates
|
||||
--------
|
||||
|
||||
* Database
|
||||
|
||||
* EPSG updated to EPSG 10.082 (`#3609 <https://github.com/OSGeo/PROJ/issues/3609>`_)
|
||||
|
||||
* ESRI objects updated to v3.1.0 (`#3575 <https://github.com/OSGeo/PROJ/issues/3575>`_)
|
||||
|
||||
* Added Slovenian geoid model SLO-VRP2016/Koper (`#3610 <https://github.com/OSGeo/PROJ/issues/3610>`_)
|
||||
|
||||
* Projections
|
||||
|
||||
* Added generic Space Oblique Mercator (`#3338 <https://github.com/OSGeo/PROJ/issues/3338>`_)
|
||||
|
||||
* Inverse ``eck4``: Add checks for projection domain (`#3625 <https://github.com/OSGeo/PROJ/issues/3625>`_)
|
||||
|
||||
* Transformations
|
||||
|
||||
* Added support for NADCON5 grids and transformation method (`#3510 <https://github.com/OSGeo/PROJ/issues/3510>`_)
|
||||
|
||||
* Added option ``ONLY_BEST=YES`` (`#3535 <https://github.com/OSGeo/PROJ/issues/3535>`_)
|
||||
|
||||
When enabled only use the best possible transformation between two CRS's can be
|
||||
instantiated. If the best possible transfomations can't be instantiated it will
|
||||
fail instead of opting for the next best transformation.
|
||||
|
||||
With ``ONLY_BEST=YES`` a transformation will fail if a needed grid is unavailable.
|
||||
|
||||
The option can be toggled in ``proj.ini`` and with ``--only-best`` in :program:`cs2cs`.
|
||||
|
||||
* Implement 'Similarity transformation' (EPSG:9621) and import related tranformations from EPSG (`#3578 <https://github.com/OSGeo/PROJ/issues/3578>`_)
|
||||
|
||||
* Optimise transformations between GDA94, GDA2020 and WGS84 (`#3621 <https://github.com/OSGeo/PROJ/issues/3621>`_)
|
||||
|
||||
* Performance improvements
|
||||
|
||||
* Pass :c:type:`PJ_COORD` by reference for :c:func:`fwd4d` and :c:func:`inv4d` callbacks (`#3503 <https://github.com/OSGeo/PROJ/issues/3503>`_)
|
||||
|
||||
* Improved of inverse meridian length calculations (`#3516 <https://github.com/OSGeo/PROJ/issues/3516>`_)
|
||||
|
||||
* Avoid very poor performance on a geographic CRS whose datum name is the alias
|
||||
of an official one (`#3624 <https://github.com/OSGeo/PROJ/issues/3624>`_)
|
||||
|
||||
* Well-Known Text improvements
|
||||
|
||||
* Support WKT:2019 COORDINATEMETADATA[] construct (`#2711 <https://github.com/OSGeo/PROJ/issues/2711>`_)
|
||||
|
||||
* implement :cpp:func:`alterCSLinearUnit` for CompoundCRS (`#3325 <https://github.com/OSGeo/PROJ/issues/3325>`_)
|
||||
|
||||
* Implement :cpp:func:`alterCSLinearUnit` for BoundCRS (`#3327 <https://github.com/OSGeo/PROJ/issues/3327>`_)
|
||||
|
||||
* Added :c:type:`PJ_TYPE_DERIVED_PROJECTED_CRS` (`#3488 <https://github.com/OSGeo/PROJ/issues/3488>`_)
|
||||
|
||||
* Added support for ISO19111 CoordinateMetadata class (`#3562 <https://github.com/OSGeo/PROJ/issues/3562>`_)
|
||||
|
||||
* Update WKT import to support WKT2 corrigendum (`#3573 <https://github.com/OSGeo/PROJ/issues/3573>`_)
|
||||
|
||||
* WKT import: Make axis direction and range meaning enumeration case
|
||||
insensitive as mandated by spec (`#3577 <https://github.com/OSGeo/PROJ/issues/3577>`_)
|
||||
|
||||
* Implement AffineCS and handle it in WKT (`#3579 <https://github.com/OSGeo/PROJ/issues/3579>`_)
|
||||
|
||||
* WKT1 parser: Support ``inf`` as inverse flattening value (`#3626 <https://github.com/OSGeo/PROJ/issues/3626>`_)
|
||||
|
||||
* PROJJSON
|
||||
|
||||
* Version number changed to 0.6
|
||||
|
||||
* Added an additional optional ``source_crs`` property in ``abridged_transformation`` (`#3454 <https://github.com/OSGeo/PROJ/issues/3454>`_)
|
||||
|
||||
* Added support for ISO19111 CoordinateMetadata class (`#3562 <https://github.com/OSGeo/PROJ/issues/3562>`_)
|
||||
|
||||
* Implement AffineCS and handle it in PROJJSON (`#3579 <https://github.com/OSGeo/PROJ/issues/3579>`_)
|
||||
|
||||
* C/C++ API
|
||||
|
||||
* C API: add :c:func:`proj_get_domain_count()`, :c:func:`proj_get_area_of_use_ex()` and :c:func:`proj_get_scope_ex()` (`#3588 <https://github.com/OSGeo/PROJ/issues/3588>`_)
|
||||
|
||||
* Added explicit ``NaN`` handling to :c:func:`proj_trans` and :program:`gie` (`#3603 <https://github.com/OSGeo/PROJ/issues/3603>`_)
|
||||
|
||||
|
||||
**DEPRECATIONS**
|
||||
|
||||
The following functions have been deprecated and will be removed in a future version.
|
||||
|
||||
* C API function :c:func:`proj_rtodms`. Use :c:func:`proj_rtodms2` instead (`#3431 <https://github.com/OSGeo/PROJ/issues/3431>`_)
|
||||
|
||||
* C experimental API function :c:func:`proj_create_conversion_tunisia_mapping_grid()`.
|
||||
Use :c:func:`proj_create_conversion_tunisia_mining_grid()` instead (`#3559 <https://github.com/OSGeo/PROJ/issues/3559>`_)
|
||||
|
||||
* C++ API function :cpp:func:`createTunisiaMapingGrid()`. Use :cpp:func:`createTunisiaMiningGrid()` instead (`#3559 <https://github.com/OSGeo/PROJ/issues/3559>`_)
|
||||
|
||||
|
||||
* CMake
|
||||
|
||||
* Added ``uninstall`` target (`#3362 <https://github.com/OSGeo/PROJ/issues/3362>`_)
|
||||
|
||||
* Adopted use of ``TIFF:TIFF`` and ``CURL::libcurl`` targets (`#3374 <https://github.com/OSGeo/PROJ/issues/3374>`_)
|
||||
|
||||
+ Security improvements
|
||||
|
||||
* Replaced uses of :c:func:`sprintf` with the safer :c:func:`snprintf` (`#3421 <https://github.com/OSGeo/PROJ/issues/3421>`_, `#3431 <https://github.com/OSGeo/PROJ/issues/3431>`_)
|
||||
|
||||
+ Various other improvements
|
||||
|
||||
* Implemented platform independent mutex for better results on lesser used platforms (`#3425 <https://github.com/OSGeo/PROJ/issues/3425>`_)
|
||||
|
||||
* Improved name and remarks in descriptions of some vertical transformations (`#3334 <https://github.com/OSGeo/PROJ/issues/3334>`_)
|
||||
|
||||
* Implemented stricter matching by name to avoid false positives (`#3487 <https://github.com/OSGeo/PROJ/issues/3487>`_)
|
||||
|
||||
* Improved numerical accuracy of the meridian length calculations and its inverse (`#3516 <https://github.com/OSGeo/PROJ/issues/3516>`_)
|
||||
|
||||
* Added ``PROJ_IGNORE_CELESTIAL_BODY=YES`` environment variable that allows better matching of
|
||||
non-earth shaped ellipsoids to other celestial bodies (`#3569 <https://github.com/OSGeo/PROJ/issues/3569>`_)
|
||||
|
||||
Bug fixes
|
||||
----------
|
||||
|
||||
* :c:func:`rtodms()`: fix potential buffer overflow not dealt with (`#3441 <https://github.com/OSGeo/PROJ/issues/3441>`_)
|
||||
|
||||
* :cpp:func:`NetworkFile::open()`: fix memory leak in unlikely error code path (`#3443 <https://github.com/OSGeo/PROJ/issues/3443>`_)
|
||||
|
||||
* When importing LOCAL_CS["foo"], generates a non-empty name for the datum (`#3491 <https://github.com/OSGeo/PROJ/issues/3491>`_)
|
||||
|
||||
* Avoid unit mix-up in :cpp:func:`CRS::alterCSLinearUnit` for ``DerivedProjectedCRS`` (`#3499 <https://github.com/OSGeo/PROJ/issues/3499>`_)
|
||||
|
||||
* WKT to PROJ conversions: Map 'Lambert Azimuthal Equal Area (Spherical)' to ``+proj=laea +R_A`` (`#3526 <https://github.com/OSGeo/PROJ/issues/3526>`_)
|
||||
|
||||
* ProjectedCRS::identify(): Relax trust in id/authority in definition to identify (`#3532 <https://github.com/OSGeo/PROJ/issues/3532>`_)
|
||||
|
||||
* Fix instantion of http://www.opengis.net/def/crs/IAU/2015/xxx URNs (`#3569 <https://github.com/OSGeo/PROJ/issues/3569>`_)
|
||||
|
||||
* Fix :c:func:`proj_normalize_for_visualization()` on a transformation with ``FORCE_OVERb=YES`` (`#3570 <https://github.com/OSGeo/PROJ/issues/3570>`_)
|
||||
|
||||
* :cpp:func:`createBoundCRSToWGS84IfPossible()`: Do not report ``+towgs84`` for a CRS with multiple extents,
|
||||
such as EPSG:6316 (`#3587 <https://github.com/OSGeo/PROJ/issues/3587>`_)
|
||||
|
||||
* :c:func:`pj_get_suggested_operation()`: handle longitudes outside of [-180,180] for coordinate
|
||||
operation selection (`#3595 <https://github.com/OSGeo/PROJ/issues/3595>`_)
|
||||
|
||||
* WKT1 parser: only emit warning when encountering invalid UNKNOWN WKT1 axis direction (`#3618 <https://github.com/OSGeo/PROJ/issues/3618>`_)
|
||||
|
||||
* :program:`projinfo`: fix long option name ``--source-crs`` (`#3601 <https://github.com/OSGeo/PROJ/issues/3601>`_)
|
||||
|
||||
|
||||
|
||||
9.1.1 Release Notes
|
||||
++++++++++++++++++++
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include "proj_json_streaming_writer.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
using namespace NS_PROJ::internal;
|
||||
@@ -149,6 +150,17 @@ CoordinateMetadata::coordinateEpoch() PROJ_PURE_DEFN {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Avoid rounding issues due to year -> second (SI unit) -> year roundtrips
|
||||
static double getRoundedEpochInDecimalYear(double year) {
|
||||
// Try to see if the value is close to xxxx.yyy decimal year.
|
||||
if (std::fabs(1000 * year - std::round(1000 * year)) <= 1e-3) {
|
||||
year = std::round(1000 * year) / 1000.0;
|
||||
}
|
||||
return year;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/** \brief Get the coordinate epoch associated with this CoordinateMetadata
|
||||
* object, as decimal year.
|
||||
*
|
||||
@@ -157,8 +169,9 @@ CoordinateMetadata::coordinateEpoch() PROJ_PURE_DEFN {
|
||||
*/
|
||||
double CoordinateMetadata::coordinateEpochAsDecimalYear() PROJ_PURE_DEFN {
|
||||
if (d->coordinateEpoch_.has_value()) {
|
||||
return d->coordinateEpoch_->coordinateEpoch().convertToUnit(
|
||||
common::UnitOfMeasure::YEAR);
|
||||
return getRoundedEpochInDecimalYear(
|
||||
d->coordinateEpoch_->coordinateEpoch().convertToUnit(
|
||||
common::UnitOfMeasure::YEAR));
|
||||
}
|
||||
return std::numeric_limits<double>::quiet_NaN();
|
||||
}
|
||||
|
||||
+17
-3
@@ -119,11 +119,23 @@ void Datum::Private::exportAnchorDefinition(io::WKTFormatter *formatter) const {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Avoid rounding issues due to year -> second (SI unit) -> year roundtrips
|
||||
static double getRoundedEpochInDecimalYear(double year) {
|
||||
// Try to see if the value is close to xxxx.yyy decimal year.
|
||||
if (std::fabs(1000 * year - std::round(1000 * year)) <= 1e-3) {
|
||||
year = std::round(1000 * year) / 1000.0;
|
||||
}
|
||||
return year;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void Datum::Private::exportAnchorEpoch(io::WKTFormatter *formatter) const {
|
||||
if (anchorEpoch->has_value()) {
|
||||
formatter->startNode(io::WKTConstants::ANCHOREPOCH, false);
|
||||
formatter->add(
|
||||
(*anchorEpoch)->convertToUnit(common::UnitOfMeasure::YEAR));
|
||||
const double year =
|
||||
(*anchorEpoch)->convertToUnit(common::UnitOfMeasure::YEAR);
|
||||
formatter->add(getRoundedEpochInDecimalYear(year));
|
||||
formatter->endNode();
|
||||
}
|
||||
}
|
||||
@@ -145,7 +157,9 @@ void Datum::Private::exportAnchorEpoch(io::JSONFormatter *formatter) const {
|
||||
if (anchorEpoch->has_value()) {
|
||||
auto writer = formatter->writer();
|
||||
writer->AddObjKey("anchor_epoch");
|
||||
writer->Add((*anchorEpoch)->convertToUnit(common::UnitOfMeasure::YEAR));
|
||||
const double year =
|
||||
(*anchorEpoch)->convertToUnit(common::UnitOfMeasure::YEAR);
|
||||
writer->Add(getRoundedEpochInDecimalYear(year));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3422,7 +3422,11 @@ DatabaseContext::getAliasFromOfficialName(const std::string &officialName,
|
||||
}
|
||||
sql += " ORDER BY deprecated";
|
||||
auto res = d->run(sql, {officialName});
|
||||
if (res.empty()) {
|
||||
// Sorry for the hack excluding NAD83 + geographic_3D_crs, but otherwise
|
||||
// EPSG has a weird alias from NAD83 to EPSG:4152 which happens to be
|
||||
// NAD83(HARN), and that's definitely not desirable.
|
||||
if (res.empty() &&
|
||||
!(officialName == "NAD83" && tableName == "geographic_3D_crs")) {
|
||||
res = d->run(
|
||||
"SELECT auth_name, code FROM alias_name WHERE table_name = ? AND "
|
||||
"alt_name = ? AND source IN ('EPSG', 'PROJ')",
|
||||
|
||||
@@ -1189,13 +1189,15 @@ TEST(gie, proj_create_crs_to_crs_from_pj_force_over) {
|
||||
|
||||
// Test a point along the equator.
|
||||
// The same point, but in two different representations.
|
||||
input.xyz.x = 0; // Lat in deg
|
||||
input.xyz.y = 140; // Long in deg
|
||||
input.xyz.z = 0;
|
||||
input.xyzt.x = 0; // Lat in deg
|
||||
input.xyzt.y = 140; // Long in deg
|
||||
input.xyzt.z = 0;
|
||||
input.xyzt.t = HUGE_VAL;
|
||||
|
||||
input_over.xyz.x = 0; // Lat in deg
|
||||
input_over.xyz.y = -220; // Long in deg
|
||||
input_over.xyz.z = 0;
|
||||
input_over.xyzt.x = 0; // Lat in deg
|
||||
input_over.xyzt.y = -220; // Long in deg
|
||||
input_over.xyzt.z = 0;
|
||||
input_over.xyzt.t = HUGE_VAL;
|
||||
|
||||
auto output = proj_trans(P, PJ_FWD, input);
|
||||
auto output_over = proj_trans(P, PJ_FWD, input_over);
|
||||
@@ -1230,9 +1232,10 @@ TEST(gie, proj_create_crs_to_crs_from_pj_force_over) {
|
||||
ASSERT_TRUE(Pnormalized->over);
|
||||
|
||||
PJ_COORD input_over_normalized;
|
||||
input_over_normalized.xyz.x = -220; // Long in deg
|
||||
input_over_normalized.xyz.y = 0; // Lat in deg
|
||||
input_over_normalized.xyz.z = 0;
|
||||
input_over_normalized.xyzt.x = -220; // Long in deg
|
||||
input_over_normalized.xyzt.y = 0; // Lat in deg
|
||||
input_over_normalized.xyzt.z = 0;
|
||||
input_over_normalized.xyzt.t = HUGE_VAL;
|
||||
auto output_over_normalized =
|
||||
proj_trans(Pnormalized, PJ_FWD, input_over_normalized);
|
||||
EXPECT_NEAR(output_over_normalized.xyz.x, -24490287.974520184, 1e-8);
|
||||
@@ -1253,13 +1256,15 @@ TEST(gie, proj_create_crs_to_crs_from_pj_force_over) {
|
||||
PJ_COORD input;
|
||||
PJ_COORD input_notOver;
|
||||
|
||||
input.xyz.x = 0; // Lat in deg
|
||||
input.xyz.y = 140; // Long in deg
|
||||
input.xyz.z = 0;
|
||||
input.xyzt.x = 0; // Lat in deg
|
||||
input.xyzt.y = 140; // Long in deg
|
||||
input.xyzt.z = 0;
|
||||
input.xyzt.t = HUGE_VAL;
|
||||
|
||||
input_notOver.xyz.x = 0; // Lat in deg
|
||||
input_notOver.xyz.y = -220; // Long in deg
|
||||
input_notOver.xyz.z = 0;
|
||||
input_notOver.xyzt.x = 0; // Lat in deg
|
||||
input_notOver.xyzt.y = -220; // Long in deg
|
||||
input_notOver.xyzt.z = 0;
|
||||
input_notOver.xyzt.t = HUGE_VAL;
|
||||
|
||||
auto output = proj_trans(P, PJ_FWD, input);
|
||||
auto output_notOver = proj_trans(P, PJ_FWD, input_notOver);
|
||||
@@ -1282,13 +1287,15 @@ TEST(gie, proj_create_crs_to_crs_from_pj_force_over) {
|
||||
PJ_COORD input;
|
||||
PJ_COORD input_notOver;
|
||||
|
||||
input.xyz.x = 0; // Lat in deg
|
||||
input.xyz.y = 140; // Long in deg
|
||||
input.xyz.z = 0;
|
||||
input.xyzt.x = 0; // Lat in deg
|
||||
input.xyzt.y = 140; // Long in deg
|
||||
input.xyzt.z = 0;
|
||||
input.xyzt.t = HUGE_VAL;
|
||||
|
||||
input_notOver.xyz.x = 0; // Lat in deg
|
||||
input_notOver.xyz.y = -220; // Long in deg
|
||||
input_notOver.xyz.z = 0;
|
||||
input_notOver.xyzt.x = 0; // Lat in deg
|
||||
input_notOver.xyzt.y = -220; // Long in deg
|
||||
input_notOver.xyzt.z = 0;
|
||||
input_notOver.xyzt.t = HUGE_VAL;
|
||||
|
||||
auto output = proj_trans(P, PJ_FWD, input);
|
||||
auto output_notOver = proj_trans(P, PJ_FWD, input_notOver);
|
||||
@@ -1313,13 +1320,15 @@ TEST(gie, proj_create_crs_to_crs_from_pj_force_over) {
|
||||
PJ_COORD input;
|
||||
PJ_COORD input_over;
|
||||
|
||||
input.xyz.x = 0; // Lat in deg
|
||||
input.xyz.y = 140; // Long in deg
|
||||
input.xyz.z = 0;
|
||||
input.xyzt.x = 0; // Lat in deg
|
||||
input.xyzt.y = 140; // Long in deg
|
||||
input.xyzt.z = 0;
|
||||
input.xyzt.t = HUGE_VAL;
|
||||
|
||||
input_over.xyz.x = 0; // Lat in deg
|
||||
input_over.xyz.y = -220; // Long in deg
|
||||
input_over.xyz.z = 0;
|
||||
input_over.xyzt.x = 0; // Lat in deg
|
||||
input_over.xyzt.y = -220; // Long in deg
|
||||
input_over.xyzt.z = 0;
|
||||
input_over.xyzt.t = HUGE_VAL;
|
||||
|
||||
auto output = proj_trans(P, PJ_FWD, input);
|
||||
auto output_over = proj_trans(P, PJ_FWD, input_over);
|
||||
@@ -1337,9 +1346,10 @@ TEST(gie, proj_create_crs_to_crs_from_pj_force_over) {
|
||||
}
|
||||
|
||||
PJ_COORD input_over_normalized;
|
||||
input_over_normalized.xyz.x = -220; // Long in deg
|
||||
input_over_normalized.xyz.y = 0; // Lat in deg
|
||||
input_over_normalized.xyz.z = 0;
|
||||
input_over_normalized.xyzt.x = -220; // Long in deg
|
||||
input_over_normalized.xyzt.y = 0; // Lat in deg
|
||||
input_over_normalized.xyzt.z = 0;
|
||||
input_over_normalized.xyzt.t = HUGE_VAL;
|
||||
auto output_over_normalized =
|
||||
proj_trans(Pnormalized, PJ_FWD, input_over_normalized);
|
||||
EXPECT_NEAR(output_over_normalized.xyz.x, 4980122.749364435, 1e-8);
|
||||
@@ -1360,13 +1370,15 @@ TEST(gie, proj_create_crs_to_crs_from_pj_force_over) {
|
||||
PJ_COORD input;
|
||||
PJ_COORD input_over;
|
||||
|
||||
input.xyz.x = 0; // Lat in deg
|
||||
input.xyz.y = 140; // Long in deg
|
||||
input.xyz.z = 0;
|
||||
input.xyzt.x = 0; // Lat in deg
|
||||
input.xyzt.y = 140; // Long in deg
|
||||
input.xyzt.z = 0;
|
||||
input.xyzt.t = HUGE_VAL;
|
||||
|
||||
input_over.xyz.x = 0; // Lat in deg
|
||||
input_over.xyz.y = -220; // Long in deg
|
||||
input_over.xyz.z = 0;
|
||||
input_over.xyzt.x = 0; // Lat in deg
|
||||
input_over.xyzt.y = -220; // Long in deg
|
||||
input_over.xyzt.z = 0;
|
||||
input_over.xyzt.t = HUGE_VAL;
|
||||
|
||||
auto output = proj_trans(P, PJ_FWD, input);
|
||||
auto output_over = proj_trans(P, PJ_FWD, input_over);
|
||||
|
||||
@@ -588,6 +588,31 @@ TEST(crs, geographic3D_crs_as_WKT1_ESRI_database) {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
TEST(crs, geographic3D_NAD83_as_WKT1_ESRI_database) {
|
||||
auto dbContext = DatabaseContext::create();
|
||||
auto obj = WKTParser().attachDatabaseContext(dbContext).createFromWKT(
|
||||
"GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\","
|
||||
"SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],"
|
||||
"PRIMEM[\"Greenwich\",0.0],"
|
||||
"UNIT[\"Degree\",0.0174532925199433]],"
|
||||
"VERTCS[\"NAD_1983\",DATUM[\"D_North_American_1983\","
|
||||
"SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],"
|
||||
"PARAMETER[\"Vertical_Shift\",0.0],"
|
||||
"PARAMETER[\"Direction\",1.0],UNIT[\"Meter\",1.0]]");
|
||||
auto crs = nn_dynamic_pointer_cast<GeographicCRS>(obj);
|
||||
ASSERT_TRUE(crs != nullptr);
|
||||
WKTFormatterNNPtr f(
|
||||
WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext));
|
||||
const auto wkt = "GEOGCS[\"GCS_NAD83\",DATUM[\"D_North_American_1983\","
|
||||
"SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],"
|
||||
"PRIMEM[\"Greenwich\",0.0],"
|
||||
"UNIT[\"Degree\",0.0174532925199433],"
|
||||
"LINUNIT[\"Meter\",1.0]]";
|
||||
EXPECT_EQ(crs->exportToWKT(f.get()), wkt);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
TEST(crs, GeographicCRS_is2DPartOf3D) {
|
||||
EXPECT_TRUE(GeographicCRS::EPSG_4326->is2DPartOf3D(
|
||||
NN_NO_CHECK(GeographicCRS::EPSG_4979.get())));
|
||||
|
||||
@@ -13163,11 +13163,13 @@ TEST(json_import, geodetic_reference_frame_with_explicit_prime_meridian) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
TEST(json_import, geodetic_reference_frame_with_anchor_epoch) {
|
||||
// Use dummy anchor_epoch = 0 to avoid fp issues on some architectures
|
||||
// (cf https://github.com/OSGeo/PROJ/issues/3632)
|
||||
auto json = "{\n"
|
||||
" \"$schema\": \"foo\",\n"
|
||||
" \"type\": \"GeodeticReferenceFrame\",\n"
|
||||
" \"name\": \"my_name\",\n"
|
||||
" \"anchor_epoch\": 2002.5,\n"
|
||||
" \"anchor_epoch\": 0,\n"
|
||||
" \"ellipsoid\": {\n"
|
||||
" \"name\": \"WGS 84\",\n"
|
||||
" \"semi_major_axis\": 6378137,\n"
|
||||
@@ -15537,12 +15539,14 @@ TEST(json_import, vertical_crs_with_geoid_model_and_interpolation_crs) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
TEST(json_import, vertical_reference_frame_with_anchor_epoch) {
|
||||
// Use dummy anchor_epoch = 0 to avoid fp issues on some architectures
|
||||
// (cf https://github.com/OSGeo/PROJ/issues/3632)
|
||||
auto json = "{\n"
|
||||
" \"$schema\": \"foo\",\n"
|
||||
" \"type\": \"VerticalReferenceFrame\",\n"
|
||||
" \"name\": \"my_name\",\n"
|
||||
" \"anchor\": \"my_anchor_definition\",\n"
|
||||
" \"anchor_epoch\": 2002.5\n"
|
||||
" \"anchor_epoch\": 0\n"
|
||||
"}";
|
||||
auto obj = createFromUserInput(json, nullptr);
|
||||
auto vrf = nn_dynamic_pointer_cast<VerticalReferenceFrame>(obj);
|
||||
|
||||
Reference in New Issue
Block a user