diff options
| -rw-r--r-- | src/apply_gridshift.cpp | 9 | ||||
| -rw-r--r-- | src/iso19111/io.cpp | 10 | ||||
| -rwxr-xr-x | test/cli/testvarious | 12 | ||||
| -rw-r--r-- | test/cli/tv_out.dist | 6 |
4 files changed, 33 insertions, 4 deletions
diff --git a/src/apply_gridshift.cpp b/src/apply_gridshift.cpp index fcd9fa01..e6c7b2b1 100644 --- a/src/apply_gridshift.cpp +++ b/src/apply_gridshift.cpp @@ -344,7 +344,14 @@ PJ_LP proj_hgrid_apply(PJ *P, PJ_LP lp, PJ_DIRECTION direction) { ct = find_ctable(P->ctx, lp, P->gridlist_count, P->gridlist); if (ct == nullptr || ct->cvs == nullptr) { - pj_ctx_set_errno( P->ctx, PJD_ERR_FAILED_TO_LOAD_GRID ); + if( P->gridlist_count == 1 && + strcmp(P->gridlist[0]->gridname, "null") == 0) { + // TODO: remove this particular case that is put there just to be + // able to handle longitudes outside of -180,180 + out = lp; + } else { + pj_ctx_set_errno( P->ctx, PJD_ERR_FAILED_TO_LOAD_GRID ); + } return out; } diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 3b630a10..20a90946 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -8255,6 +8255,7 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS( } auto axisType = AxisType::REGULAR; + bool bWebMercator = false; if (step.name == "tmerc" && ((getParamValue(step, "axis") == "wsu" && iAxisSwap < 0) || @@ -8337,8 +8338,7 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS( } } if (getNumericValue(getParamValue(step, "a")) == 6378137) { - return createPseudoMercator(PropertyMap().set( - IdentifiedObject::NAME_KEY, "WGS 84 / Pseudo-Mercator")); + bWebMercator = true; } } else if (hasParamValue(step, "lat_ts")) { mapping = getMapping(EPSG_CODE_METHOD_MERCATOR_VARIANT_B); @@ -8599,7 +8599,11 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS( props.set("IMPLICIT_CS", true); - CRSNNPtr crs = ProjectedCRS::create(props, geogCRS, NN_NO_CHECK(conv), cs); + CRSNNPtr crs = + bWebMercator + ? createPseudoMercator(props.set(IdentifiedObject::NAME_KEY, + "WGS 84 / Pseudo-Mercator")) + : ProjectedCRS::create(props, geogCRS, NN_NO_CHECK(conv), cs); if (!hasParamValue(step, "geoidgrids") && (hasParamValue(step, "vunits") || hasParamValue(step, "vto_meter"))) { diff --git a/test/cli/testvarious b/test/cli/testvarious index 836158ca..6c00ba13 100755 --- a/test/cli/testvarious +++ b/test/cli/testvarious @@ -985,6 +985,18 @@ $EXE -f %.7f -I +proj=longlat +ellps=GRS80 +to +proj=ob_tran +o_proj=longlat +lo -122 46 EOF +echo "##############################################################" >> ${OUT} +echo "Check +init=epsg:4326 +over +to +init=epsg:3857 +over" >> ${OUT} +$EXE -f %.7f +init=epsg:4326 +over +to +init=epsg:3857 +over -E >>${OUT} <<EOF +-181 49 +EOF + +echo "##############################################################" >> ${OUT} +echo "Check +proj=longlat +over +datum=WGS84 +to proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +over" >> ${OUT} +$EXE -f %.7f +proj=longlat +over +datum=WGS84 +to proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +over -E >>${OUT} <<EOF +-181 49 +EOF + # Done! # do 'diff' with distribution results diff --git a/test/cli/tv_out.dist b/test/cli/tv_out.dist index 13987332..8720a124 100644 --- a/test/cli/tv_out.dist +++ b/test/cli/tv_out.dist @@ -473,3 +473,9 @@ Check ob_tran with o_proj=longlat (#1525) -122 46 -132.0000000 46.0000000 0.0000000 Test inverse handling -122 46 -112.0000000 46.0000000 0.0000000 +############################################################## +Check +init=epsg:4326 +over +to +init=epsg:3857 +over +-181 49 -20148827.8335825 6274861.3940066 0.0000000 +############################################################## +Check +proj=longlat +over +datum=WGS84 +to proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +over +-181 49 -20148827.8335825 6274861.3940066 0.0000000 |
