- if ((proj_parm.rw = pj_param(par.params, "dW").f) <= 0)
- BOOST_THROW_EXCEPTION( projection_exception(-27) );
- proj_parm.hrw = 0.5 * (proj_parm.rw = 1. / proj_parm.rw);
- phi1 = pj_param(par.params, "rlat_1").f;
- if (fabs(fabs(phi1 = sin(phi1)) - 1.) < TOL)
- BOOST_THROW_EXCEPTION( projection_exception(-22) );
- proj_parm.a1 = pow((1. - phi1)/(1. + phi1), proj_parm.hrw);
+ proj_parm.rw = 0.0;
+ bool is_w_set = pj_param_f<srs::spar::w>(params, "W", srs::dpar::w, proj_parm.rw);
+
+ // Boost.Geometry specific, set default parameters manually
+ if (! is_w_set) {
+ bool const use_defaults = ! pj_get_param_b<srs::spar::no_defs>(params, "no_defs", srs::dpar::no_defs);
+ if (use_defaults) {
+ proj_parm.rw = 2;
+ }
+ }
+
+ if (proj_parm.rw <= 0)
+ BOOST_THROW_EXCEPTION( projection_exception(error_w_or_m_zero_or_less) );
+
+ proj_parm.rw = 1. / proj_parm.rw;
+ proj_parm.hrw = 0.5 * proj_parm.rw;
+ phi1 = pj_get_param_r<T, srs::spar::lat_1>(params, "lat_1", srs::dpar::lat_1);
+ if (fabs(fabs(phi1 = sin(phi1)) - 1.) < tolerance)
+ BOOST_THROW_EXCEPTION( projection_exception(error_lat_larger_than_90) );
+
+ proj_parm.a1 = math::pow((T(1) - phi1)/(T(1) + phi1), proj_parm.hrw);
+