Changes between Version 3 and Version 4 of UserWikiVariableBuffer


Ignore:
Timestamp:
Nov 25, 2019, 11:06:17 AM (4 years ago)
Author:
mdavis
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • UserWikiVariableBuffer

    v3 v4  
    44
    55The function below generates variable-distance buffers.
     6
    67It operates by creating the union of a series of segment buffers .
    78Each segment buffer is the convex hull of the buffers of the segment start and end points,
    89with the buffer distance computed proportionally to the fractional distance along the line.
    910
    10 **Note: currently only the end distance can be given.  The start distance is fixed to be (approximately) 0.**
    11 
    1211=== Example ===
    1312{{{
    14 SELECT ST_VariableBufferFromLine( 'LINESTRING( 0 0, 100 0)' , 10 );
     13SELECT ST_VariableBufferFromLine( 'LINESTRING( 0 0, 100 0)' , 1, 10 );
    1514}}}
    1615
     
    1918CREATE OR REPLACE FUNCTION ST_VariableBufferFromLine(
    2019    geom GEOMETRY,
     20    start_dist NUMERIC,
    2121    end_dist NUMERIC
    2222)
     
    3131        (SELECT (dump).path[1],
    3232            ST_Buffer( (dump).geom,
    33                 GREATEST(end_dist * ST_LineLocatePoint(geom, (dump).geom), 0.001)) AS geom
     33                start_dist + (end_dist - start_dist) * ST_LineLocatePoint(geom, (dump).geom)
     34                ) AS geom
    3435        FROM step1),
    3536    step3 AS