Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
Qubiq1337 edited this pageApr 3, 2020 ·7 revisions

Relationship Tests


ST_Contains

Overloads:

  • ST_Contains(geometry1, geometry2)return true if geometry1 contains geometry2

Example:

SELECT ST_Contains(ST_Polygon(1,1,1,4,4,4,4,1), ST_Point(2,3))from srcLIMIT1;-- return trueSELECT ST_Contains(ST_Polygon(1,1,1,4,4,4,4,1), ST_Point(8,8))from srcLIMIT1;-- return false

ST_Crosses

Overloads:

  • ST_Crosses(geometry1, geometry2)return true if geometry1 crosses geometry2

Example:

SELECT ST_Crosses(st_linestring(0,0,1,1), st_linestring(1,0,0,1))from srcLIMIT1;-- return trueSELECT ST_Crosses(st_linestring(2,0,2,3), st_polygon(1,1,1,4,4,4,4,1))from srcLIMIT1;-- return trueSELECT ST_Crosses(st_linestring(0,2,0,1), ST_linestring(2,0,1,0))from srcLIMIT1;-- return false

ST_Disjoint

Overloads:

  • ST_Disjoint(geometry1, geometry2)return true if the intersection of geometry1 and geometry2 is empty

Example:

SELECT ST_Disjoint(ST_LineString(0,0,0,1), ST_LineString(1,1,1,0))from srcLIMIT1;-- return trueSELECT ST_Disjoint(ST_LineString(0,0,1,1), ST_LineString(1,0,0,1))from srcLIMIT1;-- return false

ST_EnvIntersects

Overloads:

  • ST_EnvIntersects(ST_Geometry1, ST_Geometry2)return true if the envelopes of ST_Geometry1 and ST_Geometry2 intersect

Example:

SELECT ST_EnvIntersects(ST_LineString(0,0,1,1), ST_LineString(1,3,2,2))from srcLIMIT1;-- return falseSELECT ST_EnvIntersects(ST_LineString(0,0,2,2), ST_LineString(1,0,3,2))from srcLIMIT1;-- return true

ST_Equals

Overloads:

  • ST_Equals(geometry1, geometry2)return true if geometry1 equals geometry2

Example:

SELECT ST_Equals(st_linestring(0,0,1,1), st_linestring(1,1,0,0))from srcLIMIT1;-- return trueSELECT ST_Equals(st_linestring(0,0,1,1), st_linestring(1,0,0,1))from srcLIMIT1;-- return false

ST_Intersects

Overloads:

  • ST_Intersects(geometry1, geometry2)return true if geometry1 intersects geometry2

Example:

SELECT ST_Intersects(st_linestring(0,0,1,1), st_linestring(1,1,0,0))from srcLIMIT1;-- return trueSELECT ST_Intersects(st_linestring(0,0,1,1), st_linestring(1,0,0,1))from srcLIMIT1;-- return trueSELECT ST_Intersects(ST_LineString(2,0,2,3), ST_Polygon(1,1,4,1,4,4,1,4))from srcLIMIT1;-- return trueSELECT ST_Intersects(ST_LineString(8,7,7,8), ST_Polygon(1,1,4,1,4,4,1,4))from srcLIMIT1;-- return false

ST_Overlaps

Overloads:

  • ST_Overlaps(geometry1, geometry2)return true if geometry1 overlaps geometry2

Example:

SELECT ST_Overlaps(st_polygon(2,0,2,3,3,0), st_polygon(1,1,1,4,4,4,4,1))from srcLIMIT1;-- return trueSELECT ST_Overlaps(st_polygon(2,0,2,1,3,1), ST_Polygon(1,1,1,4,4,4,4,1))from srcLIMIT1;-- return false

ST_Relate

Overloads:

  • ST_Relate(geometry1, geometry2)return true if geometry1 has the specified DE-9IM relationship with geometry2

Example:

SELECT ST_Relate(st_polygon(2,0,2,1,3,1), ST_Polygon(1,1,1,4,4,4,4,1),'****T****')from srcLIMIT1;-- trueSELECT ST_Relate(st_polygon(2,0,2,1,3,1), ST_Polygon(1,1,1,4,4,4,4,1),'T********')from srcLIMIT1;-- falseSELECT ST_Relate(st_linestring(0,0,3,3), ST_linestring(1,1,4,4),'T********')from srcLIMIT1;-- trueSELECT ST_Relate(st_linestring(0,0,3,3), ST_linestring(1,1,4,4),'****T****')from srcLIMIT1;-- false

ST_Touches

Overloads:

  • ST_Touches(geometry1, geometry2)return true if geometry1 touches geometry2

Example:

SELECT ST_Touches(st_point(1,2), st_polygon(1,1,1,4,4,4,4,1))from srcLIMIT1;-- return trueSELECT ST_Touches(st_point(8,8), st_polygon(1,1,1,4,4,4,4,1))from srcLIMIT1;-- return false

ST_Within

Overloads:

  • ST_Within(geometry1, geometry2)return true if geometry1 is within geometry2

Example:

SELECT ST_Within(st_point(2,3), st_polygon(1,1,1,4,4,4,4,1))from srcLIMIT1;-- return trueSELECT ST_Within(st_point(8,8), st_polygon(1,1,1,4,4,4,4,1))from srcLIMIT1;-- return false
Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp