# Connecting circles with lines cover all circles using PostGIS? I'm really new to postgis.

I have trouble to find out the coding for connecting circles. You can figure out what I'm trying to do from the image I uploaded. I want to connect the circles which have the same numberings by outerline.

My first trial was using st_convexhull, st_concavehull but both of them does not make the covering polygons as I wanted.

like the following:

create table public.cover_line as
SELECT ST_Boundary(ST_ConcaveHull(geom,0.99)) as convex FROM circles;

Is there someone can help me?

• If you look at the online Help for St_ConcaveHull, you can add a Group By clause. Jul 5 '17 at 20:56
• look at te in this scenario:gis.stackexchange.com/a/342723/120129... Nov 24 '19 at 11:16

This task is simply solved with the help of QGIS tools, but if I understand you correctly, you would like to find its solution using PostGIS functions, as a result the solution of the problem is the following: For initial data, see Figure 1, the names of my tables are abstract, replace them with your own 1) Due to the fact that you are working with point buffer zones, you need to first determine their central points, as an option with this query:

``````create table buff_k21p6_aeroporty_centroid as
SELECT ST_Centroid (geom)
FROM buff_k21p6_aeroporty
``````

The result, see in Figure 2 2) Now create in pairs (links from two adjacent point buffer zones common zones), for example

``````create table buff_k21p6_aeroporty_buff as
SELECT ST_ConvexHull (ST_Collect (geom)) As geom
FROM buff_k21p6_aeroporty, k21p6_aeroporty
WHERE
buff_k21p6_aeroporty.gid = 4 or
buff_k21p6_aeroporty.gid = 11;
``````

The result, see Figure 3 3) Combine adjacent paired zones into a common, for example

``````create table buff_k21p6_aeroporty_buff_union as
SELECT * from buff_k21p6_aeroporty_buff
UNION ALL
SELECT * from buff_k21p6_aeroporty_buff2;
``````

The result, see Figure 4 4) As I understand you need the boundary of the general buffer polygon, then run the query:

``````create table buff_k21p6_aeroporty_buff_boundary as
SELECT ST_Boundary (geom)
FROM buff_k21p6_aeroporty_buff_union
``````

The result, see Figure 5 I hope that I answered your question and was able to direct you to the right path, good luck.