[postgis-devel] Trying to get st_convexhull to return a bonduing box for a collection of linestrings

Leknín Řepánek godzilalalala at gmail.com
Sun Jan 3 13:01:47 PST 2016


CREATE TABLE t (id serial primary key, geom geometry(LINESTRING, 0));

INSERT INTO t(geom) values
('LINESTRING(0 0,0 1)')
, ('LINESTRING(0 1,1 1)')
, ('LINESTRING(1 1,1 0)')
, ('LINESTRING(1 0,0 0)')
, ('LINESTRING(1 1,2 1)')
, ('LINESTRING(2 1,2 0)')
, ('LINESTRING(2 0,1 0)');


WITH poly as (
     SELECT ST_POLYGONIZE(geom) g FROM t
)
SELECT ST_AsText(ST_UnaryUnion(g)) g FROM poly;



On Sun, Jan 03, 2016 at 08:12:28PM +0000, dave.potts at pinan.co.uk wrote:
> Hi
> 
> I have  postgis table which includes a series of Linestrings,  I am trying to
> create a single geometry that includes only the outside layer of line strings.
> 
> An example would be if the line strings described  digital 8, formed from
> squares two boxes,  I would want something looked like a rectangle, 
> 
> I have tried things like 
> 
>  select st_convexhull( st_union(st_startpoint(the_geom),st_endpoint(the_geom)))
>  from bar_table
> 
> I assumed that I would get a polygon with the middle bar removed, what I got
> was a collection of linestrings
> 
> Has anybody got any suggestions?
> 
> regards
> 
> 
> Dave.

> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-devel


On Sun, Jan 03, 2016 at 09:13:48PM +0100, Michal Fortik wrote:
> Rok plný úsměvů přejí
> 
> Michal, Hanka, Hubert a Lejdy






More information about the postgis-devel mailing list