Name

ST_OffsetCurve — Returns an offset line at a given distance and side from an input line.

Synopsis

geometry ST_OffsetCurve(geometry line, float signed_distance, text style_parameters='');

설명

Return an offset line at a given distance and side from an input line. All points of the returned geometries are not further than the given distance from the input geometry. Useful for computing parallel lines about a center line.

For positive distance the offset is on the left side of the input line and retains the same direction. For a negative distance it is on the right side and in the opposite direction.

거리의 단위는 공간 참조 시스템의 단위로 측정됩니다.

Note that output may be a MULTILINESTRING or EMPTY for some jigsaw-shaped input geometries.

다음과 같이 연산을 조정하기 위해 선택적인 세 번째 파라미터로 공백으로 구분된 키=값 쌍의 목록을 설정할 수 있습니다:

  • 'quad_segs=#' : 사분원(quarter circle)의 근사치를 계산하는 데 쓰이는 선분의 개수(기본값은 8)

  • 'join=round|mitre|bevel' : 접합 스타일(기본값은 "원형(round)"). '마이터(mitre)'의 동의어로 '마이터(miter)'도 쓸 수 있습니다.

  • 'mitre_limit=#.#' : 마이터 비율 제한(마이터 접합 스타일만 영향을 받습니다). 'mitre_limit'의 동의어로 'miter_limit'도 쓸 수 있습니다.

GEOS 모듈로 실행

Behavior changed in GEOS 3.11 so offset curves now have the same direction as the input line, for both positive and negative offsets.

2.0 버전부터 사용할 수 있습니다.

Enhanced: 2.5 - added support for GEOMETRYCOLLECTION and MULTILINESTRING

[Note]

This function ignores the Z dimension. It always gives a 2D result even when used on a 3D geometry.

예시

도로 주위로 열린 버퍼를 계산합니다.

SELECT ST_Union(
 ST_OffsetCurve(f.geom,  f.width/2, 'quad_segs=4 join=round'),
 ST_OffsetCurve(f.geom, -f.width/2, 'quad_segs=4 join=round')
) as track
FROM someroadstable;

                

거리 15, 원본 라인에서 'quad_segs=4 join=round' 및 오프셋은 15단위

SELECT ST_AsText(ST_OffsetCurve(ST_GeomFromText(
'LINESTRING(164 16,144 16,124 16,104 16,84 16,64 16,
    44 16,24 16,20 16,18 16,17 17,
    16 18,16 20,16 40,16 60,16 80,16 100,
    16 120,16 140,16 160,16 180,16 195)'),
    15, 'quad_segs=4 join=round'));

output

LINESTRING(164 1,18 1,12.2597485145237 2.1418070123307,
    7.39339828220179 5.39339828220179,
    5.39339828220179 7.39339828220179,
    2.14180701233067 12.2597485145237,1 18,1 195)
                

거리 -15, 원본 라인에서 'quad_segs=4 join=round' 및 오프셋은 -15단위

SELECT ST_AsText(ST_OffsetCurve(geom,
    -15, 'quad_segs=4 join=round')) As notsocurvy
    FROM ST_GeomFromText(
'LINESTRING(164 16,144 16,124 16,104 16,84 16,64 16,
    44 16,24 16,20 16,18 16,17 17,
    16 18,16 20,16 40,16 60,16 80,16 100,
    16 120,16 140,16 160,16 180,16 195)') As geom;

notsocurvy

LINESTRING(31 195,31 31,164 31)
                

더 둥글게 만들기 위한 이중 오프셋, 첫 번째 쿼리가 방향을 역전시킨다는 점에 주의하십시오. 즉 -30 + 15 = -15 입니다.

SELECT ST_AsText(ST_OffsetCurve(ST_OffsetCurve(geom,
    -30, 'quad_segs=4 join=round'), -15, 'quad_segs=4 join=round')) As morecurvy
    FROM ST_GeomFromText(
'LINESTRING(164 16,144 16,124 16,104 16,84 16,64 16,
    44 16,24 16,20 16,18 16,17 17,
    16 18,16 20,16 40,16 60,16 80,16 100,
    16 120,16 140,16 160,16 180,16 195)') As geom;

morecurvy

LINESTRING(164 31,46 31,40.2597485145236 32.1418070123307,
35.3933982822018 35.3933982822018,
32.1418070123307 40.2597485145237,31 46,31 195)
                

평행한 라인을 얻기 위한 정규 오프셋 15와 결합된, 더 둥글게 만들기 위한 이중 오프셋. 원본과 중첩.

SELECT ST_AsText(ST_Collect(
    ST_OffsetCurve(geom, 15, 'quad_segs=4 join=round'),
    ST_OffsetCurve(ST_OffsetCurve(geom,
    -30, 'quad_segs=4 join=round'), -15, 'quad_segs=4 join=round')
    )
) As parallel_curves
    FROM ST_GeomFromText(
'LINESTRING(164 16,144 16,124 16,104 16,84 16,64 16,
    44 16,24 16,20 16,18 16,17 17,
    16 18,16 20,16 40,16 60,16 80,16 100,
    16 120,16 140,16 160,16 180,16 195)') As geom;

parallel curves

MULTILINESTRING((164 1,18 1,12.2597485145237 2.1418070123307,
7.39339828220179 5.39339828220179,5.39339828220179 7.39339828220179,
2.14180701233067 12.2597485145237,1 18,1 195),
(164 31,46 31,40.2597485145236 32.1418070123307,35.3933982822018 35.3933982822018,
32.1418070123307 40.2597485145237,31 46,31 195))
                

거리 15, 원본 라인과 함께 표출된 'quad_segs=4 join=round'

SELECT ST_AsText(ST_OffsetCurve(ST_GeomFromText(
'LINESTRING(164 16,144 16,124 16,104 16,84 16,64 16,
    44 16,24 16,20 16,18 16,17 17,
    16 18,16 20,16 40,16 60,16 80,16 100,
    16 120,16 140,16 160,16 180,16 195)'),
        15, 'quad_segs=4 join=bevel'));

output

LINESTRING(164 1,18 1,7.39339828220179 5.39339828220179,
    5.39339828220179 7.39339828220179,1 18,1 195)
                

수집된 15, -15. join=mitre mitre_limit=2.1

SELECT ST_AsText(ST_Collect(
    ST_OffsetCurve(geom, 15, 'quad_segs=4 join=mitre mitre_limit=2.2'),
    ST_OffsetCurve(geom, -15, 'quad_segs=4 join=mitre mitre_limit=2.2')
    ) )
    FROM ST_GeomFromText(
'LINESTRING(164 16,144 16,124 16,104 16,84 16,64 16,
    44 16,24 16,20 16,18 16,17 17,
    16 18,16 20,16 40,16 60,16 80,16 100,
    16 120,16 140,16 160,16 180,16 195)') As geom;

output

MULTILINESTRING((164 1,11.7867965644036 1,1 11.7867965644036,1 195),
    (31 195,31 31,164 31))
                

참고

ST_Buffer