ST_Contains

description

Syntax

BOOL ST_Contains(GEOMETRY shape1, GEOMETRY shape2)

判断几何图形shape1是否完全能够包含几何图形shape2

example

  1. mysql> SELECT ST_Contains(ST_Polygon("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"), ST_Point(5, 5));
  2. +----------------------------------------------------------------------------------------+
  3. | st_contains(st_polygon('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))'), st_point(5.0, 5.0)) |
  4. +----------------------------------------------------------------------------------------+
  5. | 1 |
  6. +----------------------------------------------------------------------------------------+
  7. mysql> SELECT ST_Contains(ST_Polygon("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"), ST_Point(50, 50));
  8. +------------------------------------------------------------------------------------------+
  9. | st_contains(st_polygon('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))'), st_point(50.0, 50.0)) |
  10. +------------------------------------------------------------------------------------------+
  11. | 0 |
  12. +------------------------------------------------------------------------------------------+

keywords

ST_CONTAINS,ST,CONTAINS