aboutsummaryrefslogtreecommitdiff
path: root/src/4D_api.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-10-16 18:26:09 +0200
committerGitHub <noreply@github.com>2020-10-16 18:26:09 +0200
commit82b496fb32df0b6705159cd5c626aab20c8e9d39 (patch)
treeb6652073c9d66960e5c16d61055c53ffc3f8656f /src/4D_api.cpp
parent93508fbec18e192646f2890e1ceb86de4cc9fd35 (diff)
parent686713479eb0b39feb5369b82647f96edf809b6c (diff)
downloadPROJ-82b496fb32df0b6705159cd5c626aab20c8e9d39.tar.gz
PROJ-82b496fb32df0b6705159cd5c626aab20c8e9d39.zip
Merge pull request #2370 from rouault/epsg10
Update to EPSG 10.003 and make code base robust to dealing with WKT CRS with DatumEnsemble
Diffstat (limited to 'src/4D_api.cpp')
-rw-r--r--src/4D_api.cpp36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/4D_api.cpp b/src/4D_api.cpp
index 75fa6d04..3c6ab802 100644
--- a/src/4D_api.cpp
+++ b/src/4D_api.cpp
@@ -1069,28 +1069,18 @@ static PJ* create_operation_to_geog_crs(PJ_CONTEXT* ctx, const PJ* crs) {
geodetic_crs_type == PJ_TYPE_GEOGRAPHIC_3D_CRS )
{
auto datum = proj_crs_get_datum(ctx, geodetic_crs);
- if( datum )
- {
- auto cs = proj_create_ellipsoidal_2D_cs(
- ctx, PJ_ELLPS2D_LONGITUDE_LATITUDE, nullptr, 0);
- auto ellps = proj_get_ellipsoid(ctx, datum);
- proj_destroy(datum);
- double semi_major_metre = 0;
- double inv_flattening = 0;
- proj_ellipsoid_get_parameters(ctx, ellps, &semi_major_metre,
- nullptr, nullptr, &inv_flattening);
- auto temp = proj_create_geographic_crs(
- ctx, "unnamed crs", "unnamed datum",
- proj_get_name(ellps),
- semi_major_metre, inv_flattening,
- "Reference prime meridian", 0, nullptr, 0,
- cs);
- proj_destroy(ellps);
- proj_destroy(cs);
- proj_destroy(geodetic_crs);
- geodetic_crs = temp;
- geodetic_crs_type = proj_get_type(geodetic_crs);
- }
+ auto datum_ensemble = proj_crs_get_datum_ensemble(ctx, geodetic_crs);
+ auto cs = proj_create_ellipsoidal_2D_cs(
+ ctx, PJ_ELLPS2D_LONGITUDE_LATITUDE, nullptr, 0);
+ auto temp = proj_create_geographic_crs_from_datum(
+ ctx, "unnamed crs", datum ? datum : datum_ensemble,
+ cs);
+ proj_destroy(datum);
+ proj_destroy(datum_ensemble);
+ proj_destroy(cs);
+ proj_destroy(geodetic_crs);
+ geodetic_crs = temp;
+ geodetic_crs_type = proj_get_type(geodetic_crs);
}
if( geodetic_crs_type != PJ_TYPE_GEOGRAPHIC_2D_CRS )
{
@@ -1233,7 +1223,7 @@ std::vector<CoordOperation> pj_create_prepared_operations(PJ_CONTEXT *ctx,
&west_lon, &south_lat, &east_lon, &north_lat, &areaName) )
{
const bool isOffshore =
- areaName && strstr(areaName, "offshore");
+ areaName && strstr(areaName, "- offshore");
if( west_lon <= east_lon )
{
op = add_coord_op_to_list(i, op,