Skip to content

Commit

Permalink
replace robinson coefficients table, add test (#113)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2374 4e78687f-474d-0410-85f9-8d5e500ac6b2
  • Loading branch information
warmerdam committed Jul 2, 2013
1 parent a865692 commit d856016
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 42 deletions.
8 changes: 8 additions & 0 deletions nad/testvarious
Expand Up @@ -245,6 +245,14 @@ $EXE +proj=latlong +datum=WGS84 \
-E >>${OUT} <<EOF
-30 40
-35 45
20 40
EOF
$EXE +proj=robin +datum=WGS84 \
+to +proj=latlong +datum=WGS84 \
-E >>${OUT} <<EOF
-2612095.95 4276351.58 0.00
-2963455.42 4805073.65 0.00
1741397.30 4276351.58 0.00
EOF
echo "##############################################################" >> ${OUT}
echo "Test forward projection on sphere" >> ${OUT}
Expand Down
4 changes: 4 additions & 0 deletions nad/tv_out.dist
Expand Up @@ -87,6 +87,10 @@ Test transverse mercator inverse (#97)
Test robinson projection (#113)
-30 40 -2612095.95 4276351.58 0.00
-35 45 -2963455.42 4805073.65 0.00
20 40 1741397.30 4276351.58 0.00
-2612095.95 4276351.58 0.00 30d0'0.004"W 40d0'0.066"N 0.000
-2963455.42 4805073.65 0.00 35dW 45dN 0.000
1741397.30 4276351.58 0.00 20d0'0.002"E 40d0'0.066"N 0.000
##############################################################
Test forward projection on sphere
0 41.81031 0.00000 0.78540 0.00000
Expand Down
97 changes: 55 additions & 42 deletions src/PJ_robin.c
Expand Up @@ -3,49 +3,62 @@
PROJ_HEAD(robin, "Robinson") "\n\tPCyl., Sph.";
#define V(C,z) (C.c0 + z * (C.c1 + z * (C.c2 + z * C.c3)))
#define DV(C,z) (C.c1 + z * (C.c2 + C.c2 + z * 3. * C.c3))
/* note: following terms based upon 5 deg. intervals in degrees. */
static struct COEFS {

/*
note: following terms based upon 5 deg. intervals in degrees.
Some background on these coefficients is available at:
http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039
http://trac.osgeo.org/proj/ticket/113
*/

struct COEFS {
float c0, c1, c2, c3;
} X[] = {
{1, -5.67239e-12, -7.15511e-05, 3.11028e-06},
{0.9986, -0.000482241, -2.4897e-05, -1.33094e-06},
{0.9954, -0.000831031, -4.4861e-05, -9.86588e-07},
{0.99, -0.00135363, -5.96598e-05, 3.67749e-06},
{0.9822, -0.00167442, -4.4975e-06, -5.72394e-06},
{0.973, -0.00214869, -9.03565e-05, 1.88767e-08},
{0.96, -0.00305084, -9.00732e-05, 1.64869e-06},
{0.9427, -0.00382792, -6.53428e-05, -2.61493e-06},
{0.9216, -0.00467747, -0.000104566, 4.8122e-06},
{0.8962, -0.00536222, -3.23834e-05, -5.43445e-06},
{0.8679, -0.00609364, -0.0001139, 3.32521e-06},
{0.835, -0.00698325, -6.40219e-05, 9.34582e-07},
{0.7986, -0.00755337, -5.00038e-05, 9.35532e-07},
{0.7597, -0.00798325, -3.59716e-05, -2.27604e-06},
{0.7186, -0.00851366, -7.0112e-05, -8.63072e-06},
{0.6732, -0.00986209, -0.000199572, 1.91978e-05},
{0.6213, -0.010418, 8.83948e-05, 6.24031e-06},
{0.5722, -0.00906601, 0.000181999, 6.24033e-06},
{0.5322, 0.,0.,0.} },
Y[] = {
{0, 0.0124, 3.72529e-10, 1.15484e-09},
{0.062, 0.0124001, 1.76951e-08, -5.92321e-09},
{0.124, 0.0123998, -7.09668e-08, 2.25753e-08},
{0.186, 0.0124008, 2.66917e-07, -8.44523e-08},
{0.248, 0.0123971, -9.99682e-07, 3.15569e-07},
{0.31, 0.0124108, 3.73349e-06, -1.1779e-06},
{0.372, 0.0123598, -1.3935e-05, 4.39588e-06},
{0.434, 0.0125501, 5.20034e-05, -1.00051e-05},
{0.4958, 0.0123198, -9.80735e-05, 9.22397e-06},
{0.5571, 0.0120308, 4.02857e-05, -5.2901e-06},
{0.6176, 0.0120369, -3.90662e-05, 7.36117e-07},
{0.6769, 0.0117015, -2.80246e-05, -8.54283e-07},
{0.7346, 0.0113572, -4.08389e-05, -5.18524e-07},
{0.7903, 0.0109099, -4.86169e-05, -1.0718e-06},
{0.8435, 0.0103433, -6.46934e-05, 5.36384e-09},
{0.8936, 0.00969679, -6.46129e-05, -8.54894e-06},
{0.9394, 0.00840949, -0.000192847, -4.21023e-06},
{0.9761, 0.00616525, -0.000256001, -4.21021e-06},
{1., 0.,0.,0} };
};

static const struct COEFS X[] = {
{1, 2.2199e-17, -7.15515e-05, 3.1103e-06},
{0.9986, -0.000482243, -2.4897e-05, -1.3309e-06},
{0.9954, -0.00083103, -4.48605e-05, -9.86701e-07},
{0.99, -0.00135364, -5.9661e-05, 3.6777e-06},
{0.9822, -0.00167442, -4.49547e-06, -5.72411e-06},
{0.973, -0.00214868, -9.03571e-05, 1.8736e-08},
{0.96, -0.00305085, -9.00761e-05, 1.64917e-06},
{0.9427, -0.00382792, -6.53386e-05, -2.6154e-06},
{0.9216, -0.00467746, -0.00010457, 4.81243e-06},
{0.8962, -0.00536223, -3.23831e-05, -5.43432e-06},
{0.8679, -0.00609363, -0.000113898, 3.32484e-06},
{0.835, -0.00698325, -6.40253e-05, 9.34959e-07},
{0.7986, -0.00755338, -5.00009e-05, 9.35324e-07},
{0.7597, -0.00798324, -3.5971e-05, -2.27626e-06},
{0.7186, -0.00851367, -7.01149e-05, -8.6303e-06},
{0.6732, -0.00986209, -0.000199569, 1.91974e-05},
{0.6213, -0.010418, 8.83923e-05, 6.24051e-06},
{0.5722, -0.00906601, 0.000182, 6.24051e-06},
{0.5322, -0.00677797, 0.000275608, 6.24051e-06}
};
static const struct COEFS Y[] = {
{-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11},
{0.062, 0.0124, -1.26793e-09, 4.22642e-10},
{0.124, 0.0124, 5.07171e-09, -1.60604e-09},
{0.186, 0.0123999, -1.90189e-08, 6.00152e-09},
{0.248, 0.0124002, 7.10039e-08, -2.24e-08},
{0.31, 0.0123992, -2.64997e-07, 8.35986e-08},
{0.372, 0.0124029, 9.88983e-07, -3.11994e-07},
{0.434, 0.0123893, -3.69093e-06, -4.35621e-07},
{0.4958, 0.0123198, -1.02252e-05, -3.45523e-07},
{0.5571, 0.0121916, -1.54081e-05, -5.82288e-07},
{0.6176, 0.0119938, -2.41424e-05, -5.25327e-07},
{0.6769, 0.011713, -3.20223e-05, -5.16405e-07},
{0.7346, 0.0113541, -3.97684e-05, -6.09052e-07},
{0.7903, 0.0109107, -4.89042e-05, -1.04739e-06},
{0.8435, 0.0103431, -6.4615e-05, -1.40374e-09},
{0.8936, 0.00969686, -6.4636e-05, -8.547e-06},
{0.9394, 0.00840947, -0.000192841, -4.2106e-06},
{0.9761, 0.00616527, -0.000256, -4.2106e-06},
{1, 0.00328947, -0.000319159, -4.2106e-06}
};
#define FXC 0.8487
#define FYC 1.3523
#define C1 11.45915590261646417544
Expand Down

0 comments on commit d856016

Please sign in to comment.