]> granicus.if.org Git - postgis/commitdiff
Move spheroid test to the correct place.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 3 Mar 2010 06:06:00 +0000 (06:06 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 3 Mar 2010 06:06:00 +0000 (06:06 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5369 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/geography_measurement.c

index 689adf488662da93fbfc923a4bd357ffa4b791cd..f6f03cc429e974a39ebf21b774f3dcf1f4d85c16 100644 (file)
@@ -248,10 +248,6 @@ Datum geography_area(PG_FUNCTION_ARGS)
        /* Initialize spheroid */
        spheroid_init(&s, WGS84_MAJOR_AXIS, WGS84_MINOR_AXIS);
 
-       /* User requests spherical calculation, turn our spheroid into a sphere */
-       if ( ! use_spheroid )
-               s.a = s.b = s.radius;
-
        lwgeom = lwgeom_from_gserialized(g);
 
        /* EMPTY things have no area */
@@ -279,6 +275,10 @@ Datum geography_area(PG_FUNCTION_ARGS)
                        use_spheroid = LW_FALSE;
        }
 
+       /* User requests spherical calculation, turn our spheroid into a sphere */
+       if ( ! use_spheroid )
+               s.a = s.b = s.radius;
+
        /* Calculate the area */
        if ( use_spheroid )
                area = lwgeom_area_spheroid(lwgeom, &gbox, &s);