ST_Area_Square_Meters,ST_Area_Square_Km

Syntax

  1. DOUBLE ST_Area_Square_Meters(GEOMETRY geo)
  2. DOUBLE ST_Area_Square_Km(GEOMETRY geo)

description

计算地球球面上区域的面积,目前参数geo支持St_Point,St_LineString,St_Circle和St_Polygon。

如果输入的是St_Point,St_LineString,则返回零。

其中,ST_Area_Square_Meters(GEOMETRY geo)返回的单位是平方米,ST_Area_Square_Km(GEOMETRY geo)返回的单位是平方千米。

example

  1. mysql> SELECT ST_Area_Square_Meters(ST_Circle(0, 0, 1));
  2. +-------------------------------------------------+
  3. | st_area_square_meters(st_circle(0.0, 0.0, 1.0)) |
  4. +-------------------------------------------------+
  5. | 3.1415926535897869 |
  6. +-------------------------------------------------+
  7. 1 row in set (0.04 sec)
  8. mysql> SELECT ST_Area_Square_Km(ST_Polygon("POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))"));
  9. +----------------------------------------------------------------------+
  10. | st_area_square_km(st_polygon('POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))')) |
  11. +----------------------------------------------------------------------+
  12. | 12364.036567076409 |
  13. +----------------------------------------------------------------------+
  14. 1 row in set (0.01 sec)
  15. mysql> SELECT ST_Area_Square_Meters(ST_Point(0, 1));
  16. +-------------------------------------------+
  17. | st_area_square_meters(st_point(0.0, 1.0)) |
  18. +-------------------------------------------+
  19. | 0 |
  20. +-------------------------------------------+
  21. 1 row in set (0.05 sec)
  22. mysql> SELECT ST_Area_Square_Meters(ST_LineFromText("LINESTRING (1 1, 2 2)"));
  23. +-----------------------------------------------------------------+
  24. | st_area_square_meters(st_linefromtext('LINESTRING (1 1, 2 2)')) |
  25. +-----------------------------------------------------------------+
  26. | 0 |
  27. +-----------------------------------------------------------------+
  28. 1 row in set (0.03 sec)

keywords

ST_Area_Square_Meters,ST_Area_Square_Km,ST_Area,ST,Area