Hello postgis-community,

I'm searching for a solution to create aggregated geometries from a table with 
different single geometries. The input data looks like that:

id            foreign_key       geom
1             100                         point
2             200                         point
3             200                         point
4             300                         point
5             300                         point
6             300                         point
7             400                         point
8             400                         line
9             500                         point
10           500                         polygon

Now, I want to group this data by the "foreign_key". The result table have to 
be this structure:
foreign_key       geom
100                         point                     * result of one point
200                         line                        * result of two points
300                         polygon               * result of three points
400                         polygon               * result of one line and one 
point
500                         polygon               * result of one polygon and 
one point
600                        (...)                         * other combinations

The target is the smallest geometry that contains all single geometries. For 
example, three points creates a triangle-polygon.

My last try looks like this:

SELECT e. foreign_key,
                   ST_Multi(ST_makeline(e.geom)) as geom
                FROM gis_schema.single_objects e
GROUP BY e. foreign_key

(* Of course, polygons are not considered yet ;-)

Have anybody an idea? Thank's a lot!

Best regards,
Christopher


_______________________________________________
postgis-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to