WL#10726: Ellipsoidal ST_Area

Affects: Server-8.0   —   Status: Complete   —   Priority: Medium

ST_Area currently only supports computations in Cartesian spatial reference systems (SRSs). This WL extends ST_Area to detect that its parameter is in a geographic (ellipsoidal) SRS and to compute the area on the ellipsoid.

Projected SRSs and SRID 0 will still return the same result as before. If the SRID refers to a geographic SRS, the result will be different.

F-1
ST_Area MUST return NULL if its argument is NULL.
F-2
If the argument is not a syntactically well-formed geometry, ST_Area MUST raise ER_GIS_INVALID_DATA during function evaluation.
F-3
If the argument is in an undefined SRS, ST_Area MUST raise ER_SRS_NOT_FOUND during function evaluation.
F-4
If the argument is geometrically invalid, ST_Area MUST either return a area result or raise an error. If a area is returned, the value is undefined, i.e. it may be any number.
F-5
If the argument is a valid polygon in a Cartesian SRS, ST_Area MUST return the Cartesian area of the polygon.
F-6
If the argument is a valid multipolygon in a Cartesian SRS, ST_Area MUST return the sum of the Cartesian area of the polygons.
F-7
(deleted)
F-8
If the argument is a valid polygon in a geographic SRS, ST_Area MUST return the geodetic area of the polygon in that SRS. The result MUST be in square meters.
F-9
If the argument is a valid multipolygon in a geographic SRS, ST_Area MUST return the sum of the geodetic area of the polygons in that SRS. The result MUST be in square meters.
F-10
(deleted)
F-11
If an area computation results in +Inf, ST_Area MUST raise ER_DATA_OUT_OF_RANGE during function evaluation.
F-12
If the argument is a geometry in a geographic SRS and a longitude value is not in the range (-180,180] (in degrees -- other limits in other units), ST_Area MUST raise ER_LONGITUDE_OUT_OF_RANGE.(*)
F-13
If the argument is a geometry in a geographic SRS and a latitude value is not in the range [-90,90] (in degrees -- other limits in other units), ST_Area MUST raise ER_LATITUDE_OUT_OF_RANGE.(*)
F-14
If the argument is a valid valid geometry, but not a polygon or multipolygon, ST_Area MUST raise ER_UNEXPECTED_GEOMETRY_TYPE.

(*) The exact limits will deviate slightly because of floating point arithmetics.

I-1 New files area.cc and area_functor.h.

I-2 No new syntax.

I-3 No new commands.

I-4 No new tools.

I-5 The semantics of interface SQL01 are changed: If the polygons is in a geographic SRS, ST_Area will return the geodetic area of the the polygon, or raise an error if the coordinates are out of bounds. Other calculations will remain as they are today.

I-6 No new errors or warnings.

See WL#9347 for an example of how to implement geography support. Follow the same pattern. Make sure resolve_type() sets maybe_null correctly. Re-implement val_real() based on the pattern from Item_func_distance::val_real().