PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ test_lwgeom_area_sphere()

static void test_lwgeom_area_sphere ( void  )
static

Definition at line 1561 of file cu_geodetic.c.

1562 {
1563  LWGEOM *lwg;
1564  double area;
1565  SPHEROID s;
1566 
1567  /* Init to WGS84 */
1569 
1570  /* Simple case */
1571  lwg = lwgeom_from_wkt("POLYGON((1 1, 1 2, 2 2, 2 1, 1 1))", LW_PARSER_CHECK_NONE);
1572  area = lwgeom_area_sphere(lwg, &s);
1573 
1574  CU_ASSERT_DOUBLE_EQUAL(area, 12360265021.3561, 1.0);
1575  lwgeom_free(lwg);
1576 
1577  /* Robustness tests, from ticket #3393 */
1578  lwg = lwgeom_from_wkt("POLYGON((0 78.703946026663,0 0,179.999997913235 0,179.999997913235 -33.0888306884702,0 78.703946026663))", LW_PARSER_CHECK_NONE);
1579  area = lwgeom_area_sphere(lwg, &s);
1580  CU_ASSERT_DOUBLE_EQUAL(area, 127516467322130, 1.0);
1581  lwgeom_free(lwg);
1582 
1583  lwg = lwgeom_from_wkt("POLYGON((0 78.703946026662,0 0,179.999997913235 0,179.999997913235 -33.0888306884702,0 78.703946026662))", LW_PARSER_CHECK_NONE);
1584  area = lwgeom_area_sphere(lwg, &s);
1585  CU_ASSERT_DOUBLE_EQUAL(area, 127516467322130, 1.0);
1586  lwgeom_free(lwg);
1587 
1588  lwg = lwgeom_from_wkt("POLYGON((0 78.703946026664,0 0,179.999997913235 0,179.999997913235 -33.0888306884702,0 78.703946026664))", LW_PARSER_CHECK_NONE);
1589  area = lwgeom_area_sphere(lwg, &s);
1590  CU_ASSERT_DOUBLE_EQUAL(area, 127516467322130, 1.0);
1591  lwgeom_free(lwg);
1592  /* end #3393 */
1593 }
char * s
Definition: cu_in_wkt.c:23
#define WGS84_MAJOR_AXIS
Definition: liblwgeom.h:159
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2060
#define WGS84_MINOR_AXIS
Definition: liblwgeom.h:161
void spheroid_init(SPHEROID *s, double a, double b)
Initialize a spheroid object for use in geodetic functions.
Definition: lwspheroid.c:39
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:905
double lwgeom_area_sphere(const LWGEOM *lwgeom, const SPHEROID *spheroid)
Calculate the geodetic area of a lwgeom on the sphere.
Definition: lwgeodetic.c:2031

References LW_PARSER_CHECK_NONE, lwgeom_area_sphere(), lwgeom_free(), lwgeom_from_wkt(), s, spheroid_init(), WGS84_MAJOR_AXIS, and WGS84_MINOR_AXIS.

Referenced by geodetic_suite_setup().

Here is the call graph for this function:
Here is the caller graph for this function: