Hulls and Covering Polygons

  1. Based on Lines
    1. Construct Bounding box of set of MULTILINESTRINGs
    2. Construct polygon containing lines
    3. Construct lines between all points of a Polygon
      1. Solution
  2. Based on Points
    1. Construct Regions from Points
    2. Construct regions from large sets of points (100K) tagged with region attribute.
    3. Construct a Star Polygon from a set of Points
    4. Construct a Concave Hull of Points as a Buffer of the Minimum Spanning Tree

Based on Lines

Construct Bounding box of set of MULTILINESTRINGs

https://gis.stackexchange.com/questions/115494/bounding-box-of-set-of-multilinestrings-in-postgis

SELECT type, ST_Envelope(ST_Collect(geom))
FROM line_table AS foo
GROUP BY type;

Construct polygon containing lines

https://gis.stackexchange.com/questions/238/find-polygon-that-contains-all-linestring-records-in-postgis-table

Solution

  • Use ST_Extent aggregate function on input set.
  • Use ST_ConvexHull on ST_Collect aggregate of input set.

Construct lines between all points of a Polygon

https://gis.stackexchange.com/questions/58534/get-the-lines-between-all-points-of-a-polygon-in-postgis-avoid-nested-loop

Solution

Rework given SQL using CROSS JOIN and a self join

Based on Points

Construct Regions from Points

https://gis.stackexchange.com/questions/92913/extra-detailed-bounding-polygon-from-many-geometric-points

Construct regions from large sets of points (100K) tagged with region attribute.

Could use ST_ConcaveHull, but results would overlap Perhaps ST_Voronoi would be better? How would this work, and what are limits on size of data?

Construct a Star Polygon from a set of Points

https://gis.stackexchange.com/questions/349945/creating-precise-shapes-using-list-of-coordinates

WITH pts(pt) AS (VALUES
(st_transform(st_setsrid(st_makepoint(-97.5660461, 30.4894905), 4326),4269) ),
(st_transform(st_setsrid(st_makepoint(-97.5657216, 30.4902173), 4326),4269) ),
(st_transform(st_setsrid(st_makepoint(-97.5608779, 30.4896142), 4326),4269) ),
(st_transform(st_setsrid(st_makepoint(-97.5605001, 30.491422), 4326),4269) ),
(st_transform(st_setsrid(st_makepoint(-97.5588115, 30.4911697), 4326),4269) ),
(st_transform(st_setsrid(st_makepoint(-97.5588262, 30.4910204), 4326),4269) ),
(st_transform(st_setsrid(st_makepoint(-97.5588262, 30.4910204), 4326),4269)),
(st_transform(st_setsrid(st_makepoint(-97.5585742, 30.4909966), 4326),4269)),
(st_transform(st_setsrid(st_makepoint(-97.5578045, 30.4909263), 4326),4269)),
(st_transform(st_setsrid(st_makepoint(-97.5574653, 30.4908877), 4326),4269)),
(st_transform(st_setsrid(st_makepoint(-97.5571534, 30.4908375), 4326),4269)),
(st_transform(st_setsrid(st_makepoint(-97.5560964, 30.4907427), 4326),4269))
),
centroid AS (SELECT ST_Centroid( ST_Collect(pt) ) AS centroid FROM pts),
line AS (SELECT ST_MakeLine( pt ORDER BY ST_Azimuth( centroid, pt ) ) AS geom
    FROM pts CROSS JOIN centroid),
poly AS (SELECT ST_MakePolygon( ST_AddPoint( geom, ST_StartPoint( geom ))) AS geom
    FROM line)
SELECT geom FROM poly;

Construct a Concave Hull of Points as a Buffer of the Minimum Spanning Tree

https://gis.stackexchange.com/questions/418840/how-to-create-a-polygon-around-a-set-of-points-without-blank-polygon-spaces-in-b

SQL code to construct a Minimum Spanning Tree.