# How best to create continuous buffer zones from linear objects using Postgres / PostGIS [closed]

Having familiarized with an similar question specified on the link Dividing a buffer into segments based on path and distance, the author asked an analogous question whether it is possible to solve this problem using PostGIS. The essence of the issue is shown in the figure 1 and

figure 2

Method is a SQL script, using Clip overlapping polygon in equal sharing size, author for which part of its implementation.

• Your question doesn't have a question. – Vince Jan 18 '19 at 0:50
• So your Answers aren't answers and the Q and two As are just one big code-this-for-me request? I can't vote to reopen that. – Vince Jan 18 '19 at 11:01
• Cyril you should only have 1 question and 1 correct answer (you can answer your own question but you seem to be treating GIS>SE as thread based tool - it is not is a question with one correct answer tool) – Mapperz Jan 18 '19 at 15:05

1. Create lines of approximately equal length from lines, the line must be ordered;
2. Run the script:
``````WITH
tblb AS (SELECT id, ST_Buffer ((geom), 0.0001,'endcap=round join=round') as geom FROM <name_table>),
tblc_l AS (SELECT a.id, ST_LineMerge(ST_Difference(ST_ExteriorRing(a.geom), b.geom)) geom FROM tblb a LEFT JOIN tblb b ON (ST_Intersects(a.geom, b.geom) AND a.id < b.id)),
tblcpoly_l AS (SELECT id, ST_MakePolygon(ST_AddPoint(geom, ST_StartPoint(geom))) geom FROM tblc_l),
tbld_r AS (SELECT a.id, ST_LineMerge(ST_Difference(ST_ExteriorRing(a.geom), b.geom)) geom FROM tblb a LEFT JOIN tblb b ON (ST_Intersects(a.geom, b.geom) AND a.id > b.id)),
tbldpoly_r AS (SELECT id, ST_MakePolygon(ST_AddPoint(geom, ST_StartPoint(geom))) geom FROM tbld_r)
SELECT ST_Intersection(a.geom, b.geom) as geom FROM tblcpoly_l a, tbldpoly_r b
WHERE ST_Intersects (a.geom, b.geom) AND a.id=b.id;
``````
1. See the picture

Good luck to everyone :-),

Original solutions ...

This script is called - ST_BambooBuffer...