- 카테고리:
ST_LENGTH¶
Returns the geodesic length of the LineString(s) in a GEOGRAPHY object or the Euclidean length of the LineString(s) in a GEOMETRY object.
구문¶
ST_LENGTH( <geography_or_geometry_expression> )
인자¶
geography_or_geometry_expression
The argument must be of type GEOGRAPHY or GEOMETRY.
반환¶
길이를 미터 단위로 나타내는 REAL 값을 반환합니다.
사용법 노트¶
If
geography_or_geometry_expression
is not a LineString, MultiLineString, or GeometryCollection containing linestrings, ST_LENGTH returns 0.If
geography_or_geometry_expression
is a GeometryCollection, ST_LENGTH returns the sum of the lengths of the linestrings in the collection.다각형의 둘레 길이를 원하는 경우, 대신 ST_PERIMETER 함수를 사용하십시오.
예¶
GEOGRAPHY Examples¶
이는 적도에서 호 1도의 길이를 미터 단위로 보여줍니다.
SELECT ST_LENGTH(TO_GEOGRAPHY('LINESTRING(0.0 0.0, 1.0 0.0)')); +---------------------------------------------------------+ | ST_LENGTH(TO_GEOGRAPHY('LINESTRING(0.0 0.0, 1.0 0.0)')) | |---------------------------------------------------------| | 111195.101177484 | +---------------------------------------------------------+
GEOMETRY Examples¶
The following example demonstrates how to use the ST_LENGTH function.
SELECT ST_LENGTH(g), ST_ASWKT(g) FROM (SELECT TO_GEOMETRY(column1) AS g FROM VALUES ('POINT(1 1)'), ('LINESTRING(0 0, 1 1)'), ('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'));+--------------+--------------------------------+ | ST_LENGTH(G) | ST_ASWKT(G) | |--------------+--------------------------------| | 0 | POINT(1 1) | | 1.414213562 | LINESTRING(0 0,1 1) | | 0 | POLYGON((0 0,0 1,1 1,1 0,0 0)) | +--------------+--------------------------------+