Definition at line 81 of file lwgeom_spheroid.c.
References SPHEROID::a, SPHEROID::b, SPHEROID::e, SPHEROID::e_sq, ellipsoid_out(), SPHEROID::f, SPHEROID::name, and PG_FUNCTION_INFO_V1().
83 char *str = PG_GETARG_CSTRING(0);
90 if (strstr(str,
"SPHEROID") != str )
92 elog(ERROR,
"SPHEROID parser - doesn't start with SPHEROID");
97 nitems = sscanf(str,
"SPHEROID[\"%19[^\"]\",%lf,%lf]",
98 sphere->
name, &sphere->
a, &rf);
101 nitems = sscanf(str,
"SPHEROID(\"%19[^\"]\",%lf,%lf)",
102 sphere->
name, &sphere->
a, &rf);
106 elog(ERROR,
"SPHEROID parser - couldnt parse the spheroid");
112 sphere->
b = sphere->
a - (1.0/rf)*sphere->
a;
113 sphere->
e_sq = ((sphere->
a*sphere->
a) - (sphere->
b*sphere->
b)) /
114 (sphere->
a*sphere->
a);
115 sphere->
e = sqrt(sphere->
e_sq);
117 PG_RETURN_POINTER(sphere);